From 4c0574536faa84b9237ac35e43fcb27e0b0ad619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 24 Nov 2024 01:52:25 +0100 Subject: [PATCH] collector: fix wrong perfdata instances (#1763) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- internal/collector/adfs/adfs.go | 2 +- internal/collector/nps/nps.go | 8 ++++---- internal/collector/remote_fx/const.go | 6 +++--- internal/collector/smb/smb.go | 2 +- internal/collector/smbclient/smbclient.go | 2 +- internal/collector/update/update.go | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/collector/adfs/adfs.go b/internal/collector/adfs/adfs.go index f6eb5d17..68993424 100644 --- a/internal/collector/adfs/adfs.go +++ b/internal/collector/adfs/adfs.go @@ -147,7 +147,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { avgConfigDBQueryTime, federationMetadataRequests, }) - if err != nil { + if err != nil && !errors.Is(err, perfdata.ErrNoData) { return fmt.Errorf("failed to create AD FS collector: %w", err) } diff --git a/internal/collector/nps/nps.go b/internal/collector/nps/nps.go index abd69fd8..81bbc24d 100644 --- a/internal/collector/nps/nps.go +++ b/internal/collector/nps/nps.go @@ -83,19 +83,19 @@ func (c *Collector) Build(_ *slog.Logger, miSession *mi.Session) error { return errors.New("miSession is nil") } - miQuery, err := mi.NewQuery("SELECT Name, AccessAccepts, AccessChallenges, AccessRejects, AccessRequests, AccessBadAuthenticators, AccessDroppedPackets, AccessInvalidRequests, AccessMalformedPackets, AccessPacketsReceived, AccessPacketsSent, AccessServerResetTime, AccessServerUpTime, AccessUnknownType FROM Win32_PerfRawData_IAS_NPSAuthenticationServer") + miQueryAuthenticationServer, err := mi.NewQuery("SELECT * FROM Win32_PerfRawData_IAS_NPSAuthenticationServer") if err != nil { return fmt.Errorf("failed to create WMI query: %w", err) } - c.miQueryAuthenticationServer = miQuery + c.miQueryAuthenticationServer = miQueryAuthenticationServer - miQuery, err = mi.NewQuery("SELECT Name, AccountingRequests, AccountingResponses, AccountingBadAuthenticators, AccountingDroppedPackets, AccountingInvalidRequests, AccountingMalformedPackets, AccountingNoRecord, AccountingPacketsReceived, AccountingPacketsSent, AccountingServerResetTime, AccountingServerUpTime, AccountingUnknownType FROM Win32_PerfRawData_IAS_NPSAccountingServer") + miQueryAccountingServer, err := mi.NewQuery("SELECT * FROM Win32_PerfRawData_IAS_NPSAccountingServer") if err != nil { return fmt.Errorf("failed to create WMI query: %w", err) } - c.miQueryAccountingServer = miQuery + c.miQueryAccountingServer = miQueryAccountingServer c.miSession = miSession c.accessAccepts = prometheus.NewDesc( diff --git a/internal/collector/remote_fx/const.go b/internal/collector/remote_fx/const.go index edafaf6d..02f36add 100644 --- a/internal/collector/remote_fx/const.go +++ b/internal/collector/remote_fx/const.go @@ -13,9 +13,9 @@ const ( TotalSentBytes = "Total Sent Bytes" UDPPacketsReceivedPersec = "UDP Packets Received/sec" UDPPacketsSentPersec = "UDP Packets Sent/sec" - FECRate = "Forward Error Correction (FEC) percentage" - LossRate = "Loss percentage" - RetransmissionRate = "Percentage of packets that have been retransmitted" + FECRate = "FEC rate" + LossRate = "Loss rate" + RetransmissionRate = "Retransmission rate" AverageEncodingTime = "Average Encoding Time" FrameQuality = "Frame Quality" diff --git a/internal/collector/smb/smb.go b/internal/collector/smb/smb.go index e931c353..3cb08578 100644 --- a/internal/collector/smb/smb.go +++ b/internal/collector/smb/smb.go @@ -58,7 +58,7 @@ func (c *Collector) Close() error { func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { var err error - c.perfDataCollector, err = perfdata.NewCollector("SMB Server Shares", nil, []string{ + c.perfDataCollector, err = perfdata.NewCollector("SMB Server Shares", perfdata.InstanceAll, []string{ currentOpenFileCount, treeConnectCount, }) diff --git a/internal/collector/smbclient/smbclient.go b/internal/collector/smbclient/smbclient.go index 1c8018db..cb69c52a 100644 --- a/internal/collector/smbclient/smbclient.go +++ b/internal/collector/smbclient/smbclient.go @@ -78,7 +78,7 @@ func (c *Collector) Close() error { func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error { var err error - c.perfDataCollector, err = perfdata.NewCollector("SMB Client Shares", nil, []string{ + c.perfDataCollector, err = perfdata.NewCollector("SMB Client Shares", perfdata.InstanceAll, []string{ AvgDataQueueLength, AvgReadQueueLength, AvgSecPerRead, diff --git a/internal/collector/update/update.go b/internal/collector/update/update.go index ab4d221d..f3653ffc 100644 --- a/internal/collector/update/update.go +++ b/internal/collector/update/update.go @@ -33,7 +33,7 @@ var ConfigDefaults = Config{ scrapeInterval: 6 * time.Hour, } -var ErrNoUpdates = errors.New("no updates available") +var ErrNoUpdates = errors.New("pending gather update metrics") type Collector struct { config Config