Skip to content

Instantly share code, notes, and snippets.

@eraserewind
Last active December 14, 2015 20:38
Show Gist options
  • Save eraserewind/5145005 to your computer and use it in GitHub Desktop.
Save eraserewind/5145005 to your computer and use it in GitHub Desktop.
Small Munin plugin to check pkgng.
#!/bin/sh
case $1 in
config)
cat <<'EOM'
graph_title pkgng
graph_vlabel packages
graph_category system
installed.label installed
audit.label with security audit
missing_deps.label with missing dependencies
upgrades.label with upgrades
audit.warning 5
audit.critical 10
upgrades.warning 5
upgrades.critical 10
missing_deps.warning 5
missing_deps.critical 10
EOM
exit 0;;
esac
echo -n "installed.value "
pkg stats -l | awk '/Installed/ { print $3 }'
echo -n "audit.value "
pkg audit | awk '/problem\(s\)/ { print $1 }'
echo -n "missing_deps.value "
pkg check -da | awk 'END { print NR }'
echo -n "upgrades.value "
pkg upgrade -n | awk 'BEGIN{updates=0}/Upgrading .+\:/ { updates++; } END { print updates }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment