mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-10 15:06:36 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0333ee256 | ||
|
|
c9fc76de4c | ||
|
|
3752a547d5 | ||
|
|
0ab6c191be | ||
|
|
467e83722a | ||
|
|
7fe8ca8554 |
@@ -463,37 +463,37 @@ func NewHyperVCollector() (Collector, error) {
|
|||||||
AdapterBytesDropped: prometheus.NewDesc(
|
AdapterBytesDropped: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_dropped"),
|
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_dropped"),
|
||||||
"Bytes Dropped is the number of bytes dropped on the network adapter",
|
"Bytes Dropped is the number of bytes dropped on the network adapter",
|
||||||
nil,
|
[]string{"adapter"},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
AdapterBytesReceived: prometheus.NewDesc(
|
AdapterBytesReceived: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_received"),
|
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_received"),
|
||||||
"Bytes received is the number of bytes received on the network adapter",
|
"Bytes received is the number of bytes received on the network adapter",
|
||||||
nil,
|
[]string{"adapter"},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
AdapterBytesSent: prometheus.NewDesc(
|
AdapterBytesSent: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_sent"),
|
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_sent"),
|
||||||
"Bytes sent is the number of bytes sent over the network adapter",
|
"Bytes sent is the number of bytes sent over the network adapter",
|
||||||
nil,
|
[]string{"adapter"},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
AdapterFramesDropped: prometheus.NewDesc(
|
AdapterFramesDropped: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_dropped"),
|
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_dropped"),
|
||||||
"Frames Dropped is the number of frames dropped on the network adapter",
|
"Frames Dropped is the number of frames dropped on the network adapter",
|
||||||
nil,
|
[]string{"adapter"},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
AdapterFramesReceived: prometheus.NewDesc(
|
AdapterFramesReceived: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_received"),
|
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_received"),
|
||||||
"Frames received is the number of frames received on the network adapter",
|
"Frames received is the number of frames received on the network adapter",
|
||||||
nil,
|
[]string{"adapter"},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
AdapterFramesSent: prometheus.NewDesc(
|
AdapterFramesSent: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_sent"),
|
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_sent"),
|
||||||
"Frames sent is the number of frames sent over the network adapter",
|
"Frames sent is the number of frames sent over the network adapter",
|
||||||
nil,
|
[]string{"adapter"},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@@ -30,37 +30,37 @@ func NewSystemCollector() (Collector, error) {
|
|||||||
return &SystemCollector{
|
return &SystemCollector{
|
||||||
ContextSwitchesTotal: prometheus.NewDesc(
|
ContextSwitchesTotal: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "context_switches_total"),
|
prometheus.BuildFQName(Namespace, subsystem, "context_switches_total"),
|
||||||
"PerfOS_System.ContextSwitchesPersec",
|
"Total number of context switches (WMI source: PerfOS_System.ContextSwitchesPersec)",
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
ExceptionDispatchesTotal: prometheus.NewDesc(
|
ExceptionDispatchesTotal: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "exception_dispatches_total"),
|
prometheus.BuildFQName(Namespace, subsystem, "exception_dispatches_total"),
|
||||||
"PerfOS_System.ExceptionDispatchesPersec",
|
"Total number of exceptions dispatched (WMI source: PerfOS_System.ExceptionDispatchesPersec)",
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
ProcessorQueueLength: prometheus.NewDesc(
|
ProcessorQueueLength: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "processor_queue_length"),
|
prometheus.BuildFQName(Namespace, subsystem, "processor_queue_length"),
|
||||||
"PerfOS_System.ProcessorQueueLength",
|
"Length of processor queue (WMI source: PerfOS_System.ProcessorQueueLength)",
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
SystemCallsTotal: prometheus.NewDesc(
|
SystemCallsTotal: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "system_calls_total"),
|
prometheus.BuildFQName(Namespace, subsystem, "system_calls_total"),
|
||||||
"PerfOS_System.SystemCallsPersec",
|
"Total number of system calls (WMI source: PerfOS_System.SystemCallsPersec)",
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
SystemUpTime: prometheus.NewDesc(
|
SystemUpTime: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "system_up_time"),
|
prometheus.BuildFQName(Namespace, subsystem, "system_up_time"),
|
||||||
"SystemUpTime/Frequency_Object",
|
"System boot time (WMI source: PerfOS_System.SystemUpTime)",
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
Threads: prometheus.NewDesc(
|
Threads: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "threads"),
|
prometheus.BuildFQName(Namespace, subsystem, "threads"),
|
||||||
"PerfOS_System.Threads",
|
"Current number of threads (WMI source: PerfOS_System.Threads)",
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
@@ -96,12 +96,12 @@ func (c *SystemCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc
|
|||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.ContextSwitchesTotal,
|
c.ContextSwitchesTotal,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].ContextSwitchesPersec),
|
float64(dst[0].ContextSwitchesPersec),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.ExceptionDispatchesTotal,
|
c.ExceptionDispatchesTotal,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].ExceptionDispatchesPersec),
|
float64(dst[0].ExceptionDispatchesPersec),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
@@ -111,7 +111,7 @@ func (c *SystemCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc
|
|||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.SystemCallsTotal,
|
c.SystemCallsTotal,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].SystemCallsPersec),
|
float64(dst[0].SystemCallsPersec),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|||||||
16
exporter.go
16
exporter.go
@@ -44,6 +44,16 @@ var (
|
|||||||
[]string{"collector"},
|
[]string{"collector"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// This can be removed when client_golang exposes this on Windows
|
||||||
|
// (See https://github.com/prometheus/client_golang/issues/376)
|
||||||
|
startTime = float64(time.Now().Unix())
|
||||||
|
startTimeDesc = prometheus.NewDesc(
|
||||||
|
"process_start_time_seconds",
|
||||||
|
"Start time of the process since unix epoch in seconds.",
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Describe sends all the descriptors of the collectors included to
|
// Describe sends all the descriptors of the collectors included to
|
||||||
@@ -65,6 +75,12 @@ func (coll WmiCollector) Collect(ch chan<- prometheus.Metric) {
|
|||||||
wg.Done()
|
wg.Done()
|
||||||
}(name, c)
|
}(name, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
startTimeDesc,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
startTime,
|
||||||
|
)
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user