1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-12-23 17:43:51 +01:00
nagios-plugins/check_eva/trunk/check_eva

66 lines
2.3 KiB
Plaintext
Raw Normal View History

2010-08-17 12:50:27 +02:00
#!/bin/sh
BODYFILE=/tmp/check_eva.body
LASTCHECK=`ls -la /etc/sssu.out | awk ' { print $6,$7,$8 }'`
COMMANDFILE="/etc/nagios/check_eva.sssu"
if [ ! -f $COMMANDFILE ]; then
2010-08-30 14:50:01 +02:00
echo "Error, could not find commandfile $COMMANDFILE"
exit 3
2010-08-17 12:50:27 +02:00
fi
2010-08-30 14:50:01 +02:00
#/usr/local/sbin/sssu "file $COMMANDFILE" |grep -v PASSWORD > /etc/sssu.out
2010-08-17 12:50:27 +02:00
PROBLEM=`grep -w operationalstate /etc/sssu.out |grep -v good |wc -l`
2010-08-30 14:50:01 +02:00
ERRORCHECK1=`grep -i error /etc/sssu.out| grep -v on_error | wc -l`
ERRORCHECK2=`grep -w operationalstate /etc/sssu.out | wc -l`
2010-08-17 12:50:27 +02:00
SUMMARY=`awk ' $1 == "objectname" { STORAGE=$3 } \
$1 == "operationalstate" { STATE=$3 } \
2010-08-30 14:50:01 +02:00
$1 == "managementhostname" { print STORAGE "=" STATE ";" } ' /etc/sssu.out | tr '\n' ' '`
PERFDATA=`awk ' $1 == "objectname" { STORAGE=$3 } \
$1 == "totalstoragespace" { totalstoragespace=STORAGE "_" $1 "=" $3 } \
$1 == "usedstoragespace" { usedstoragespace=STORAGE "_" $1 "=" $3 } \
$1 == "availablestoragespace" { availablestoragespace=STORAGE "_" $1 "=" $3 } \
$1 == "managementhostname" { print totalstoragespace, usedstoragespace, availablestoragespace } ' /etc/sssu.out | tr '\n' ' '`
2010-08-17 12:50:27 +02:00
2010-08-30 14:50:01 +02:00
#totalstoragespace=`grep totalstoragespace /etc/sssu.out | awk '{ print $3 }' | tr '\n' ' ' `
#usedstoragespace=`grep usedstoragespace /etc/sssu.out | awk '{ print $3 }' | tr '\n' ' '`
#availablestoragespace=`grep availablestoragespace /etc/sssu.out | awk '{ print $3 }' | tr '\n' ' '`
#PERFDATA="totalstoragespace=$totalstoragespace usedstoragespace=$usedstoragespace availablestoragespace=$availablestoragespace"
2010-08-17 12:50:27 +02:00
if [ "$PROBLEM" -gt 0 ]; then
2010-08-30 14:50:01 +02:00
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
2010-08-17 12:50:27 +02:00
fi
2010-08-30 14:50:01 +02:00
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"
2010-08-17 12:50:27 +02:00
echo "EVA state last checked at $LASTCHECK"
2010-08-30 14:50:01 +02:00
grep -E 'operationalstate|operationalstatedetail|objectname|licensestate|systemtype|storagespace' /etc/sssu.out
2010-08-17 12:50:27 +02:00