tw_cli command

Kaushal Shriyan kaushalshriyan at gmail.com
Wed Aug 18 15:27:26 CEST 2010


Hi,

I have the below bash script for nagios plugin. The issue is that i
dont need to hard code the controller c0 or c1 or c2 or c3. so on some
servers there may be two controllers c0, and c1 and on some server
there may be four controllers c0,1,2 and 3. I dont know it off hand

Typically if i run tw_cli info i get

tw_cli info

Ctl   Model        Ports   Drives   Units   NotOpt   RRate   VRate
BBU
------------------------------------------------------------------------
c0    9550SX-8LP   8       8        4       0        1       1
OK
c1    9550SX-8LP   8       8        2       0        1       1
OK

#####################################################################################################
controllers=$(tw_cli info | awk '/^c[0-9]/{print $1})
for c in $controllers;
do sudo /usr/bin/tw_cli info $c | grep -eq "DEVICE-ERROR|DEGRADED|
INOPERABLE|SMART-FAILURE"
if [ $? -eq 0 ]; then
 echo "Critical: raid problem with controller $c";
 exit 2
 fi
 echo "Ok:raid is fine"
 exit 0
done
#####################################################################################################

The issue with the above bash script is that it will exit with 2 if
the controller c0 fail and it wont check for other controllers.
I need to check for other controllers too at the same time

Please suggest.

Thanks,

Kaushal

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list