mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-26 02:48:28 +00:00
Merge pull request #2 from avian2/add-systemd
Fix remaining issues with systemd_units plugin
This commit is contained in:
commit
1a4b6cfbe7
1 changed files with 9 additions and 12 deletions
|
@ -60,18 +60,15 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch () {
|
fetch () {
|
||||||
tmp=$(mktemp -t munin-systemd_units.XXXXXX)
|
tmp=$(systemctl --no-pager --no-legend --all | awk '{print $1, $3}')
|
||||||
trap "rm \"$tmp\"" EXIT
|
for state in $states ; do
|
||||||
systemctl --no-pager --no-legend --all | awk '{print $1, $3}' > "$tmp"
|
count=$(echo "$tmp" | grep -c "$state$")
|
||||||
for state in \
|
echo "$state.value $count"
|
||||||
$states ; do
|
extinfo=$(echo "$tmp" | grep "$state$" | cut -d " " -f 1 | tr '\n' ' ')
|
||||||
echo -n "$state.value "
|
if [ -n "$extinfo" ]; then
|
||||||
grep -c "$state$" "$tmp"
|
echo "$state.extinfo" "$extinfo"
|
||||||
extinfo=$(grep "$state$" "$tmp" | cut -d " " -f 1)
|
fi
|
||||||
if [ -n "$extinfo" ]; then
|
done
|
||||||
echo "$state.extinfo" $extinfo
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue