Skip to content

Commit

Permalink
Fix division by zero on diskio metricset (#9125)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano authored Nov 16, 2018
1 parent 42bb81d commit c791a59
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 @@ -23,6 +23,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d

*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 c791a59

Please sign in to comment.