mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-28 07:36:37 +00:00
Fixed blackslashes, replaced model with name
Signed-off-by: pgibbs1 <pgibbs1@liberty.edu>
This commit is contained in:
@@ -17,7 +17,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
win32DiskQuery = "SELECT DeviceID, Model, Caption, Partitions, Size, Status, Availability FROM WIN32_DiskDrive"
|
win32DiskQuery = "SELECT DeviceID, Model, Caption, Name, Partitions, Size, Status, Availability FROM WIN32_DiskDrive"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A DiskDriveInfoCollector is a Prometheus collector for a few WMI metrics in Win32_DiskDrive
|
// A DiskDriveInfoCollector is a Prometheus collector for a few WMI metrics in Win32_DiskDrive
|
||||||
@@ -40,6 +40,7 @@ func newDiskDriveInfoCollector() (Collector, error) {
|
|||||||
"device_id",
|
"device_id",
|
||||||
"model",
|
"model",
|
||||||
"caption",
|
"caption",
|
||||||
|
"name",
|
||||||
},
|
},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
@@ -80,6 +81,7 @@ type Win32_DiskDrive struct {
|
|||||||
DeviceID string
|
DeviceID string
|
||||||
Model string
|
Model string
|
||||||
Size uint64
|
Size uint64
|
||||||
|
Name string
|
||||||
Caption string
|
Caption string
|
||||||
Partitions uint32
|
Partitions uint32
|
||||||
Status string
|
Status string
|
||||||
@@ -152,9 +154,10 @@ func (c *DiskDriveInfoCollector) collect(ch chan<- prometheus.Metric) (*promethe
|
|||||||
c.DiskInfo,
|
c.DiskInfo,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
1.0,
|
1.0,
|
||||||
strings.TrimRight(processor.DeviceID, " "),
|
strings.Trim(processor.DeviceID, "\\.\\"),
|
||||||
strings.TrimRight(processor.Model, " "),
|
strings.TrimRight(processor.Model, " "),
|
||||||
strings.TrimRight(processor.Caption, " "),
|
strings.TrimRight(processor.Caption, " "),
|
||||||
|
strings.TrimRight(processor.Name, "\\.\\"),
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, status := range allDiskStatus {
|
for _, status := range allDiskStatus {
|
||||||
@@ -167,7 +170,7 @@ func (c *DiskDriveInfoCollector) collect(ch chan<- prometheus.Metric) (*promethe
|
|||||||
c.Status,
|
c.Status,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
isCurrentState,
|
isCurrentState,
|
||||||
strings.TrimRight(processor.Model, " "),
|
strings.Trim(processor.Name, "\\.\\"),
|
||||||
status,
|
status,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -193,7 +196,7 @@ func (c *DiskDriveInfoCollector) collect(ch chan<- prometheus.Metric) (*promethe
|
|||||||
c.Availability,
|
c.Availability,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
isCurrentState,
|
isCurrentState,
|
||||||
strings.TrimRight(processor.Model, " "),
|
strings.Trim(processor.Name, "\\.\\"),
|
||||||
val,
|
val,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user