diff --git a/collector/logical_disk.go b/collector/logical_disk.go index 36eba9bd..8dedf12e 100644 --- a/collector/logical_disk.go +++ b/collector/logical_disk.go @@ -30,6 +30,8 @@ var ( // A LogicalDiskCollector is a Prometheus collector for perflib logicalDisk metrics type LogicalDiskCollector struct { RequestsQueued *prometheus.Desc + AvgReadQueue *prometheus.Desc + AvgWriteQueue *prometheus.Desc ReadBytesTotal *prometheus.Desc ReadsTotal *prometheus.Desc WriteBytesTotal *prometheus.Desc @@ -60,6 +62,20 @@ func NewLogicalDiskCollector() (Collector, error) { nil, ), + AvgReadQueue: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "avg_read_requests_queued"), + "Average number of read requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskReadQueueLength)", + []string{"volume"}, + nil, + ), + + AvgWriteQueue: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "avg_write_requests_queued"), + "Average number of write requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskWriteQueueLength)", + []string{"volume"}, + nil, + ), + ReadBytesTotal: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "read_bytes_total"), "The number of bytes transferred from the disk during read operations (LogicalDisk.DiskReadBytesPerSec)", @@ -170,21 +186,23 @@ func (c *LogicalDiskCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus. // - https://msdn.microsoft.com/en-us/windows/hardware/aa394307(v=vs.71) - Win32_PerfRawData_PerfDisk_LogicalDisk class // - https://msdn.microsoft.com/en-us/library/ms803973.aspx - LogicalDisk object reference type logicalDisk struct { - Name string - CurrentDiskQueueLength float64 `perflib:"Current Disk Queue Length"` - DiskReadBytesPerSec float64 `perflib:"Disk Read Bytes/sec"` - DiskReadsPerSec float64 `perflib:"Disk Reads/sec"` - DiskWriteBytesPerSec float64 `perflib:"Disk Write Bytes/sec"` - DiskWritesPerSec float64 `perflib:"Disk Writes/sec"` - PercentDiskReadTime float64 `perflib:"% Disk Read Time"` - PercentDiskWriteTime float64 `perflib:"% Disk Write Time"` - PercentFreeSpace float64 `perflib:"% Free Space_Base"` - PercentFreeSpace_Base float64 `perflib:"Free Megabytes"` - PercentIdleTime float64 `perflib:"% Idle Time"` - SplitIOPerSec float64 `perflib:"Split IO/Sec"` - AvgDiskSecPerRead float64 `perflib:"Avg. Disk sec/Read"` - AvgDiskSecPerWrite float64 `perflib:"Avg. Disk sec/Write"` - AvgDiskSecPerTransfer float64 `perflib:"Avg. Disk sec/Transfer"` + Name string + CurrentDiskQueueLength float64 `perflib:"Current Disk Queue Length"` + AvgDiskReadQueueLength float64 `perflib:"Avg. Disk Read Queue Length"` + AvgDiskWriteQueueLength float64 `perflib:"Avg. Disk Write Queue Length"` + DiskReadBytesPerSec float64 `perflib:"Disk Read Bytes/sec"` + DiskReadsPerSec float64 `perflib:"Disk Reads/sec"` + DiskWriteBytesPerSec float64 `perflib:"Disk Write Bytes/sec"` + DiskWritesPerSec float64 `perflib:"Disk Writes/sec"` + PercentDiskReadTime float64 `perflib:"% Disk Read Time"` + PercentDiskWriteTime float64 `perflib:"% Disk Write Time"` + PercentFreeSpace float64 `perflib:"% Free Space_Base"` + PercentFreeSpace_Base float64 `perflib:"Free Megabytes"` + PercentIdleTime float64 `perflib:"% Idle Time"` + SplitIOPerSec float64 `perflib:"Split IO/Sec"` + AvgDiskSecPerRead float64 `perflib:"Avg. Disk sec/Read"` + AvgDiskSecPerWrite float64 `perflib:"Avg. Disk sec/Write"` + AvgDiskSecPerTransfer float64 `perflib:"Avg. Disk sec/Transfer"` } func (c *LogicalDiskCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) { @@ -207,6 +225,20 @@ func (c *LogicalDiskCollector) collect(ctx *ScrapeContext, ch chan<- prometheus. volume.Name, ) + ch <- prometheus.MustNewConstMetric( + c.AvgReadQueue, + prometheus.GaugeValue, + volume.AvgDiskReadQueueLength*ticksToSecondsScaleFactor, + volume.Name, + ) + + ch <- prometheus.MustNewConstMetric( + c.AvgWriteQueue, + prometheus.GaugeValue, + volume.AvgDiskWriteQueueLength*ticksToSecondsScaleFactor, + volume.Name, + ) + ch <- prometheus.MustNewConstMetric( c.ReadBytesTotal, prometheus.CounterValue, diff --git a/docs/collector.logical_disk.md b/docs/collector.logical_disk.md index 479ee2b2..1dfcecc2 100644 --- a/docs/collector.logical_disk.md +++ b/docs/collector.logical_disk.md @@ -24,6 +24,8 @@ If given, a disk needs to *not* match the blacklist regexp in order for the corr Name | Description | Type | Labels -----|-------------|------|------- `requests_queued` | Number of requests outstanding on the disk at the time the performance data is collected | gauge | `volume` +`avg_read_requests_queued` | Average number of read requests that were queued for the selected disk during the sample interval | gauge | `volume` +`avg_write_requests_queued` | Average number of write requests that were queued for the selected disk during the sample interval | gauge | `volume` `read_bytes_total` | Rate at which bytes are transferred from the disk during read operations | counter | `volume` `reads_total` | Rate of read operations on the disk | counter | `volume` `write_bytes_total` | Rate at which bytes are transferred to the disk during write operations | counter | `volume` diff --git a/tools/e2e-output.txt b/tools/e2e-output.txt index 2c30b4cb..5c15503c 100644 --- a/tools/e2e-output.txt +++ b/tools/e2e-output.txt @@ -141,6 +141,10 @@ windows_exporter_collector_timeout{collector="textfile"} 0 # TYPE windows_logical_disk_reads_total counter # HELP windows_logical_disk_requests_queued The number of requests queued to the disk (LogicalDisk.CurrentDiskQueueLength) # TYPE windows_logical_disk_requests_queued gauge +# HELP windows_logical_disk_avg_read_requests_queued Average number of read requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskReadQueueLength) +# TYPE windows_logical_disk_avg_read_requests_queued gauge +# HELP windows_logical_disk_avg_write_requests_queued Average number of write requests that were queued for the selected disk during the sample interval (LogicalDisk.AvgDiskWriteQueueLength) +# TYPE windows_logical_disk_avg_write_requests_queued gauge # HELP windows_logical_disk_size_bytes Total space in bytes, updates every 10-15 min (LogicalDisk.PercentFreeSpace_Base) # TYPE windows_logical_disk_size_bytes gauge # HELP windows_logical_disk_split_ios_total The number of I/Os to the disk were split into multiple I/Os (LogicalDisk.SplitIOPerSec)