#!/bin/bash #!/bin/bash ### check_rsa_fan # Checks IBM Supervisor 2 Fanspeed # Version 0.1, Copytight (c) 2004 by Gerhard Gschlad ### ### License Information: # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # you should have received a copy of the GNU General Public License # along with this program (or with Nagios); if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA ### if [ ! "$#" == "1" ]; then echo -e "\nWarning: Not enough command line arguments. \nUsage: ./check_rsa_fan \n \ncheck_rsa_fan checks Fanspeed on IBM based x86 Server with Supervisor 2 Adapter. \nWritten by Gerhard Gschlad (gerhard_AT_gschlad.at) in 2004. \n" && exit "3" fi HOSTNAME=$1 STATUSFAN1=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.3.1.0 | grep maximum | awk '{print $5}' | sed -e 's/\%//g') STATUSFAN2=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.3.2.0 | grep maximum | awk '{print $5}' | sed -e 's/\%//g') STATUSFAN3=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.3.3.0 | grep maximum | awk '{print $5}' | sed -e 's/\%//g') STATUSFAN4=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.3.4.0 | grep maximum | awk '{print $5}' | sed -e 's/\%//g') STATUSFAN5=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.3.5.0 | grep maximum | awk '{print $5}' | sed -e 's/\%//g') STATUSFAN6=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.3.6.0 | grep maximum | awk '{print $5}' | sed -e 's/\%//g') #check FAN1 if [ $STATUSFAN1 -le 80 ]; then ECHO="OK: FAN Speed FAN1 $STATUSFAN1% - FAN2 $STATUSFAN2% - FAN3 $STATUSFAN3% - FAN4 $STATUSFAN4% - FAN5 $STATUSFAN5% - FAN6 $STATUSFAN6%"; EXIT=0; else echo "CRITICAL FAN1: FAN Speed FAN1 $STATUSFAN1% - FAN2 $STATUSFAN2% - FAN3 $STATUSFAN3% - FAN4 $STATUSFAN4% - FAN5 $STATUSFAN5% - FAN6 $STATUSFAN6%"; exit 2 fi #check FAN2 if [ $STATUSFAN2 -le 80 ]; then EXIT=0; else echo "CRITICAL FAN2: FAN Speed FAN1 $STATUSFAN1% - FAN2 $STATUSFAN2% - FAN3 $STATUSFAN3% - FAN4 $STATUSFAN4% - FAN5 $STATUSFAN5% - FAN6 $STATUSFAN6%"; exit 2 fi #check FAN3 if [ $STATUSFAN2 -le 80 ]; then EXIT=0; else echo "CRITICAL FAN3: FAN Speed FAN1 $STATUSFAN1% - FAN2 $STATUSFAN2% - FAN3 $STATUSFAN3% - FAN4 $STATUSFAN4% - FAN5 $STATUSFAN5% - FAN6 $STATUSFAN6%"; exit 2 fi #check FAN4 if [ $STATUSFAN2 -le 80 ]; then EXIT=0; else echo "CRITICAL FAN4: FAN Speed FAN1 $STATUSFAN1% - FAN2 $STATUSFAN2% - FAN3 $STATUSFAN3% - FAN4 $STATUSFAN4% - FAN5 $STATUSFAN5% - FAN6 $STATUSFAN6%"; exit 2 fi #check FAN5 if [ $STATUSFAN2 -le 80 ]; then EXIT=0; else echo "CRITICAL FAN5: FAN Speed FAN1 $STATUSFAN1% - FAN2 $STATUSFAN2% - FAN3 $STATUSFAN3% - FAN4 $STATUSFAN4% - FAN5 $STATUSFAN5% - FAN6 $STATUSFAN6%"; exit 2 fi #check FAN6 if [ $STATUSFAN2 -le 80 ]; then EXIT=0; else echo "CRITICAL FAN6: FAN Speed FAN1 $STATUSFAN1% - FAN2 $STATUSFAN2% - FAN3 $STATUSFAN3% - FAN4 $STATUSFAN4% - FAN5 $STATUSFAN5% - FAN6 $STATUSFAN6%"; exit 2 fi #check Ambient #if [ $STATUSAMBI -le 40 ]; then # EXIT=0; #else echo "CRITICAL Ambient: Tempearture Celsius CPU1 $STATUS1 CPU2 $STATUS2 DASD $STATUSDASD Ambient $STATUSAMBI"; exit 2 #fi #check CPU1 #if [ $STATUS1 -gt 50 ]; then # echo "CRITICAL CPU1: Temperature Celsius CPU1 $STATUS1 CPU2 $STATUS2 DASD $STATUSDASD Ambient $STATUSAMBI"; exit 2 #else EXIT=0; #fi echo $ECHO exit $EXIT