collector: fix wrong perfdata instances (#1763)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke 2024-11-24 01:52:25 +01:00 committed by GitHub
parent 26d6dddf25
commit 4c0574536f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 11 deletions

View File

@ -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)
}

View File

@ -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(

View File

@ -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"

View File

@ -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,
})

View File

@ -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,

View File

@ -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