mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-04 17:46:36 +00:00
Updated naming convention, fixed metric type
Signed-off-by: sixfears7 <57415489+6fears7@users.noreply.github.com> Signed-off-by: pgibbs1 <pgibbs1@liberty.edu>
This commit is contained in:
@@ -149,20 +149,20 @@ func (c *DiskDriveInfoCollector) collect(ch chan<- prometheus.Metric) (*promethe
|
|||||||
return nil, errors.New("WMI query returned empty result set")
|
return nil, errors.New("WMI query returned empty result set")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, processor := range dst {
|
for _, disk := range dst {
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.DiskInfo,
|
c.DiskInfo,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
1.0,
|
1.0,
|
||||||
strings.Trim(processor.DeviceID, "\\.\\"),
|
strings.Trim(disk.DeviceID, "\\.\\"),
|
||||||
strings.TrimRight(processor.Model, " "),
|
strings.TrimRight(disk.Model, " "),
|
||||||
strings.TrimRight(processor.Caption, " "),
|
strings.TrimRight(disk.Caption, " "),
|
||||||
strings.TrimRight(processor.Name, "\\.\\"),
|
strings.TrimRight(disk.Name, "\\.\\"),
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, status := range allDiskStatus {
|
for _, status := range allDiskStatus {
|
||||||
isCurrentState := 0.0
|
isCurrentState := 0.0
|
||||||
if status == processor.Status {
|
if status == disk.Status {
|
||||||
isCurrentState = 1.0
|
isCurrentState = 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,35 +170,35 @@ func (c *DiskDriveInfoCollector) collect(ch chan<- prometheus.Metric) (*promethe
|
|||||||
c.Status,
|
c.Status,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
isCurrentState,
|
isCurrentState,
|
||||||
strings.Trim(processor.Name, "\\.\\"),
|
strings.Trim(disk.Name, "\\.\\"),
|
||||||
status,
|
status,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.Size,
|
c.Size,
|
||||||
prometheus.CounterValue,
|
prometheus.GaugeValue,
|
||||||
float64(processor.Size),
|
float64(disk.Size),
|
||||||
strings.Trim(processor.Name, "\\.\\"),
|
strings.Trim(disk.Name, "\\.\\"),
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.Partitions,
|
c.Partitions,
|
||||||
prometheus.CounterValue,
|
prometheus.GaugeValue,
|
||||||
float64(processor.Partitions),
|
float64(disk.Partitions),
|
||||||
strings.Trim(processor.Name, "\\.\\"),
|
strings.Trim(disk.Name, "\\.\\"),
|
||||||
)
|
)
|
||||||
|
|
||||||
for availNum, val := range availMap {
|
for availNum, val := range availMap {
|
||||||
isCurrentState := 0.0
|
isCurrentState := 0.0
|
||||||
if availNum == int(processor.Availability) {
|
if availNum == int(disk.Availability) {
|
||||||
isCurrentState = 1.0
|
isCurrentState = 1.0
|
||||||
}
|
}
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.Availability,
|
c.Availability,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
isCurrentState,
|
isCurrentState,
|
||||||
strings.Trim(processor.Name, "\\.\\"),
|
strings.Trim(disk.Name, "\\.\\"),
|
||||||
val,
|
val,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user