Cover V06, I02
Article
Listing 1
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6
Listing 7
Listing 8

feb97.tar


Listing 1: mon_error

#!/bin/sh
#
# mon_err
#
# This script generates alarms as indicates by the command line
# arguments.
# it is intended to be called by the "monitoring" tools.
#
# This script expects two arguments:
#
#    1) A keyword, "WARN", "SEVERE", "CRITICAL", or "FATAL"
#
#    2) A character string to be used during the notification process
#
#####################################

MAIL="/usr/bin/mailx"          # Mail utility to use
ADMINS="root"                  # Whitespace-delimited list of Admins
ADMINS_PGR="123@pager.company" # E-mail address for Admins' pagers
MGR_PGR="456@pager.company"    # E-mail address for Manager's pager

if [ $# -lt 2 ]; then
echo "Usage: $0 ALARM_LVL ALARM_STRING"
exit
else
case "$1" in
"WARN")
logger -p daemon.err "$2"
;;
"SEVERE")
$MAIL -s "$2" $ADMINS
;;
"CRITICAL")
$MAIL -s "$2" $ADMINS_PGR
;;
"FATAL")
$MAIL -s "$2" $MGR_PGR $ADMINS_PGR
;;
*)    echo "Usage: $0 ALARM_LVL ALARM_STRING"
exit
;;
esac
fi

# End of File