From b5e31b66127fd506be09ba987362de7d8eafb11a Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Thu, 5 Oct 2017 11:28:15 +0200 Subject: [PATCH] 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. --- plugins/other/pacman_pending_updates | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/plugins/other/pacman_pending_updates b/plugins/other/pacman_pending_updates index c6fda9bb..c5e66b93 100755 --- a/plugins/other/pacman_pending_updates +++ b/plugins/other/pacman_pending_updates @@ -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