Skip to content

Commit

Permalink
output metrics in fixed order, by explicitly accessing keys instead o…
Browse files Browse the repository at this point in the history
…f iterating
  • Loading branch information
thoward committed Oct 23, 2021
1 parent 0759638 commit e77ca84
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,13 @@ func executeCheck(event *types.Event) (int, error) {
}()
metricGroups["disk.warning"].AddMetric(tags, anyWarning, timeNow)
if plugin.MetricsMode {
for _, g := range metricGroups {
g.Output()
}

// output metrics in a fixed order
metricGroups["disk.critical"].Output()
metricGroups["disk.warning"].Output()
metricGroups["disk.percent_used"].Output()
metricGroups["disk.total_bytes"].Output()
metricGroups["disk.used_bytes"].Output()
metricGroups["disk.free_bytes"].Output()
}
if criticals > 0 {
return sensu.CheckStateCritical, nil
Expand Down

0 comments on commit e77ca84

Please sign in to comment.