Compare commits

..

6 Commits

Author SHA1 Message Date
Calle Pettersson
a0333ee256 Merge pull request #195 from martinlindhe/totals-as-gauges-help-string
Fix wrong metric types in system collector, improve help-strings
2018-04-30 09:29:00 +02:00
Calle Pettersson
c9fc76de4c Merge pull request #194 from martinlindhe/exporter-start-time
Add process_start_time_seconds for the exporter itself
2018-04-30 09:28:43 +02:00
Calle Pettersson
3752a547d5 Merge pull request #193 from martinlindhe/hyperv-network-labels
Fix missing label on HyperVLegacyNetworkAdapter
2018-04-30 09:28:30 +02:00
Calle Pettersson
0ab6c191be Fix wrong metric types in system collector, improve help-strings 2018-04-29 17:14:53 +02:00
Calle Pettersson
467e83722a Add process_start_time_seconds for the exporter itself 2018-04-29 16:53:34 +02:00
Calle Pettersson
7fe8ca8554 Fix missing label on HyperVLegacyNetworkAdapter 2018-04-29 16:09:18 +02:00
3 changed files with 31 additions and 15 deletions

View File

@@ -463,37 +463,37 @@ func NewHyperVCollector() (Collector, error) {
AdapterBytesDropped: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_dropped"),
"Bytes Dropped is the number of bytes dropped on the network adapter",
nil,
[]string{"adapter"},
nil,
),
AdapterBytesReceived: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_received"),
"Bytes received is the number of bytes received on the network adapter",
nil,
[]string{"adapter"},
nil,
),
AdapterBytesSent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_sent"),
"Bytes sent is the number of bytes sent over the network adapter",
nil,
[]string{"adapter"},
nil,
),
AdapterFramesDropped: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_dropped"),
"Frames Dropped is the number of frames dropped on the network adapter",
nil,
[]string{"adapter"},
nil,
),
AdapterFramesReceived: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_received"),
"Frames received is the number of frames received on the network adapter",
nil,
[]string{"adapter"},
nil,
),
AdapterFramesSent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_sent"),
"Frames sent is the number of frames sent over the network adapter",
nil,
[]string{"adapter"},
nil,
),
}, nil

View File

@@ -30,37 +30,37 @@ func NewSystemCollector() (Collector, error) {
return &SystemCollector{
ContextSwitchesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "context_switches_total"),
"PerfOS_System.ContextSwitchesPersec",
"Total number of context switches (WMI source: PerfOS_System.ContextSwitchesPersec)",
nil,
nil,
),
ExceptionDispatchesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "exception_dispatches_total"),
"PerfOS_System.ExceptionDispatchesPersec",
"Total number of exceptions dispatched (WMI source: PerfOS_System.ExceptionDispatchesPersec)",
nil,
nil,
),
ProcessorQueueLength: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "processor_queue_length"),
"PerfOS_System.ProcessorQueueLength",
"Length of processor queue (WMI source: PerfOS_System.ProcessorQueueLength)",
nil,
nil,
),
SystemCallsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "system_calls_total"),
"PerfOS_System.SystemCallsPersec",
"Total number of system calls (WMI source: PerfOS_System.SystemCallsPersec)",
nil,
nil,
),
SystemUpTime: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "system_up_time"),
"SystemUpTime/Frequency_Object",
"System boot time (WMI source: PerfOS_System.SystemUpTime)",
nil,
nil,
),
Threads: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "threads"),
"PerfOS_System.Threads",
"Current number of threads (WMI source: PerfOS_System.Threads)",
nil,
nil,
),
@@ -96,12 +96,12 @@ func (c *SystemCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc
ch <- prometheus.MustNewConstMetric(
c.ContextSwitchesTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(dst[0].ContextSwitchesPersec),
)
ch <- prometheus.MustNewConstMetric(
c.ExceptionDispatchesTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(dst[0].ExceptionDispatchesPersec),
)
ch <- prometheus.MustNewConstMetric(
@@ -111,7 +111,7 @@ func (c *SystemCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc
)
ch <- prometheus.MustNewConstMetric(
c.SystemCallsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(dst[0].SystemCallsPersec),
)
ch <- prometheus.MustNewConstMetric(

View File

@@ -44,6 +44,16 @@ var (
[]string{"collector"},
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
@@ -65,6 +75,12 @@ func (coll WmiCollector) Collect(ch chan<- prometheus.Metric) {
wg.Done()
}(name, c)
}
ch <- prometheus.MustNewConstMetric(
startTimeDesc,
prometheus.CounterValue,
startTime,
)
wg.Wait()
}