backups

How do I set up NetBackup to page me when a backup fails?

If you want to be notified when a backup fails, you can edit your backup_exit_notify script.

By default, the backup_exit_notify script does not send any notifications, however with a few minor tweaks you can set it up to alert you. Below is the unmodified script in it’s entirety.

#! /bin/sh
# $Header: backup_exit_notify.sh,v 1.4 2005/10/18 14:50:27 $

#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 – 2007 Symantec Corporation, All Rights Reserved $ *
#***************************************************************************
#ecpyrght

#
# backup_exit_notify.sh
#
# This script is called by the NetBackup scheduler, after an individual
# client backup has completed (including media closure and image db validation.
#
# 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
# POLICY – the policy 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

OUTF=/usr/openv/netbackup/bin/BACKUP_EXIT_CALLED

# ——————————————————————–
# main script starts here
# ——————————————————————–

umask 022

dateStr=`date`
if [ “$#” -lt 6 ]
then
echo ${dateStr} “backup_exit_notify expects at least 6 parameters: $*” >> $OUTF
exit 1
fi

# You may want to delete the output file elsewhere in order to
# accumulate successful backup information.
# If so, comment out the following 4 lines.
if [ -s $OUTF ]
then
/bin/rm -rf $OUTF
fi

if [ ! -f $OUTF ]
then
touch $OUTF
fi

echo ${dateStr} “—————————–” >> $OUTF
echo ${dateStr} ” CLIENT: $1″ >> $OUTF
echo ${dateStr} ” POLICY: $2″ >> $OUTF
echo ${dateStr} ” SCHEDULE: $3″ >> $OUTF
echo ${dateStr} “SCHEDULE TYPE: $4″ >> $OUTF
echo ${dateStr} ” STATUS: $5″ >> $OUTF
echo ${dateStr} ” STREAM: $6″ >> $OUTF
echo ${dateStr} “—————————–” >> $OUTF

#
# might want to mail this info to someone
#
# cat $OUTF | mail -s “NetBackup backup exit” someone_who_cares

exit 0

For example, if you want to be paged when you receive a status code 129 (Disk storage unit is full).

To do so you would need to add a few lines before the “exit 0” line.

if [ “$5” -eq “129” ]
then
mailx -s “Backup on $1 – $5” mypager@mydomain.com < $OUTF fi If you wanted to get emails for status code 0 and status code 1 and page on everything else, you could do this: if [ "$5" -eq "0" ] || [ "$5" -eq "1" ] then mailx -s "Backup on $1 - $5" nbuadmins@mydomain.com < $OUTF else mailx -s "Backup on $1 - $5" nbuadmins_pager@mydomain.com < $OUTF fi

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top