#!/bin/bash # # #INFO: #----- #Query the state of a 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" "Library_IP MIB_PATH SNMP_Version" #This Script is developed for Oracle Solaris 10, if you are using other operating system must change the appropiate path of snmpwalk tool. # # #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 slLibraryTopLevelCondition|awk '{print $4}'` SN=`/usr/sfw/bin/snmpwalk -m $2 -v $3 -c public $1 slLibSerialNumber|awk '{print $4}'` TIPO=`/usr/sfw/bin/snmpwalk -m $2 -v $3 -c public $1 slLibStkBaseModel|awk '{print $4}'` if [[ "$ESTADO" == *\(0\)* ]];then echo "Library $TIPO with SN $SN is Normal." exit 0 fi if [[ $ESTADO == *\(1\)* ]];then echo "Library $TIPO with SN $SN is Degradated." exit 1 fi if [[ $ESTADO == *\(2\)* ]];then echo "Library $TIPO with SN $SN is No Operational." exit 2 fi echo "Can't determinate the state." exit 3