mirror of
https://github.com/prometheus-community/windows_exporter
synced 2025-01-09 15:59:38 +00:00
collector: fix wrong perfdata instances (#1763)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
parent
26d6dddf25
commit
4c0574536f
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
})
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user