mirror of
https://github.com/prometheus-community/windows_exporter
synced 2025-02-18 13:07:02 +00:00
Add logical_disk latency metrics
This commit is contained in:
parent
cd9a740e2b
commit
853d615673
@ -40,6 +40,9 @@ type LogicalDiskCollector struct {
|
|||||||
FreeSpace *prometheus.Desc
|
FreeSpace *prometheus.Desc
|
||||||
IdleTime *prometheus.Desc
|
IdleTime *prometheus.Desc
|
||||||
SplitIOs *prometheus.Desc
|
SplitIOs *prometheus.Desc
|
||||||
|
ReadLatency *prometheus.Desc
|
||||||
|
WriteLatency *prometheus.Desc
|
||||||
|
ReadWriteLatency *prometheus.Desc
|
||||||
|
|
||||||
volumeWhitelistPattern *regexp.Regexp
|
volumeWhitelistPattern *regexp.Regexp
|
||||||
volumeBlacklistPattern *regexp.Regexp
|
volumeBlacklistPattern *regexp.Regexp
|
||||||
@ -127,6 +130,27 @@ func NewLogicalDiskCollector() (Collector, error) {
|
|||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
ReadLatency: prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(Namespace, subsystem, "read_latency_seconds_total"),
|
||||||
|
"Shows the average time, in seconds, of a read operation from the disk (LogicalDisk.AvgDiskSecPerRead)",
|
||||||
|
[]string{"volume"},
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
|
||||||
|
WriteLatency: prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(Namespace, subsystem, "write_latency_seconds_total"),
|
||||||
|
"Shows the average time, in seconds, of a write operation to the disk (LogicalDisk.AvgDiskSecPerWrite)",
|
||||||
|
[]string{"volume"},
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
|
||||||
|
ReadWriteLatency: prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(Namespace, subsystem, "read_write_latency_seconds_total"),
|
||||||
|
"Shows the time, in seconds, of the average disk transfer (LogicalDisk.AvgDiskSecPerTransfer)",
|
||||||
|
[]string{"volume"},
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
|
||||||
volumeWhitelistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *volumeWhitelist)),
|
volumeWhitelistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *volumeWhitelist)),
|
||||||
volumeBlacklistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *volumeBlacklist)),
|
volumeBlacklistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *volumeBlacklist)),
|
||||||
}, nil
|
}, nil
|
||||||
@ -158,6 +182,9 @@ type Win32_PerfRawData_PerfDisk_LogicalDisk struct {
|
|||||||
PercentFreeSpace_Base uint32
|
PercentFreeSpace_Base uint32
|
||||||
PercentIdleTime uint64
|
PercentIdleTime uint64
|
||||||
SplitIOPerSec uint32
|
SplitIOPerSec uint32
|
||||||
|
AvgDiskSecPerRead uint64
|
||||||
|
AvgDiskSecPerWrite uint64
|
||||||
|
AvgDiskSecPerTransfer uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *LogicalDiskCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
func (c *LogicalDiskCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
||||||
@ -250,6 +277,27 @@ func (c *LogicalDiskCollector) collect(ch chan<- prometheus.Metric) (*prometheus
|
|||||||
float64(volume.SplitIOPerSec),
|
float64(volume.SplitIOPerSec),
|
||||||
volume.Name,
|
volume.Name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.ReadLatency,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
float64(volume.AvgDiskSecPerRead),
|
||||||
|
volume.Name,
|
||||||
|
)
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.WriteLatency,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
float64(volume.AvgDiskSecPerWrite),
|
||||||
|
volume.Name,
|
||||||
|
)
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.ReadWriteLatency,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
float64(volume.AvgDiskSecPerTransfer),
|
||||||
|
volume.Name,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user