mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-05 10:06:35 +00:00
adfs: Implement PDH collector (#1656)
This commit is contained in:
@@ -4,13 +4,13 @@ package tcp
|
||||
// - https://msdn.microsoft.com/en-us/library/aa394341(v=vs.85).aspx
|
||||
// The TCPv6 performance object uses the same fields.
|
||||
const (
|
||||
ConnectionFailures = "Connection Failures"
|
||||
ConnectionsActive = "Connections Active"
|
||||
ConnectionsEstablished = "Connections Established"
|
||||
ConnectionsPassive = "Connections Passive"
|
||||
ConnectionsReset = "Connections Reset"
|
||||
SegmentsPersec = "Segments/sec"
|
||||
SegmentsReceivedPersec = "Segments Received/sec"
|
||||
SegmentsRetransmittedPersec = "Segments Retransmitted/sec"
|
||||
SegmentsSentPersec = "Segments Sent/sec"
|
||||
connectionFailures = "Connection Failures"
|
||||
connectionsActive = "Connections Active"
|
||||
connectionsEstablished = "Connections Established"
|
||||
connectionsPassive = "Connections Passive"
|
||||
connectionsReset = "Connections Reset"
|
||||
segmentsPerSec = "Segments/sec"
|
||||
segmentsReceivedPerSec = "Segments Received/sec"
|
||||
segmentsRetransmittedPerSec = "Segments Retransmitted/sec"
|
||||
segmentsSentPerSec = "Segments Sent/sec"
|
||||
)
|
||||
|
||||
@@ -67,15 +67,15 @@ func (c *Collector) Close(_ *slog.Logger) error {
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||
counters := []string{
|
||||
ConnectionFailures,
|
||||
ConnectionsActive,
|
||||
ConnectionsEstablished,
|
||||
ConnectionsPassive,
|
||||
ConnectionsReset,
|
||||
SegmentsPersec,
|
||||
SegmentsReceivedPersec,
|
||||
SegmentsRetransmittedPersec,
|
||||
SegmentsSentPersec,
|
||||
connectionFailures,
|
||||
connectionsActive,
|
||||
connectionsEstablished,
|
||||
connectionsPassive,
|
||||
connectionsReset,
|
||||
segmentsPerSec,
|
||||
segmentsReceivedPerSec,
|
||||
segmentsRetransmittedPerSec,
|
||||
segmentsSentPerSec,
|
||||
}
|
||||
|
||||
var err error
|
||||
@@ -167,55 +167,55 @@ func writeTCPCounters(metrics map[string]perfdata.CounterValues, labels []string
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionFailures,
|
||||
prometheus.CounterValue,
|
||||
metrics[ConnectionFailures].FirstValue,
|
||||
metrics[connectionFailures].FirstValue,
|
||||
labels...,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionsActive,
|
||||
prometheus.CounterValue,
|
||||
metrics[ConnectionsActive].FirstValue,
|
||||
metrics[connectionsActive].FirstValue,
|
||||
labels...,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionsEstablished,
|
||||
prometheus.GaugeValue,
|
||||
metrics[ConnectionsEstablished].FirstValue,
|
||||
metrics[connectionsEstablished].FirstValue,
|
||||
labels...,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionsPassive,
|
||||
prometheus.CounterValue,
|
||||
metrics[ConnectionsPassive].FirstValue,
|
||||
metrics[connectionsPassive].FirstValue,
|
||||
labels...,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.connectionsReset,
|
||||
prometheus.CounterValue,
|
||||
metrics[ConnectionsReset].FirstValue,
|
||||
metrics[connectionsReset].FirstValue,
|
||||
labels...,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.segmentsTotal,
|
||||
prometheus.CounterValue,
|
||||
metrics[SegmentsPersec].FirstValue,
|
||||
metrics[segmentsPerSec].FirstValue,
|
||||
labels...,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.segmentsReceivedTotal,
|
||||
prometheus.CounterValue,
|
||||
metrics[SegmentsReceivedPersec].FirstValue,
|
||||
metrics[segmentsReceivedPerSec].FirstValue,
|
||||
labels...,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.segmentsRetransmittedTotal,
|
||||
prometheus.CounterValue,
|
||||
metrics[SegmentsRetransmittedPersec].FirstValue,
|
||||
metrics[segmentsRetransmittedPerSec].FirstValue,
|
||||
labels...,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.segmentsSentTotal,
|
||||
prometheus.CounterValue,
|
||||
metrics[SegmentsSentPersec].FirstValue,
|
||||
metrics[segmentsSentPerSec].FirstValue,
|
||||
labels...,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user