From 418540c79dfcbad6810dbd783fc22fa908655e86 Mon Sep 17 00:00:00 2001 From: zhaoxiangchun <1422928955@qq.com> Date: Wed, 23 Sep 2020 19:45:46 +0800 Subject: [PATCH] bugfix:esxi collect metric --- pkg/multicloud/esxi/monitor.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/multicloud/esxi/monitor.go b/pkg/multicloud/esxi/monitor.go index df8f0f63a2..3bb687cc32 100644 --- a/pkg/multicloud/esxi/monitor.go +++ b/pkg/multicloud/esxi/monitor.go @@ -187,6 +187,9 @@ func (cli *SESXiClient) getManagerEntityofVm(server jsonutils.JSONObject) (*mo.M } for _, virtualMachine := range virtualMachines { guest := NewVirtualMachine(cli, &virtualMachine, nil) + if guest == nil { + continue + } ip := guest.GetGlobalId() if ip == extId { return virtualMachine.Entity(), nil @@ -204,6 +207,9 @@ func (cli *SESXiClient) getManagerEntityofHost(host jsonutils.JSONObject) (*mo.M } for _, hostSystem := range hostSystems { host := NewHost(cli, &hostSystem, nil) + if host == nil { + continue + } ip := host.GetGlobalId() if ip == extId { return hostSystem.Entity(), nil