Search This Blog

Monday, November 03, 2008

hp notifier

open source version :)


# hp/compaq notifier. to be run from cron. require psp

#define addresses where warnings will be sent

#let’s check if we have events in the ILO log

/sbin/hplog -v | grep -B 1 -E ‘Error|Failure|Screen|ASR’ >> /tmp/ciss2.$$

set `wc /tmp/ciss2.$$`

if [ $1 -eq 0 ]


#if the ILO log is empty get out

exit 0


#if there is something in the log, check if we have a previous logfile

if [ ! -f /var/log/ciss.log ]


#create one if we don’t have it yet

touch /var/log/ciss.log


#compare the newly readed infos from ILO with those from previous logfile

grep -v -f /var/log/ciss.log /tmp/ciss2.$$ > /tmp/ciss3.$$

#if there are differences

if [ -s /tmp/ciss3.$$ ]


#replace previous log with the new one

cat /tmp/ciss2.$$ > /var/log/ciss.log

#add some cosmetic informations

echo -en “End of report on: ” >> /tmp/ciss2.$$

date >> /tmp/ciss2.$$

#and warn the administrators

cat /tmp/ciss2.$$ | /bin/mail -s ‘Error on $HOSTNAME’ $recipient1
# cat /tmp/ciss2.$$ | /bin/mail -s ‘Error on $HOSTNAME’ $recipient2

echo “comment this line and uncomment the line before” ; cat /tmp/ciss2.$$ fi

#then let’s do some cleanup

rm -f /tmp/ciss*

exit 0

PS: the script is modified a bit, as does not allow some strings such as: < followed by /location/file...

No comments:

Post a Comment

Blog Archive