From d1b9cbbb909591746893e7b90a1d89beda7d560f Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Fri, 20 Jan 2012 02:06:58 +0800 Subject: [PATCH] pretty simple plugin to monitor pending freebsd-updates requires 'portversion' --- plugins/other/freebsd-upgrades | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 plugins/other/freebsd-upgrades diff --git a/plugins/other/freebsd-upgrades b/plugins/other/freebsd-upgrades new file mode 100755 index 00000000..e9b0b5a5 --- /dev/null +++ b/plugins/other/freebsd-upgrades @@ -0,0 +1,38 @@ +#!/usr/local/bin/bash + +if [ "$1" = "config" ]; then + echo "graph_title Available Updates" + echo "graph_args --base 1000 -l 0" + echo "graph_vlabel upgradeable packages/ports " + echo "pkg.label binary packages" + echo "ports.label ports" + exit 0 +fi + +if [ "$1" = "autoconf" ]; then + echo "yes" + exit 0 +fi + +updates="$(freebsd-update fetch | \ +grep -v 'Looking up update.FreeBSD.org mirrors' | \ +grep -v 'Fetching metadata signature' | \ +grep -v 'Fetching metadata index' | \ +grep -v 'Inspecting system' | \ +grep -v 'Preparing to download files' | \ +grep -v -e '^$' | \ +grep -v 'The following files will be added' | \ +grep -v 'No updates needed' | \ +grep -v 'The following files will be updated' | wc -l | sed -e 's/ //g' )" + +updates="$(echo -n "${updates}")" + +echo "pkg.value $updates" + + +updates="$(portversion | grep '<' | wc -l | sed -e 's/ //g')" +updates="$(echo -n "${updates}")" + +echo "ports.value $updates" + +exit 0