[collectd] Plugin to calculate percentages?
Russ Poyner
rpoyner at engr.wisc.edu
Sun Aug 26 20:51:44 CEST 2012
The percentage checking code in thresholds seems to be at least
partially broken.
Perhaps this is a good time to create a plugin to calculate percentages.
The idea being that the percentages would be calculated and fed either
to thresholds or to match_threshold as part of a filter chain. Doing the
percentage conversion in a plugin would eliminate the need for multiple
versions of the calculation in different plugins. (I see 2 in thresholds
alone).
Percentages *might* be appropriate to add to the nascent aggregation
plugin, or it could be part of a separate plugin. If the separate plugin
seems correct I'd be willing to take a shot at it. One argument for a
separate plugin would be the ability to feed percentages to aggregation
itself.
In any event I think configurable handling of NaNs or missing values
would be helpful.
Percentage is of couse 100*value/(sum(values))
Some times it's appropriate to skip or ignore missing values when
calculating the sum, for example if you are looking for hot-spots in a
set of load-balanced servers. 100*server_load/sum(server_loads....))
will be correct even as the number of server_loads in the sum changes.
(yes I just made that example up)
In other cases, for example calculating used% from df values =
100*used/sum(used+free) if free comes up NaN for some reason, dropping
it from the sum will report 100% used which is wrong. In this case its
better to fail with a loud bang, by reporting used% as NaN.
RP
More information about the collectd
mailing list