Skip to content

Commit

Permalink
Cherry-pick #9125 to 6.5: Fix division by zero on diskio metricset (#…
Browse files Browse the repository at this point in the history
…9137)

(cherry picked from commit c791a59)
  • Loading branch information
jsoriano authored Nov 22, 2018
1 parent 8eec851 commit fd3a205
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
8 changes: 6 additions & 2 deletions metricbeat/module/system/diskio/diskstat_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit fd3a205

Please sign in to comment.