#!/bin/bash #!/bin/bash ### check_rsa_temp # Checks Temperature of IBM based x86 Server with Supervisor 2 Adapter # 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_ibm_rsa_cpu.sh \n \ncheck_ibm_rsa_cpu checks Temperature of IBM based x86 Server with Supervisor 2 Adapter. \nWritten by Gerhard Gschlad (gerhard_AT_gschlad.at) in 2004. \n" && exit "3" fi HOSTNAME=$1 STATUS1=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.1.2.1.1 | grep Centigrade | awk '{print $5}' | sed -e 's/\.00//g') STATUS2=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.1.2.2.1 | grep Centigrade | awk '{print $5}' | sed -e 's/\.00//g') STATUSDASD=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.1.4.1.0 | grep Centigrade | awk '{print $5}' | sed -e 's/\.00//g') STATUSAMBI=$(snmpget -v1 -cpublic -mALL $HOSTNAME ibm.3.51.1.2.1.5.1.0 | grep Centigrade | awk '{print $5}' | sed -e 's/\.00//g') #check CPU1 if [ $STATUS1 -le 40 ]; then ECHO="OK: Temperature Celsius CPU1 $STATUS1 - CPU2 $STATUS2 - DASD $STATUSDASD - Ambient $STATUSAMBI"; EXIT=0; else echo "CRITICAL CPU2: Temperature Celsius CPU1 $STATUS1 CPU2 $STATUS2 DASD $STATUSDASD Ambient $STATUSAMBI"; exit 2 fi #check CPU2 if [ $STATUS2 -le 40 ]; then EXIT=0; else echo "CRITICAL CPU2: Tempearture Celsius CPU1 $STATUS1 CPU2 $STATUS2 DASD $STATUSDASD Ambient $STATUSAMBI"; exit 2 fi #check DASD if [ $STATUSDASD -le 40 ]; then EXIT=0; else echo "CRITICAL DASD: Tempearture Celsius CPU1 $STATUS1 CPU2 $STATUS2 DASD $STATUSDASD Ambient $STATUSAMBI"; 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 #check CPU2 if [ $STATUS2 -gt 50 ]; then echo "CRITICAL CPU2: Temperature Celsius CPU1 $STATUS1 CPU2 $STATUS2 DASD $STATUSDASD Ambient $STATUSAMBI"; exit 2 else EXIT=0; fi #check DASD if [ $STATUSDASD -gt 50 ]; then echo "CRITICAL DASD: Temperature Celsius CPU1 $STATUS1 CPU2 $STATUS2 DASD $STATUSDASD Ambient $STATUSAMBI"; exit 2 else EXIT=0; fi #check Ambient if [ $STATUSAMBI -gt 50 ]; then echo "CRITICAL Ambient: Temperature Celsius CPU1 $STATUS1 CPU2 $STATUS2 DASD $STATUSDASD Ambient $STATUSAMBI"; exit 2 else EXIT=0; fi echo $ECHO exit $EXIT