AIX Tip of the Week

AIX Tip of the Week: Error Notification Facility

Audience: AIX Administrators

Date: July 9, 1999

AIX's Error Notification Facility is a useful systems management tool. This facility can be configured to send alerts (via email, pager, etc) when a specific** hardware or software problem appears in the error log. This allows administrators to quickly address, and possibly prevent, problems that could affect system availability. See the AIX documentation for information on configuring the Error Notification Facility.

The error_notice.htm attachment is a copy of the AIX documentation in HTML format. The pager attachment is a shell script that sends a digital page. It can be used in conjunction with the Error Notification Facility.



"pager" Shell Script


#! /bin/ksh
#  Pager:  send digital page via the "cu" command.
#  modified...Bruce Spencer 7/15/97
#
#       Prerequisites
#       1.  A tty be defined to AIX:
#           Create the tty with "smitty tty".  Set "Enable Login"
#           to either "share" or "disable"
#
#       2.  Install AIX BNU (also known as UUCP)
# 	    It's on the base AIX CD.
#
#       3.  Define the tty to the BNU dialer program by adding
#           the following line to /usr/lib/uucp/Devices
#
#           Direct tty2 - 9600 direct   # tty2 = your tty modem line
#
#       The script outputs "cu" commands, which control the modem.
#	The sleep command provides the necessary delays between modem commands.
#
#
# USAGE:
#       pager phone_number pager_number [code]
#
# 	where:
#		phone_number = telephone number of the pager
#		pager_number = PIN number,option number, etc...
#		[code]	     = optional field for your message code 		
#		
# EXAMPLE:
#       pager 9,1-800-555-7243 123456 2001
#
###########################################
#
# Parameters to modify for your environment
#
DEVICE=/dev/tty0   # Modem device over which to place the call
#
# Define CU options
# see cu(1) man page for options
#
CU_OPTS="-l${DEVICE} -m"
#
#
# File to log errors and calls to.  Use /dev/null to ignore
#
LOG=/tmp/${0##*/}.log
# LOG=/dev/null
###########################################

if [ $# -eq 3 ]; then
    CODE="$3"
elif [ $# -ne 2 ]; then
    echo "usage: ${0##*/} phone pager [code]" >&2
    echo "       phone: phone number to dial" >&2
    echo "       pager: pager id" >&2
    echo "       code: optional display code for pager" >&2
    exit 1
else
    CODE=0000
fi
PHONE="$1"
PAGER="$2"

# Put the following commands inside of curley braces so we can
# pipe the output to cu.  Redirect stdout and stderr of cu to /dev/null, since
# we really don't care much about the progress of the call
{
    #
    # Log the call
    #
    echo "\n`date`\nDialing ${PHONE} pager ${PAGER} code ${CODE}" >> $LOG

    #
    # Be sure we have the modem's attention by sending it
    # the AT command twich
    #
    echo "AT"
    echo "AT"
    sleep 1

    #
    # Output commands to dial paging system, to enter pager number, and to
    # enter callback number.
    # As is typical with the "AT" dial set, commas separate the commands
    # with a short pause.  Add several pauses after dialing to be sure
    # we have gotten through the phone system
    #

    echo "ATDT${PHONE},,,,,,${PAGER}#,,${CODE}##\n"

    # Wait long enough for modem to complete call, and then output command to
    # terminate the cu executable.

    sleep 30
    echo "~."
  } | cu ${CU_OPTS} >> $LOG 2>&1