2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Clean up pacman_pending_updates.

No more environment variables since those can easily be configured with
regular munin settings.

Properly quote all strings.

No longer use temp files for holding update information; instead hold it
all in a variable.
This commit is contained in:
Bert Peters 2017-10-05 11:28:15 +02:00
parent e9150b1892
commit b5e31b6612

View File

@ -14,12 +14,6 @@ All systems with pacman as their package manager.
The plugin needs no additional configuration and works out of the box.
It is possible to add warnings for certain numbers of updates pending. The
following will send a warning when there are more than 10 updates pending.
[pacman_pending_updates]
env.PENDING_UPDATES_WARNING :10
=head1 INTERPRETATION
This plugin will draw one line: the number of updates pending.
@ -53,9 +47,6 @@ graph_category security
updates.label updates
updates.info Current number of pending updates
EOM
if [[ -n $PENDING_UPDATES_WARNING ]]; then
echo updates.warning $PENDING_UPDATES_WARNING
fi
;;
autoconf)
@ -63,13 +54,13 @@ EOM
;;
*)
tmpfile=$(mktemp)
updates=$(checkupdates | tee "$tmpfile" | wc -l)
echo updates.value $updates
if [ $updates -gt 0 ]; then
echo updates.extinfo $(paste -s -d, "$tmpfile")
updates="$(checkupdates)"
if [ -n "$updates" ]; then
echo "updates.value $(echo "$updates" | wc -l)"
echo "updates.extinfo $(echo "$updates" | paste -s -d,)"
else
echo updates.value 0
fi
rm "$tmpfile"
;;
esac