#!/bin/sh ################################################################# # Check_hp_iml # # # # Changelog # # # # 09.12.2008 Juliane Zoellner hostname / ip-address # Add other MIBS if you want # Change Community and Versions if you need to export MIBS=ALL export MIBDIRS="" # # check logical drive states # index=0 event="" resultstring="" result="" check="" while [ $index -le 10 ] do status=`snmpwalk -Ov -c public -v 1 $1 .1.3.6.1.4.1.232.6.2.11.3.1.6.$index` # Some hpasmcli do not print anything in .1.3.6.1.4.1.232.6.2.11.3.1.6.0 MIB if [ -z "$status" ] && [ $index == 0 ]; then status1=`snmpwalk -Ov -c public -v 1 $1 .1.3.6.1.4.1.232.6.2.11.3.1.6.1` while [ -z "$status1" ] do echo "No critical Events on EventLog" exit 0 done else if [ -z "$status" ] && [ $index -ne 1 ]; then echo "$resultstring" exit 2 else # Create the date let year=0x`echo $status | awk '{ print $2$3 }'` let month=0x`echo $status | awk '{ print $4 }'` let day=0x`echo $status | awk '{ print $5 }'` let hour=0x`echo $status | awk '{ print $6 }'` let minute=0x`echo $status | awk '{ print $7 }'` datum="$day/$month/$year $hour:$minute" # Grep event event=`snmpwalk -Ov -c public -v 1 $1 .1.3.6.1.4.1.232.6.2.11.3.1.8.$index` result="$datum - $event
" echo $result | grep -i "IML Cleared" >> /dev/null 2>&1 check=$? if [ $check -eq 0 ]; then resultstring="$resultstring $result" echo "$resultstring" exit 0 else resultstring="$resultstring $result" fi fi fi index=`expr $index + 1` done echo "$resultstring" exit 2