diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index eb5122ff6d1..bb1c9a65c75 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -45,6 +45,8 @@ https://github.com/elastic/beats/compare/v6.5.1...6.5[Check the HEAD diff] *Metricbeat* +- Fix issue preventing diskio metrics collection for idle disks. {issue}9124[9124] {pull}9125[9125] + *Packetbeat* *Winlogbeat* diff --git a/metricbeat/module/system/diskio/diskstat_linux.go b/metricbeat/module/system/diskio/diskstat_linux.go index 1647adabc23..357c001b705 100644 --- a/metricbeat/module/system/diskio/diskstat_linux.go +++ b/metricbeat/module/system/diskio/diskstat_linux.go @@ -98,8 +98,12 @@ func (stat *DiskIOStat) CalIOStatistics(counter disk.IOCountersStat) (DiskIOMetr result.AvgRequestSize = size result.AvgQueueSize = queue result.AvgAwaitTime = wait - result.AvgReadAwaitTime = float64(rd_ticks) / float64(rd_ios) - result.AvgWriteAwaitTime = float64(wr_ticks) / float64(wr_ios) + if rd_ios > 0 { + result.AvgReadAwaitTime = float64(rd_ticks) / float64(rd_ios) + } + if wr_ios > 0 { + result.AvgWriteAwaitTime = float64(wr_ticks) / float64(wr_ios) + } result.AvgServiceTime = svct result.BusyPct = 100.0 * float64(ticks) / deltams if result.BusyPct > 100.0 {