muninlite/plugins/df
Daniel Alder f55b83fdbd Improve df
Before, there were 1+n calls of df where n is the number of output values. I introduced some script magic to use the values from the
first call. Motivation was, there was a very complex sed call which failed to process some of my df output lines. The new code is much
safer.

Actually, the original problem obviously was that the sed regex didn't cover capital letters which I had in my mountpoints.
2023-12-13 14:58:34 +01:00

22 lines
674 B
Text

config_df() {
echo "graph_title Filesystem usage (in %)
graph_args --upper-limit 100 -l 0
graph_vlabel %
graph_category disk
graph_info This graph shows disk usage on the machine."
df -PT | grep '^/' | grep -vwE "$DF_IGNORE_FILESYSTEM_REGEX" | while read dev type blocks used avail pct mp
do
PNAME=$(clean_fieldname "$dev")
echo "$PNAME.label $mp"
echo "$PNAME.info $dev -> $mp"
echo "$PNAME.warning 92"
echo "$PNAME.critical 98"
done
}
fetch_df() {
df -PT | grep '^/' | grep -vwE "$DF_IGNORE_FILESYSTEM_REGEX" | while read dev type blocks used avail pct mp
do
PNAME=$(clean_fieldname "$dev")
echo "$PNAME.value" "${pct%\%}"
done
}