*: avoid using default wmi client. (#1590)

This commit is contained in:
Jan-Otto Kröpke
2024-08-30 00:26:15 +02:00
committed by GitHub
parent 3ce25ff1ef
commit 4f6e6e8b77
74 changed files with 558 additions and 655 deletions

View File

@@ -1,9 +1,7 @@
package mscluster
import (
"github.com/go-kit/log"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/wmi"
"github.com/prometheus/client_golang/prometheus"
)
@@ -56,11 +54,10 @@ func (c *Collector) buildNetwork() {
// Collect sends the metric values for each metric
// to the provided prometheus metric channel.
func (c *Collector) collectNetwork(logger log.Logger, ch chan<- prometheus.Metric) error {
func (c *Collector) collectNetwork(ch chan<- prometheus.Metric) error {
var dst []msClusterNetwork
q := wmi.QueryAllForClass(&dst, "MSCluster_Network", logger)
if err := wmi.QueryNamespace(q, &dst, "root/MSCluster"); err != nil {
if err := c.wmiClient.Query("SELECT * FROM MSCluster_Network", &dst, nil, "root/MSCluster"); err != nil {
return err
}