diff --git a/check_glsa b/check_glsa new file mode 100755 index 0000000000000000000000000000000000000000..7975c22107d0097859faee43109a7a2e6e2b5f1e --- /dev/null +++ b/check_glsa @@ -0,0 +1,36 @@ +#!/bin/sh +# Run glsa-check and filter out any problems. Return critical status +# if any problems exist. +# +# This check script is maintained in a Subversion repository at +# http://lsvn.lysator.liu.se/svnroot/nagios-plugins. Contact +# <ceder@lysator.liu.se> for commit access. + +GLSA_TMP=`tempfile` +GREP_TMP=`tempfile` +ERR_TMP=`tempfile` +trap "rm $GLSA_TMP $GREP_TMP $ERR_TMP" 0 +glsa-check -l -n > $GLSA_TMP 2> $ERR_TMP +RC=$? +if [ $RC -ne 0 ] +then + echo UNKNOWN - glsa-check returned $? + cat $ERR_TMP + exit 3 +fi + +grep '^[0-9][0-9]*-[0-9][0-9] \[[^AU]\]' < $GLSA_TMP > $GREP_TMP 2> $ERR_TMP +RC=$? + +case $RC in + 0) echo CRITICAL - glsa-check found problems: + cat $GREP_TMP + exit 2;; + 1) echo OK - no GLSA-related problems found + exit 0;; + *) echo UNKNOWN - grep returned $? + cat $ERR_TMP + exit 3;; +esac + +