Skip to content

Commit

Permalink
Fix filesystem used percentage (#6231)
Browse files Browse the repository at this point in the history
The used percentage reported by Metricbeat does not match what is reported by `df`. Metricbeat's computation of the `system.filesystem.used.pct` value was based on the total number of bytes, but df uses the total number of bytes available to the unprivileged user.

| FS       | Blocks      | Used        | Available  | Use % | Mount | Metricbeat Used % After This Change | Before This Change |
|----------|-------------|-------------|------------|-------|-------|-------------------------------------|--------------------|
| /dev/vda | 21137846272 | 16992858112 | 3071246336 | 85    | /     | 0.846928312                         | 0.8039067885       |

Fixes #5494
  • Loading branch information
andrewkroh authored and ruflin committed Feb 3, 2018
1 parent c0966df commit e605495
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di
- Change kubernetes.node.cpu.allocatable.cores to float. {pull}6130[6130]
- Fix system process metricset for kernel processes. {issue}5700[5700]
- Fix panic in http dependent modules when invalid config was used.
- Fix system.filesystem.used.pct value to match what df reports. {issue}5494[5494]

*Packetbeat*

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/system/filesystem/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func AddFileSystemUsedPercentage(f *FileSystemStat) {
return
}

perc := float64(f.Used) / float64(f.Total)
perc := float64(f.Used) / float64(f.Used+f.Avail)
f.UsedPercent = common.Round(perc, common.DefaultDecimalPlacesCount)
}

Expand Down

0 comments on commit e605495

Please sign in to comment.