Skip to content

Commit

Permalink
collector: fix wrong perfdata instances (#1763)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke authored Nov 24, 2024
1 parent 26d6ddd commit 4c05745
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion internal/collector/adfs/adfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
8 changes: 4 additions & 4 deletions internal/collector/nps/nps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions internal/collector/remote_fx/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/smb/smb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/smbclient/smbclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4c05745

Please sign in to comment.