1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00
Munin-Contrib/plugins/other/pacman_pending_updates
Steve Schnepp b526aee0c0 Revert "Plugin pacman_pending_updates: switch to /bin/sh; update version"
This reverts commit c9cc2f27f6.

Actually, it depends on a bashism at line 53:
  if hash checkupdates >/dev/null 2>&1; then
2019-07-31 20:48:00 +02:00

73 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
: <<=cut
=head1 NAME
pacman_pending_updates - Plugin to monitor pending updates
=head1 APPLICABLE SYSTEMS
All systems with pacman as their package manager.
=head1 CONFIGURATION
The plugin needs no additional configuration and works out of the box.
=head1 INTERPRETATION
This plugin will draw one line: the number of updates pending.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 VERSION
1.1.1
=head1 AUTHOR
Bert Peters <bert@bertptrs.nl>
=head1 LICENSE
GPLv2
=cut
case $1 in
config)
cat <<'EOM'
graph_args --base 1000 -l 0
graph_title Pending updates
graph_vlabel updates
graph_category security
updates.label updates
updates.info Current number of pending updates
EOM
;;
autoconf)
if hash checkupdates >/dev/null 2>&1; then
echo yes
else
echo "no (checkupdates not found)"
fi
;;
*)
if updates="$(checkupdates)"; then
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
echo "updates.value U" && exit
fi
;;
esac
exit 0