@@ -7,7 +7,7 @@
# Can be used to query status and performance info #
# Tested on: Check the following web page for compatibility matrix: #
# claudiokuenzler.com/nagios-plugins/check_equallogic.php #
-# License: GPL #
+# License: GPLv2 #
# History: #
# 20091109 Started Script programming checks: #
# health, disk, raid, uptime, ps, info #
@@ -42,10 +42,14 @@
# 20110808 New vol check - checks single volume for utilization #
# 20111013 Bugfix in vol check for similar vol names by Matt White #
# 20111031 Bugfix in ethif check for int response by Francois Borlet #
+# 20120104 Bugfix in temp check if only one controller available #
+# 20120104 Bugfix in info check if only one controller available #
+# 20120123 Bugfix in volumes check #
+# 20120125 Added perfdata in volumes check, volume names now w/o quotes #
#########################################################################
# Usage: ./check_equallogic -H host -C community -t type [-w warning] [-c critical]
#########################################################################
-help="check_equallogic (c) 2009-2011 Claudio Kuenzler (published under GPL licence)\n
+help="check_equallogic (c) 2009-2012 Claudio Kuenzler (published under GPL licence)\n
Usage: ./check_equallogic -H host -C community -t type [-v volume] [-w warning] [-c critical]\n
Options:\n-H Hostname\n-C SNMP-Community name (at least read-only)\n-t Type to check, see list below\n-v Name of volume to check\n-w Warning Threshold\n-c Critical Threshold\n
Requirements: snmpwalk, awk, grep, wc\n
@@ -142,13 +146,13 @@
if [ ${sensortemp[${c}]} -gt 0 ]
then
perfdata=$perfdata" ${sensornames[$c]}=${sensortemp[${c}]};${sensortemp_min[${c}]};${sensortemp_max[${c}]}"
+ #Check if state is CRITICAL. Compare against MIN and MAX
+ if [ ${sensortemp[${c}]} -gt ${sensortemp_max[${c}]} ] || [ ${sensortemp[${c}]} -lt ${sensortemp_min[${c}]} ]
+ then
+ sensorfinalcrit[${c}]="${sensornames[$c]} => ${sensortemp[${c}]}"
+ fi
fi
- #Check if state is CRITICAL. Compare against MIN and MAX
- if [ ${sensortemp[${c}]} -gt ${sensortemp_max[${c}]} ] || [ ${sensortemp[${c}]} -lt ${sensortemp_min[${c}]} ]
- then
- sensorfinalcrit[${c}]="${sensornames[$c]} => ${sensortemp[${c}]}"
- fi
let c++
done
@@ -312,11 +316,15 @@
disknumber=$(snmpwalk -v 2c -O vq -c ${community} ${host} 1.3.6.1.4.1.12740.2.1.11.1.4)
firmware1=$(snmpwalk -v 2c -O vq -c ${community} ${host} 1.3.6.1.4.1.12740.4.1.1.1.4.1 | cut -d " " -f 4 | awk 'NR==1')
firmware2=$(snmpwalk -v 2c -O vq -c ${community} ${host} 1.3.6.1.4.1.12740.4.1.1.1.4.1 | cut -d " " -f 4 | awk 'NR==2')
+ if [ ${controllernumber} -gt 1 ]
+ then
if [ ${firmware1} = ${firmware2} ]
then firmware=${firmware1}
else firmware="Firmware differ!"
fi
- echo "Equallogic Model ${modelnumber} Serial No ${serialnumber} ${controllernumber} controller(s) running FW ${firmware} ${disknumber} disks"
+ else firmware=${firmware1}
+ fi
+ echo "Equallogic Model ${modelnumber}, Serial No ${serialnumber}, ${controllernumber} controller(s) running FW ${firmware}, ${disknumber} disks"
exit ${STATE_OK}
;;
@@ -546,13 +554,17 @@
# Calculate Free Space and Percentage per Volume
i=0
- while [ ${i} -le ${realvolumescount} ]
+ while [ ${i} -le ${volumescount} ]
do
if [ ${volumenames[${i}]} ]
then
volumefreespace[${i}]=`expr ${volumeavailspace[${i}]} - ${volumeusedspace[${i}]}`
volumepercentage[${i}]=`expr ${volumeusedspace[${i}]} \* 100 / ${volumeavailspace[${i}]}`
# echo "$i: ${volumenames[$i]}, free Space: ${volumefreespace[${i}]} used: ${volumepercentage[${i}]} %" # For Debug
+ perfavailspace[${i}]=$((${volumeavailspace[${i}]}*1024*1024))
+ perfusedspace[${i}]=$((${volumeusedspace[${i}]}*1024*1024))
+ perffreespace[${i}]=$((${volumefreespace[${i}]}*1024*1024))
+ perfdata[${i}]="${volumenames[$i]}=${perfusedspace[${i}]};${perffreespace[${i}]};${perfavailspace[${i}]};"
let i++
else
let i++
@@ -563,7 +575,7 @@
if [ -n "${warning}" ] || [ -n "${critical}" ]
then
j=0
- while [ ${j} -le ${realvolumescount} ]
+ while [ ${j} -le ${volumescount} ]
do
if [ ${volumenames[${j}]} ]
then
@@ -581,17 +593,17 @@
if [ ${#volumewarning[@]} -gt 0 ] && [ ${#volumecritical[@]} -lt 1 ]
- then echo "WARNING ${volumewarning[@]}"; exit ${STATE_WARNING}
+ then echo "WARNING ${volumewarning[@]}|${perfdata[*]}"; exit ${STATE_WARNING}
elif [ ${#volumecritical[@]} -ge 1 ]
- then echo "CRITICAL ${volumecritical[@]}"; exit ${STATE_CRITICAL}
+ then echo "CRITICAL ${volumecritical[@]}|${perfdata[*]}"; exit ${STATE_CRITICAL}
else
- echo "OK ${volumeok[*]}"; exit ${STATE_OK}
+ echo "OK ${volumeok[*]}|${perfdata[*]}"; exit ${STATE_OK}
fi
# Output without thresholds
else
j=0
- while [ ${j} -le ${realvolumescount} ]
+ while [ ${j} -le ${volumescount} ]
do
if [ ${volumenames[${j}]} ]
then
@@ -601,7 +613,7 @@
let j++
fi
done
- echo "${volumefinaloutput[*]}"
+ echo "${volumefinaloutput[*]}|${perfdata[*]}"
exit ${STATE_OK}
fi
|