Friday 16 October 2009

Tip: A small script to notify new error entries in error log

Although IBM is now pushing system director concept into AIX as well, to monitor overall health of system, i still found following small shell script very helpfull which can be used to notify any new errors in AIX error log
-----------------------------------------------
#!/bin/ksh
# Script to notify new errors in AIX error log


TOTALERRS=`errpt | grep -v "IDENTIFIER" | wc -l`

if [ ! -f /usr/local/bin/errpt.count ]
then
echo 0 > /usr/local/bin/errpt.count
fi

OLDERRS=`cat /usr/local/bin/errpt.count`
((NEWERRS=TOTALERRS-OLDERRS))

if [ ${NEWERRS} -gt 1 ]
then
echo "Please check errpt, ${NEWERRS} errors found!" | /usr/bin/mailx -vs "`hostname`: errpt report" recipient@domain.com
elif [ ${NEWERRS} -gt 0 ]
then
errpt | grep -v "IDENTIFIER" | head -${NEWERRS} | cut -c 42- |
while read ERRMSG
do
echo "errpt:${ERRMSG}" | /usr/bin/mailx -vs "`hostname`: errpt report" recipient@domain.com
done
fi

echo ${TOTALERRS} > /usr/local/bin/errpt.count

exit 0
-----------------------------------------------

No comments:

Post a Comment

 How to Enable Graphical Mode on Red Hat 7 he recommended way to enable graphical mode on RHEL  V7 is to install first following packages # ...