1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-05 01:53:44 +01:00

Bugfix for check_eva, return unknown if sssu is unsuccessful

This commit is contained in:
Páll Guðjón Sigurðsson 2010-08-25 15:32:44 +00:00
parent be6b9f4e9f
commit 8639e9ab5b

View File

@ -12,6 +12,9 @@ fi
/usr/local/sbin/sssu "file $COMMANDFILE" |grep -v PASSWORD > /etc/sssu.out
PROBLEM=`grep -w operationalstate /etc/sssu.out |grep -v good |wc -l`
ERRORCHECK1=`grep -i error /etc/sssu.out| grep -v on_error | wc -l`
ERRORCHECK2=`grep -w operationalstate /etc/sssu.out | wc -l`
SUMMARY=`awk ' $1 == "objectname" { STORAGE=$3 } \
$1 == "operationalstate" { STATE=$3 } \
@ -24,12 +27,30 @@ availablestoragespace=`grep availablestoragespace /etc/sssu.out | awk '{ print $
PERFDATA="totalstoragespace=$totalstoragespace usedstoragespace=$usedstoragespace availablestoragespace=$availablestoragespace"
if [ "$PROBLEM" -gt 0 ]; then
echo "Warning, HP EVA Requires attention. $SUMMARY | $PERFDATA"
echo "Warning - HP EVA Requires attention. $SUMMARY | $PERFDATA"
echo "EVA state last checked at $LASTCHECK"
grep -E 'operationalstate|operationalstatedetail|objectname|licensestate|systemtype|storagespace' /etc/sssu.out
exit 1
fi
echo "OK, HP EVA reports: $SUMMARY | $PERFDATA"
if [ "$ERRORCHECK1" -gt 0 ]; then
echo "Unknown - failed to run sssu command"
cat /etc/sssu.out
exit 3
fi
if [ "$ERRORCHECK2" -lt 1 ]; then
echo "Unknown - Could not retrieve information via sssu"
cat /etc/sssu.out
exit 3
fi
echo "OK - HP EVA reports: $SUMMARY | $PERFDATA"
echo "EVA state last checked at $LASTCHECK"
grep -E 'operationalstate|operationalstatedetail|objectname|licensestate|systemtype|storagespace' /etc/sssu.out