[Veritas-bu] Job Monitoring
2003-11-05 11:33:07
You can do this with a "backup_exit_notify" script on the master server.
Here's mine, only slightly modified from the default one that comes with NB.
It could be modified to mail different places based on day/time, etc. pretty
easily...
$ cat backup_exit_notify
#!/bin/sh
# $Header: backup_notify,v 1.0 2002/01/22 1l:44:00 integ Exp $
# Modified by Mark Donaldson 10/2002
#
# backup_notify
#
# NOTE: this script will always be run in "background" mode, meaning that
# the NetBackup scheduler will NOT wait for it's completion.
#
# This script:
# receives 5 parameters:
# CLIENT - the client hostname
# CLASS - the class label
# SCHEDULE - the schedule label
# SCHEDULE_TYPE - the type of schedule: FULL INCR UBAK UARC
# STATUS - the backup status for this job
# STREAM - the backup stream number for this job
# must be executable by the root user
# should exit with 0 upon successful completion
LOGFILE=/usr/openv/netbackup/logs/history.`date +%Y`.log
CONFFILE=/usr/openv/netbackup/bin/`basename $0`.conf
MAILADDR= you AT yourdomain DOT com
PATH=$PATH:/usr/openv/netbackup/bin:/usr/openv/volmgr/bin:/usr/local/bin
PATH=$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/local
export PATH
echo "`date +%D_%T` $*" | sed 's/ *$//' | tr -s ' ' ',' >>$LOGFILE
CLIENT=$1
CLASS=$2
SCHEDULE=$3
SCHEDULE_TYPE=$4
STATUS=$5
STREAM=$6
if [ -f $CONFFILE ]
then
for addr in `awk '{ if ($1=="'$CLASS':'$SCHEDULE'" || $1=="'$CLASS':*")
{fld=2; while (fld<=NF) { print $fld++ }}}' $CONFFILE`
do
MAILADDR="$MAILADDR $addr"
done
fi
shortclient=`echo $CLIENT| cut -f1-2 -d'.'`
shorthost=`hostname | cut -f1 -d.`
subjectline="NB $shorthost:$shortclient RC=$STATUS $CLASS:$SCHEDULE"
if [ $STATUS -gt 0 ]
then
mailx -s "$subjectline" $MAILADDR <<-EOF
Date=`date`
Client=$CLIENT
Class=$CLASS
Schedule=$SCHEDULE
Sched type=$SCHEDULE_TYPE
Status=$STATUS
Stream=$STREAM
Error Description:
`bperror -S $STATUS -r`
EOF
fi
exit
-----Original Message-----
From: Macauley, David (Contractor) (DLIS) [mailto:David.Macauley AT dla DOT mil]
Sent: Wednesday, November 05, 2003 8:16 AM
To: Bu? (veritas-bu AT mailman.eng.auburn DOT edu)
Subject: [Veritas-bu] Job Monitoring
Is there a way to have Netbackup 3.4 send an e-mail whenever a backup fails?
We have just gone 24/7 on our help desk, and the powers that be want them to
be able to notify someone when an over-night (scheduled or not) backup
fails.
TIA,
Dave Macauley
Veritas Admin
NGIT/DLIS
|
|
|