Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collector: fix wrong perfdata instances #1763

Merged
merged 1 commit into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading