diff --git a/check_zypper.sh b/check_zypper.sh new file mode 100755 index 0000000..d467d79 --- /dev/null +++ b/check_zypper.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +############################################################################# +# (c) 2011 Sven Velt /dev/null 2>&1 + +zypper_out=$(sudo LANG=C /usr/bin/zypper -q pchk) +if ( echo "${zypper_out}" | grep -q "needed" ) ; then + output=$(echo ${zypper_out} | cut -d "." -f 7) + patches=$(echo ${output} | cut -d " " -f1) + if [ ${patches} -gt 0 ] ; then + secpatches=$(echo ${output} | cut -d "(" -f2|cut -d " " -f1) + if [ -n "${secpatches}" ]; then + if [ ${secpatches} -gt 0 ] ; then + echo "Zypper CRITICAL - ${patches}" + exit 2 + fi + echo "Zypper WARNING - ${output}" + exit 1 + fi + fi +fi + +echo "Zypper OK - No updates available" +exit 0