diff --git a/src/go/go.mod b/src/go/go.mod index eec63586984e3d..59203a474f8f0c 100644 --- a/src/go/go.mod +++ b/src/go/go.mod @@ -47,7 +47,7 @@ require ( github.com/stretchr/testify v1.10.0 github.com/tidwall/gjson v1.18.0 github.com/valyala/fastjson v1.6.4 - github.com/vmware/govmomi v0.46.2 + github.com/vmware/govmomi v0.46.3 go.mongodb.org/mongo-driver v1.17.1 go.uber.org/automaxprocs v1.6.0 golang.org/x/net v0.32.0 diff --git a/src/go/go.sum b/src/go/go.sum index 8342f8fdc6909a..07f4453fe5eca6 100644 --- a/src/go/go.sum +++ b/src/go/go.sum @@ -393,8 +393,8 @@ github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= -github.com/vmware/govmomi v0.46.2 h1:gZTIcKSr4sVcDB803FUv0r4lhOgE5Y5WQCNW75dPlls= -github.com/vmware/govmomi v0.46.2/go.mod h1:uoLVU9zlXC4p4GmLVG+ZJmBC0Gn3Q7mytOJvi39OhxA= +github.com/vmware/govmomi v0.46.3 h1:zBn42Rl0WZBFhGao8Dy0MFRkbE4YNPqOu0OBd+ww6VM= +github.com/vmware/govmomi v0.46.3/go.mod h1:uoLVU9zlXC4p4GmLVG+ZJmBC0Gn3Q7mytOJvi39OhxA= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= diff --git a/src/go/plugin/go.d/collector/vsphere/collector_test.go b/src/go/plugin/go.d/collector/vsphere/collector_test.go index d4fff2edc5a224..21f7c2eec2c05c 100644 --- a/src/go/plugin/go.d/collector/vsphere/collector_test.go +++ b/src/go/plugin/go.d/collector/vsphere/collector_test.go @@ -137,198 +137,198 @@ func TestCollector_Collect(t *testing.T) { collr.scraper = mockScraper{collr.scraper} expected := map[string]int64{ - "host-22_cpu.usage.average": 100, - "host-22_disk.maxTotalLatency.latest": 100, - "host-22_disk.read.average": 100, - "host-22_disk.write.average": 100, - "host-22_mem.active.average": 100, - "host-22_mem.consumed.average": 100, - "host-22_mem.granted.average": 100, - "host-22_mem.shared.average": 100, - "host-22_mem.sharedcommon.average": 100, - "host-22_mem.swapinRate.average": 100, - "host-22_mem.swapoutRate.average": 100, - "host-22_mem.usage.average": 100, - "host-22_net.bytesRx.average": 100, - "host-22_net.bytesTx.average": 100, - "host-22_net.droppedRx.summation": 100, - "host-22_net.droppedTx.summation": 100, - "host-22_net.errorsRx.summation": 100, - "host-22_net.errorsTx.summation": 100, - "host-22_net.packetsRx.summation": 100, - "host-22_net.packetsTx.summation": 100, - "host-22_overall.status.gray": 1, - "host-22_overall.status.green": 0, - "host-22_overall.status.red": 0, - "host-22_overall.status.yellow": 0, - "host-22_sys.uptime.latest": 100, - "host-38_cpu.usage.average": 100, - "host-38_disk.maxTotalLatency.latest": 100, - "host-38_disk.read.average": 100, - "host-38_disk.write.average": 100, - "host-38_mem.active.average": 100, - "host-38_mem.consumed.average": 100, - "host-38_mem.granted.average": 100, - "host-38_mem.shared.average": 100, - "host-38_mem.sharedcommon.average": 100, - "host-38_mem.swapinRate.average": 100, - "host-38_mem.swapoutRate.average": 100, - "host-38_mem.usage.average": 100, - "host-38_net.bytesRx.average": 100, - "host-38_net.bytesTx.average": 100, - "host-38_net.droppedRx.summation": 100, - "host-38_net.droppedTx.summation": 100, - "host-38_net.errorsRx.summation": 100, - "host-38_net.errorsTx.summation": 100, - "host-38_net.packetsRx.summation": 100, - "host-38_net.packetsTx.summation": 100, - "host-38_overall.status.gray": 1, - "host-38_overall.status.green": 0, - "host-38_overall.status.red": 0, - "host-38_overall.status.yellow": 0, - "host-38_sys.uptime.latest": 100, - "host-48_cpu.usage.average": 100, - "host-48_disk.maxTotalLatency.latest": 100, - "host-48_disk.read.average": 100, - "host-48_disk.write.average": 100, - "host-48_mem.active.average": 100, - "host-48_mem.consumed.average": 100, - "host-48_mem.granted.average": 100, - "host-48_mem.shared.average": 100, - "host-48_mem.sharedcommon.average": 100, - "host-48_mem.swapinRate.average": 100, - "host-48_mem.swapoutRate.average": 100, - "host-48_mem.usage.average": 100, - "host-48_net.bytesRx.average": 100, - "host-48_net.bytesTx.average": 100, - "host-48_net.droppedRx.summation": 100, - "host-48_net.droppedTx.summation": 100, - "host-48_net.errorsRx.summation": 100, - "host-48_net.errorsTx.summation": 100, - "host-48_net.packetsRx.summation": 100, - "host-48_net.packetsTx.summation": 100, - "host-48_overall.status.gray": 1, - "host-48_overall.status.green": 0, - "host-48_overall.status.red": 0, - "host-48_overall.status.yellow": 0, - "host-48_sys.uptime.latest": 100, - "host-58_cpu.usage.average": 100, - "host-58_disk.maxTotalLatency.latest": 100, - "host-58_disk.read.average": 100, - "host-58_disk.write.average": 100, - "host-58_mem.active.average": 100, - "host-58_mem.consumed.average": 100, - "host-58_mem.granted.average": 100, - "host-58_mem.shared.average": 100, - "host-58_mem.sharedcommon.average": 100, - "host-58_mem.swapinRate.average": 100, - "host-58_mem.swapoutRate.average": 100, - "host-58_mem.usage.average": 100, - "host-58_net.bytesRx.average": 100, - "host-58_net.bytesTx.average": 100, - "host-58_net.droppedRx.summation": 100, - "host-58_net.droppedTx.summation": 100, - "host-58_net.errorsRx.summation": 100, - "host-58_net.errorsTx.summation": 100, - "host-58_net.packetsRx.summation": 100, - "host-58_net.packetsTx.summation": 100, - "host-58_overall.status.gray": 1, - "host-58_overall.status.green": 0, - "host-58_overall.status.red": 0, - "host-58_overall.status.yellow": 0, - "host-58_sys.uptime.latest": 100, - "vm-63_cpu.usage.average": 200, - "vm-63_disk.maxTotalLatency.latest": 200, - "vm-63_disk.read.average": 200, - "vm-63_disk.write.average": 200, - "vm-63_mem.active.average": 200, - "vm-63_mem.consumed.average": 200, - "vm-63_mem.granted.average": 200, - "vm-63_mem.shared.average": 200, - "vm-63_mem.swapinRate.average": 200, - "vm-63_mem.swapoutRate.average": 200, - "vm-63_mem.swapped.average": 200, - "vm-63_mem.usage.average": 200, - "vm-63_net.bytesRx.average": 200, - "vm-63_net.bytesTx.average": 200, - "vm-63_net.droppedRx.summation": 200, - "vm-63_net.droppedTx.summation": 200, - "vm-63_net.packetsRx.summation": 200, - "vm-63_net.packetsTx.summation": 200, - "vm-63_overall.status.gray": 0, - "vm-63_overall.status.green": 1, - "vm-63_overall.status.red": 0, - "vm-63_overall.status.yellow": 0, - "vm-63_sys.uptime.latest": 200, - "vm-66_cpu.usage.average": 200, - "vm-66_disk.maxTotalLatency.latest": 200, - "vm-66_disk.read.average": 200, - "vm-66_disk.write.average": 200, - "vm-66_mem.active.average": 200, - "vm-66_mem.consumed.average": 200, - "vm-66_mem.granted.average": 200, - "vm-66_mem.shared.average": 200, - "vm-66_mem.swapinRate.average": 200, - "vm-66_mem.swapoutRate.average": 200, - "vm-66_mem.swapped.average": 200, - "vm-66_mem.usage.average": 200, - "vm-66_net.bytesRx.average": 200, - "vm-66_net.bytesTx.average": 200, - "vm-66_net.droppedRx.summation": 200, - "vm-66_net.droppedTx.summation": 200, - "vm-66_net.packetsRx.summation": 200, - "vm-66_net.packetsTx.summation": 200, - "vm-66_overall.status.gray": 0, - "vm-66_overall.status.green": 1, - "vm-66_overall.status.red": 0, - "vm-66_overall.status.yellow": 0, - "vm-66_sys.uptime.latest": 200, - "vm-69_cpu.usage.average": 200, - "vm-69_disk.maxTotalLatency.latest": 200, - "vm-69_disk.read.average": 200, - "vm-69_disk.write.average": 200, - "vm-69_mem.active.average": 200, - "vm-69_mem.consumed.average": 200, - "vm-69_mem.granted.average": 200, - "vm-69_mem.shared.average": 200, - "vm-69_mem.swapinRate.average": 200, - "vm-69_mem.swapoutRate.average": 200, - "vm-69_mem.swapped.average": 200, - "vm-69_mem.usage.average": 200, - "vm-69_net.bytesRx.average": 200, - "vm-69_net.bytesTx.average": 200, - "vm-69_net.droppedRx.summation": 200, - "vm-69_net.droppedTx.summation": 200, - "vm-69_net.packetsRx.summation": 200, - "vm-69_net.packetsTx.summation": 200, - "vm-69_overall.status.gray": 0, - "vm-69_overall.status.green": 1, - "vm-69_overall.status.red": 0, - "vm-69_overall.status.yellow": 0, - "vm-69_sys.uptime.latest": 200, - "vm-72_cpu.usage.average": 200, - "vm-72_disk.maxTotalLatency.latest": 200, - "vm-72_disk.read.average": 200, - "vm-72_disk.write.average": 200, - "vm-72_mem.active.average": 200, - "vm-72_mem.consumed.average": 200, - "vm-72_mem.granted.average": 200, - "vm-72_mem.shared.average": 200, - "vm-72_mem.swapinRate.average": 200, - "vm-72_mem.swapoutRate.average": 200, - "vm-72_mem.swapped.average": 200, - "vm-72_mem.usage.average": 200, - "vm-72_net.bytesRx.average": 200, - "vm-72_net.bytesTx.average": 200, - "vm-72_net.droppedRx.summation": 200, - "vm-72_net.droppedTx.summation": 200, - "vm-72_net.packetsRx.summation": 200, - "vm-72_net.packetsTx.summation": 200, - "vm-72_overall.status.gray": 0, - "vm-72_overall.status.green": 1, - "vm-72_overall.status.red": 0, - "vm-72_overall.status.yellow": 0, - "vm-72_sys.uptime.latest": 200, + "host-21_cpu.usage.average": 100, + "host-21_disk.maxTotalLatency.latest": 100, + "host-21_disk.read.average": 100, + "host-21_disk.write.average": 100, + "host-21_mem.active.average": 100, + "host-21_mem.consumed.average": 100, + "host-21_mem.granted.average": 100, + "host-21_mem.shared.average": 100, + "host-21_mem.sharedcommon.average": 100, + "host-21_mem.swapinRate.average": 100, + "host-21_mem.swapoutRate.average": 100, + "host-21_mem.usage.average": 100, + "host-21_net.bytesRx.average": 100, + "host-21_net.bytesTx.average": 100, + "host-21_net.droppedRx.summation": 100, + "host-21_net.droppedTx.summation": 100, + "host-21_net.errorsRx.summation": 100, + "host-21_net.errorsTx.summation": 100, + "host-21_net.packetsRx.summation": 100, + "host-21_net.packetsTx.summation": 100, + "host-21_overall.status.gray": 1, + "host-21_overall.status.green": 0, + "host-21_overall.status.red": 0, + "host-21_overall.status.yellow": 0, + "host-21_sys.uptime.latest": 100, + "host-37_cpu.usage.average": 100, + "host-37_disk.maxTotalLatency.latest": 100, + "host-37_disk.read.average": 100, + "host-37_disk.write.average": 100, + "host-37_mem.active.average": 100, + "host-37_mem.consumed.average": 100, + "host-37_mem.granted.average": 100, + "host-37_mem.shared.average": 100, + "host-37_mem.sharedcommon.average": 100, + "host-37_mem.swapinRate.average": 100, + "host-37_mem.swapoutRate.average": 100, + "host-37_mem.usage.average": 100, + "host-37_net.bytesRx.average": 100, + "host-37_net.bytesTx.average": 100, + "host-37_net.droppedRx.summation": 100, + "host-37_net.droppedTx.summation": 100, + "host-37_net.errorsRx.summation": 100, + "host-37_net.errorsTx.summation": 100, + "host-37_net.packetsRx.summation": 100, + "host-37_net.packetsTx.summation": 100, + "host-37_overall.status.gray": 1, + "host-37_overall.status.green": 0, + "host-37_overall.status.red": 0, + "host-37_overall.status.yellow": 0, + "host-37_sys.uptime.latest": 100, + "host-47_cpu.usage.average": 100, + "host-47_disk.maxTotalLatency.latest": 100, + "host-47_disk.read.average": 100, + "host-47_disk.write.average": 100, + "host-47_mem.active.average": 100, + "host-47_mem.consumed.average": 100, + "host-47_mem.granted.average": 100, + "host-47_mem.shared.average": 100, + "host-47_mem.sharedcommon.average": 100, + "host-47_mem.swapinRate.average": 100, + "host-47_mem.swapoutRate.average": 100, + "host-47_mem.usage.average": 100, + "host-47_net.bytesRx.average": 100, + "host-47_net.bytesTx.average": 100, + "host-47_net.droppedRx.summation": 100, + "host-47_net.droppedTx.summation": 100, + "host-47_net.errorsRx.summation": 100, + "host-47_net.errorsTx.summation": 100, + "host-47_net.packetsRx.summation": 100, + "host-47_net.packetsTx.summation": 100, + "host-47_overall.status.gray": 1, + "host-47_overall.status.green": 0, + "host-47_overall.status.red": 0, + "host-47_overall.status.yellow": 0, + "host-47_sys.uptime.latest": 100, + "host-57_cpu.usage.average": 100, + "host-57_disk.maxTotalLatency.latest": 100, + "host-57_disk.read.average": 100, + "host-57_disk.write.average": 100, + "host-57_mem.active.average": 100, + "host-57_mem.consumed.average": 100, + "host-57_mem.granted.average": 100, + "host-57_mem.shared.average": 100, + "host-57_mem.sharedcommon.average": 100, + "host-57_mem.swapinRate.average": 100, + "host-57_mem.swapoutRate.average": 100, + "host-57_mem.usage.average": 100, + "host-57_net.bytesRx.average": 100, + "host-57_net.bytesTx.average": 100, + "host-57_net.droppedRx.summation": 100, + "host-57_net.droppedTx.summation": 100, + "host-57_net.errorsRx.summation": 100, + "host-57_net.errorsTx.summation": 100, + "host-57_net.packetsRx.summation": 100, + "host-57_net.packetsTx.summation": 100, + "host-57_overall.status.gray": 1, + "host-57_overall.status.green": 0, + "host-57_overall.status.red": 0, + "host-57_overall.status.yellow": 0, + "host-57_sys.uptime.latest": 100, + "vm-62_cpu.usage.average": 200, + "vm-62_disk.maxTotalLatency.latest": 200, + "vm-62_disk.read.average": 200, + "vm-62_disk.write.average": 200, + "vm-62_mem.active.average": 200, + "vm-62_mem.consumed.average": 200, + "vm-62_mem.granted.average": 200, + "vm-62_mem.shared.average": 200, + "vm-62_mem.swapinRate.average": 200, + "vm-62_mem.swapoutRate.average": 200, + "vm-62_mem.swapped.average": 200, + "vm-62_mem.usage.average": 200, + "vm-62_net.bytesRx.average": 200, + "vm-62_net.bytesTx.average": 200, + "vm-62_net.droppedRx.summation": 200, + "vm-62_net.droppedTx.summation": 200, + "vm-62_net.packetsRx.summation": 200, + "vm-62_net.packetsTx.summation": 200, + "vm-62_overall.status.gray": 0, + "vm-62_overall.status.green": 1, + "vm-62_overall.status.red": 0, + "vm-62_overall.status.yellow": 0, + "vm-62_sys.uptime.latest": 200, + "vm-65_cpu.usage.average": 200, + "vm-65_disk.maxTotalLatency.latest": 200, + "vm-65_disk.read.average": 200, + "vm-65_disk.write.average": 200, + "vm-65_mem.active.average": 200, + "vm-65_mem.consumed.average": 200, + "vm-65_mem.granted.average": 200, + "vm-65_mem.shared.average": 200, + "vm-65_mem.swapinRate.average": 200, + "vm-65_mem.swapoutRate.average": 200, + "vm-65_mem.swapped.average": 200, + "vm-65_mem.usage.average": 200, + "vm-65_net.bytesRx.average": 200, + "vm-65_net.bytesTx.average": 200, + "vm-65_net.droppedRx.summation": 200, + "vm-65_net.droppedTx.summation": 200, + "vm-65_net.packetsRx.summation": 200, + "vm-65_net.packetsTx.summation": 200, + "vm-65_overall.status.gray": 0, + "vm-65_overall.status.green": 1, + "vm-65_overall.status.red": 0, + "vm-65_overall.status.yellow": 0, + "vm-65_sys.uptime.latest": 200, + "vm-68_cpu.usage.average": 200, + "vm-68_disk.maxTotalLatency.latest": 200, + "vm-68_disk.read.average": 200, + "vm-68_disk.write.average": 200, + "vm-68_mem.active.average": 200, + "vm-68_mem.consumed.average": 200, + "vm-68_mem.granted.average": 200, + "vm-68_mem.shared.average": 200, + "vm-68_mem.swapinRate.average": 200, + "vm-68_mem.swapoutRate.average": 200, + "vm-68_mem.swapped.average": 200, + "vm-68_mem.usage.average": 200, + "vm-68_net.bytesRx.average": 200, + "vm-68_net.bytesTx.average": 200, + "vm-68_net.droppedRx.summation": 200, + "vm-68_net.droppedTx.summation": 200, + "vm-68_net.packetsRx.summation": 200, + "vm-68_net.packetsTx.summation": 200, + "vm-68_overall.status.gray": 0, + "vm-68_overall.status.green": 1, + "vm-68_overall.status.red": 0, + "vm-68_overall.status.yellow": 0, + "vm-68_sys.uptime.latest": 200, + "vm-71_cpu.usage.average": 200, + "vm-71_disk.maxTotalLatency.latest": 200, + "vm-71_disk.read.average": 200, + "vm-71_disk.write.average": 200, + "vm-71_mem.active.average": 200, + "vm-71_mem.consumed.average": 200, + "vm-71_mem.granted.average": 200, + "vm-71_mem.shared.average": 200, + "vm-71_mem.swapinRate.average": 200, + "vm-71_mem.swapoutRate.average": 200, + "vm-71_mem.swapped.average": 200, + "vm-71_mem.usage.average": 200, + "vm-71_net.bytesRx.average": 200, + "vm-71_net.bytesTx.average": 200, + "vm-71_net.droppedRx.summation": 200, + "vm-71_net.droppedTx.summation": 200, + "vm-71_net.packetsRx.summation": 200, + "vm-71_net.packetsTx.summation": 200, + "vm-71_overall.status.gray": 0, + "vm-71_overall.status.green": 1, + "vm-71_overall.status.red": 0, + "vm-71_overall.status.yellow": 0, + "vm-71_sys.uptime.latest": 200, } mx := collr.Collect(context.Background()) @@ -351,10 +351,10 @@ func TestCollector_Collect_RemoveHostsVMsInRuntime(t *testing.T) { require.NoError(t, collr.Init(context.Background())) require.NoError(t, collr.Check(context.Background())) - okHostID := "host-58" - okVMID := "vm-63" - collr.discoverer.(*discover.Discoverer).HostMatcher = mockHostMatcher{okHostID} - collr.discoverer.(*discover.Discoverer).VMMatcher = mockVMMatcher{okVMID} + okHostId := "host-57" + okVmId := "vm-62" + collr.discoverer.(*discover.Discoverer).HostMatcher = mockHostMatcher{okHostId} + collr.discoverer.(*discover.Discoverer).VMMatcher = mockVMMatcher{okVmId} require.NoError(t, collr.discoverOnce()) @@ -363,7 +363,7 @@ func TestCollector_Collect_RemoveHostsVMsInRuntime(t *testing.T) { collr.Collect(context.Background()) } - host := collr.resources.Hosts.Get(okHostID) + host := collr.resources.Hosts.Get(okHostId) for k, v := range collr.discoveredHosts { if k == host.ID { assert.Equal(t, 0, v) @@ -372,7 +372,7 @@ func TestCollector_Collect_RemoveHostsVMsInRuntime(t *testing.T) { } } - vm := collr.resources.VMs.Get(okVMID) + vm := collr.resources.VMs.Get(okVmId) for id, fails := range collr.discoveredVMs { if id == vm.ID { assert.Equal(t, 0, fails) @@ -391,7 +391,7 @@ func TestCollector_Collect_RemoveHostsVMsInRuntime(t *testing.T) { assert.Len(t, collr.charted, 2) for _, c := range *collr.Charts() { - if strings.HasPrefix(c.ID, okHostID) || strings.HasPrefix(c.ID, okVMID) { + if strings.HasPrefix(c.ID, okHostId) || strings.HasPrefix(c.ID, okVmId) { assert.False(t, c.Obsolete) } else { assert.True(t, c.Obsolete)