Refactor wmi query generator to use wildcard selector

This commit is contained in:
Calle Pettersson
2018-06-06 10:31:50 +02:00
parent f3072bb4f3
commit 667d06116d
27 changed files with 208 additions and 78 deletions

View File

@@ -657,7 +657,7 @@ type Win32_PerfRawData_VmmsVirtualMachineStats_HyperVVirtualMachineHealthSummary
func (c *HyperVCollector) collectVmHealth(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_VmmsVirtualMachineStats_HyperVVirtualMachineHealthSummary
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}
@@ -689,7 +689,7 @@ type Win32_PerfRawData_VidPerfProvider_HyperVVMVidPartition struct {
func (c *HyperVCollector) collectVmVid(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_VidPerfProvider_HyperVVMVidPartition
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}
@@ -752,7 +752,7 @@ type Win32_PerfRawData_HvStats_HyperVHypervisorRootPartition struct {
func (c *HyperVCollector) collectVmHv(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_HvStats_HyperVHypervisorRootPartition
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}
@@ -889,7 +889,7 @@ type Win32_PerfRawData_HvStats_HyperVHypervisor struct {
func (c *HyperVCollector) collectVmProcessor(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_HvStats_HyperVHypervisor
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}
@@ -923,7 +923,7 @@ type Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor struct {
func (c *HyperVCollector) collectHostCpuUsage(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}
@@ -983,7 +983,7 @@ type Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor struct {
func (c *HyperVCollector) collectVmCpuUsage(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}
@@ -1060,7 +1060,7 @@ type Win32_PerfRawData_NvspSwitchStats_HyperVVirtualSwitch struct {
func (c *HyperVCollector) collectVmSwitch(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_NvspSwitchStats_HyperVVirtualSwitch
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}
@@ -1218,7 +1218,7 @@ type Win32_PerfRawData_EthernetPerfProvider_HyperVLegacyNetworkAdapter struct {
func (c *HyperVCollector) collectVmEthernet(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_EthernetPerfProvider_HyperVLegacyNetworkAdapter
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}
@@ -1287,7 +1287,7 @@ type Win32_PerfRawData_Counters_HyperVVirtualStorageDevice struct {
func (c *HyperVCollector) collectVmStorage(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_Counters_HyperVVirtualStorageDevice
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}
@@ -1355,7 +1355,7 @@ type Win32_PerfRawData_NvspNicStats_HyperVVirtualNetworkAdapter struct {
func (c *HyperVCollector) collectVmNetwork(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
var dst []Win32_PerfRawData_NvspNicStats_HyperVVirtualNetworkAdapter
if err := wmi.Query(wmi.CreateQuery(&dst, ""), &dst); err != nil {
if err := wmi.Query(queryAll(&dst), &dst); err != nil {
return nil, err
}