#!/bin/bash # #INFO: #----- #Query the state of a power component for library Oracle Storagetek SL500 / SL3000 / SL8500 by SNMP. # #PREREQUISITES: #-------------- #This check need: # - snmpwalk tool installed in the system. # - Activate the snmp agent at the library. Procedures are in the follow documents: "SL3000 SNMP Reference Manual", "SL8500 SNMP Reference Manual","SL500 Library: Simple Network Management Protocol". # - MIB file of the library. # #SYNTAX: #------- #Execute with arguments "$1 $2 $3 $4" "Library_IP MIB_PATH DRIVE_NUMBER SNMP_Version POWER_COMPONENT_NUMBER" #This Script is developed for Oracle Solaris 10, if you are using other operating system must change the appropiate path of snmpwalk tool. # #EX: #--- #./check_health_SL_power 10.0.0.1 "/MIB/MIB-SL3000.txt" v2c 1 #"Rail-BDM-AC1:1" is normal(2). #(...) #./check_SL3000_power 10.0.0.1 "/MIB/MIB-SL3000.txt" v2c 15 #"Drive-BDM-AC2:9" is normal(2). # #ABOUT: #------ #More info at: www.almacenamientoabierto.com (spanish) # #Mail: info@almacenamientoabierto.com # #LICENSE: #-------- #This file is part of Check_Health_Oracle_Libraries. # # Check_Health_Oracle_Libraries 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 3 of the License, or # (at your option) any later version. # # Check_Health_Oracle_Libraries 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 Check_Health_Oracle_Libraries. If not, see . # ESTADO=`/usr/sfw/bin/snmpwalk -m $2 -v $3 -c public $1 slPowerSupplyOperational.$4|awk '{print $4}'` TIPO=`/usr/sfw/bin/snmpwalk -m $2 -v $3 -c public $1 slPowerSupplyName.$4|awk '{print $4}'` if [[ "$ESTADO" == *\(2\)* ]];then echo "$TIPO is $ESTADO." exit 0 fi if [[ "$ESTADO" == *\(1\)* ]];then echo "$TIPO is $ESTADO." exit 2 fi echo "Can't determinate the state." exit 3