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. 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 =head1 INTERPRETATION
This plugin will draw one line: the number of updates pending. This plugin will draw one line: the number of updates pending.
@ -53,9 +47,6 @@ graph_category security
updates.label updates updates.label updates
updates.info Current number of pending updates updates.info Current number of pending updates
EOM EOM
if [[ -n $PENDING_UPDATES_WARNING ]]; then
echo updates.warning $PENDING_UPDATES_WARNING
fi
;; ;;
autoconf) autoconf)
@ -63,13 +54,13 @@ EOM
;; ;;
*) *)
tmpfile=$(mktemp) updates="$(checkupdates)"
updates=$(checkupdates | tee "$tmpfile" | wc -l) if [ -n "$updates" ]; then
echo updates.value $updates echo "updates.value $(echo "$updates" | wc -l)"
if [ $updates -gt 0 ]; then echo "updates.extinfo $(echo "$updates" | paste -s -d,)"
echo updates.extinfo $(paste -s -d, "$tmpfile") else
echo updates.value 0
fi fi
rm "$tmpfile"
;; ;;
esac esac