Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

AIX Commands

How can errpt automatically inform me of a problem on the system? by bi
Posted: 13 Sep 02

This script was written by bjverzal of the AIX Tek-Tips forum. It is a very useful script that you can set to kick off each time the system boots.

It runs the command errpt, counts the number of errors in the report and saves the number to a file. Then it sleeps for five minutes. When it runs again, it compares the number of errors from the previous time and sends an email to whomever you designate with the full error report (the same output you get when you type errpt -a).

You will have to set up "alert" in the /etc/aliases file so the system knows where to send the email. (Be sure to run newaliases after you make the change to /etc/aliases.)

Here is the script:

#! /bin/ksh
# $0 = errmon.sh
# Written 11/3/1998 Bill Verzal.
# This script will run every [interval] and check the error log
# for new entries.  Upon finding them, it will send an email to
# administrators containing a message indicating the change
# in errlog status, as well as the offending lines.
if [ "$1" = "-v" ] ; then
   set -x
# lc="last count"
# tc="this count"
# Divide interval by 60 to get number of minutes.
me="$0 - Hardware error monitoring"

echo "$me started.\nThis message goes to $mailto." | mail -s "Errlog monitoring for $myname" $mailto
logger "$0 started"

while [ "$true" != "$false" ] ; do
   tc=`errpt -dH,S,U,O | wc -l`
   if [ "$lc" = "NULL" ] ; then
   if [ "$lc" -ne "$tc" ] ; then
      foo=`echo "$tc-$lc"|bc`
      msg="$foo new errors have been found on $myname"
      page_msg="$foo new errors have been found on $myname"
      errlogl=`errpt -dH,S,U,O -a`
      if [ "$tc" -eq "0" ] ; then
         msg="$msg\n Errlog was cleared"
         logger $msg
         msg=" $msg \n Errlog details below:\n $errlogl \n"
         echo "$msg" | mail -s "Errlog status change on host $myname" $mailto
   sleep $interval

Back to IBM: AIX FAQ Index
Back to IBM: AIX Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close