1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 02:18:08 +00:00

Merge pull request #2 from avian2/add-systemd

Fix remaining issues with systemd_units plugin
This commit is contained in:
Olivier Mehani 2016-10-28 20:15:14 +11:00 committed by GitHub
commit 1a4b6cfbe7

View file

@ -60,18 +60,15 @@ EOF
}
fetch () {
tmp=$(mktemp -t munin-systemd_units.XXXXXX)
trap "rm \"$tmp\"" EXIT
systemctl --no-pager --no-legend --all | awk '{print $1, $3}' > "$tmp"
for state in \
$states ; do
echo -n "$state.value "
grep -c "$state$" "$tmp"
extinfo=$(grep "$state$" "$tmp" | cut -d " " -f 1)
if [ -n "$extinfo" ]; then
echo "$state.extinfo" $extinfo
fi
done
tmp=$(systemctl --no-pager --no-legend --all | awk '{print $1, $3}')
for state in $states ; do
count=$(echo "$tmp" | grep -c "$state$")
echo "$state.value $count"
extinfo=$(echo "$tmp" | grep "$state$" | cut -d " " -f 1 | tr '\n' ' ')
if [ -n "$extinfo" ]; then
echo "$state.extinfo" "$extinfo"
fi
done
}
case $1 in