mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
[systemd_units] Rename, remove unused mode logic and cleanup syntax
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
parent
ef80db4bc1
commit
b31b861f1c
1 changed files with 15 additions and 25 deletions
|
@ -52,7 +52,7 @@ EOF
|
||||||
for state in $states; do
|
for state in $states; do
|
||||||
echo "$state.label $state"
|
echo "$state.label $state"
|
||||||
echo "$state.draw AREASTACK"
|
echo "$state.draw AREASTACK"
|
||||||
if [ $state = failed ]; then
|
if [ "$state" = "failed" ]; then
|
||||||
echo "$state.warning 0"
|
echo "$state.warning 0"
|
||||||
echo "$state.critical 10"
|
echo "$state.critical 10"
|
||||||
fi
|
fi
|
||||||
|
@ -60,38 +60,28 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch () {
|
fetch () {
|
||||||
case $1 in
|
tmp=$(mktemp -t munin-systemd_units.XXXXXX)
|
||||||
"units")
|
trap "rm \"$tmp\"" EXIT
|
||||||
tmp=`mktemp -t munin-systemd.XXXXXX`
|
systemctl --no-pager --no-legend --all | awk '{print $1, $3}' > "$tmp"
|
||||||
systemctl --no-pager --no-legend --all | awk '{print $1, $3}' > $tmp
|
|
||||||
for state in \
|
for state in \
|
||||||
$states ; do
|
$states ; do
|
||||||
echo -n "$state.value "
|
echo -n "$state.value "
|
||||||
grep $state$ $tmp | wc -l
|
grep -c "$state$" "$tmp"
|
||||||
extinfo=`grep $state$ $tmp | cut -d " " -f 1`
|
extinfo=$(grep "$state$" "$tmp" | cut -d " " -f 1)
|
||||||
if [ "$extinfo" ]; then
|
if [ -n "$extinfo" ]; then
|
||||||
echo "$state.extinfo" $extinfo
|
echo "$state.extinfo" $extinfo
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
rm $tmp
|
|
||||||
;;
|
|
||||||
"*")
|
|
||||||
echo "$0: unknown mode '$1'" >&2
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# mode=`echo $0 | sed 's/.*_//'`
|
|
||||||
mode=units
|
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
"autoconf")
|
"autoconf")
|
||||||
autoconf
|
autoconf
|
||||||
;;
|
;;
|
||||||
"config")
|
"config")
|
||||||
config $mode
|
config
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
fetch $mode
|
fetch
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
Loading…
Add table
Add a link
Reference in a new issue