Révision b5e31b66
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 | ||
|---|---|---|
| 14 | 14 |
|
| 15 | 15 |
The plugin needs no additional configuration and works out of the box. |
| 16 | 16 |
|
| 17 |
It is possible to add warnings for certain numbers of updates pending. The |
|
| 18 |
following will send a warning when there are more than 10 updates pending. |
|
| 19 |
|
|
| 20 |
[pacman_pending_updates] |
|
| 21 |
env.PENDING_UPDATES_WARNING :10 |
|
| 22 |
|
|
| 23 | 17 |
=head1 INTERPRETATION |
| 24 | 18 |
|
| 25 | 19 |
This plugin will draw one line: the number of updates pending. |
| ... | ... | |
| 53 | 47 |
updates.label updates |
| 54 | 48 |
updates.info Current number of pending updates |
| 55 | 49 |
EOM |
| 56 |
if [[ -n $PENDING_UPDATES_WARNING ]]; then |
|
| 57 |
echo updates.warning $PENDING_UPDATES_WARNING |
|
| 58 |
fi |
|
| 59 | 50 |
;; |
| 60 | 51 |
|
| 61 | 52 |
autoconf) |
| ... | ... | |
| 63 | 54 |
;; |
| 64 | 55 |
|
| 65 | 56 |
*) |
| 66 |
tmpfile=$(mktemp) |
|
| 67 |
updates=$(checkupdates | tee "$tmpfile" | wc -l) |
|
| 68 |
echo updates.value $updates |
|
| 69 |
if [ $updates -gt 0 ]; then |
|
| 70 |
echo updates.extinfo $(paste -s -d, "$tmpfile") |
|
| 57 |
updates="$(checkupdates)" |
|
| 58 |
if [ -n "$updates" ]; then |
|
| 59 |
echo "updates.value $(echo "$updates" | wc -l)" |
|
| 60 |
echo "updates.extinfo $(echo "$updates" | paste -s -d,)" |
|
| 61 |
else |
|
| 62 |
echo updates.value 0 |
|
| 71 | 63 |
fi |
| 72 |
rm "$tmpfile" |
|
| 73 | 64 |
;; |
| 74 | 65 |
esac |
| 75 | 66 |
|
Formats disponibles : Unified diff