Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Failed Backup Notification..

Status
Not open for further replies.

Dorga

MIS
Jul 30, 2003
101
0
0
NZ
Does NB offer any way to send email on only failed backups?
 
Use the bpend_notify script located in /installpath/netbackup/bin/goodies directory.
 
You can set up "Adminitrator Email" on Server's "Global Netbackup Atributes" and set "Server Sends Email" on all client's "Universal Settings".

If you have NBU server on Windows you will also need to edit "install_path\NetBackup\bin\nbmail.cmd" to configure a email sender program.

You will get email for failed jobs from all clients and also for Sucessull Catalog Backups.

The bpend_notify script is also an option as said "comtec17".
 
I did something similar to what comtec17 said.

I modified /usr/openv/netbackup/bin/backup_exit_notify and now its working.. I didnt want anything except failed to send to this email because its a pager..

thanks =)
 
Hi Dorga,

me too looking for same notifications...can u send me that
script..so i can check where u made changes...so i can try on it...
could u pls. send me that script to madhutrack@yahoo.com if you can.

tks...Madhu
 
madhutrack1,

/installpath/netbackup/bin/backup_exit_notify is the script in question, you just need to modify it at the bottom.

Here is a cut and paste of my script.

#! /bin/sh
# $Header: /ovsrc/int/CVS/src/nb/tools/backup_exit_notify.sh,v 1.2 2002/11/20 02:10:35 $

#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2003 VERITAS Software 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
# --------------------------------------------------------------------

if [ "$#" -lt 6 ]
then
echo `date` "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 `date` "-----------------------------" >> $OUTF
echo `date` " CLIENT: $1" >> $OUTF
echo `date` " POLICY: $2" >> $OUTF
echo `date` " SCHEDULE: $3" >> $OUTF
echo `date` "SCHEDULE TYPE: $4" >> $OUTF
echo `date` " STATUS: $5" >> $OUTF
echo `date` " STREAM: $6" >> $OUTF
echo `date` "-----------------------------" >> $OUTF

#
# might want to mail this info to someone
# usually nobody wants to see status' 0 or 1

if [ "$5" -gt 1 ]; then
cat $OUTF | mailx -s "Backup Failure on $1 State $5!" you@yourdomain.com,yourpager@paging.pager.com
fi

exit 0
 
If anyone is looking to send notification for failed backups on NT/2000 systems, you need to put something like this line in your script (changes are necessary depending on mail client, I used BLAT):

if /i %5 GTR 1 call %NB_MAIL_SCRIPT% you@yourdomain.com "Backup failure on %1 status %5" %OUTF%
 
Does anyone have this script for Windows 2000 Server. The script above seems to be for a UNIX system. I tried adding line "michaylukr" suggested to the backup_exit_notify script and I did not receive messages for failed backups.....Not sure why my scripts is not working.....I am using blat and I can get it to send emails for EVERY backup job, but I only want it for failed jobs....
 
The following is the full text of the script we use - remember, we're modifying backup_exit_notify.cmd here. The only change to the stock script is the line that I had posted earlier. You'll find it at the end of the script. Note that command extensions must be enabled - the script includes instructions on how to do that.

------------------------------------------------------------

@REM
@REM $Header: /ovsrc/int/CVS/src/nb/tools/backup_exit_notify.cmd,v 1.2 2002/11/20 02:10:34 $
@REM
@REM bcpyrght
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 1993 - 2002 VERITAS Software Corporation, All Rights Reserved $ *
@REM ***************************************************************************
@REM ecpyrght
@REM
@REM backup_exit_notify.cmd
@REM
@REM This script is called by the NetBackup scheduler, after an individual
@REM client backup has completed (including media closure and image db
@REM validation.
@REM
@REM NOTE: this script will always be run in "background" mode, meaning that
@REM the NetBackup scheduler will NOT wait for it's completion.
@REM
@REM This script:
@REM receives 5 parameters:
@REM %1 = CLIENT - the client hostname
@REM %2 = POLICY - the policy label
@REM %3 = SCHEDULE - the schedule label
@REM %4 = SCHEDULE_TYPE - the type of schedule: FULL INCR UBAK
@REM UARC
@REM %5 = STATUS - the backup status for this job
@REM %6 = STREAM - the backup stream number for this job
@REM
@REM - Main program ------------------------------------------------------------
@REM -
@REM - This script only runs on NT 4.0 and succeeding versions of NT. You must
@REM - have command extensions enabled. Check the following registry entry:
@REM -
@REM - HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions
@REM -
@REM - It should be set to 0x1 or you may have problems running this script.
@REM ---------------------------------------------------------------------------
@setlocal ENABLEEXTENSIONS
@set LISTPATHS="%~dp0\goodies\listpaths"
@for /F "delims=|" %%p in ('%LISTPATHS% /s NB_MAIL_SCRIPT') do @set NB_MAIL_SCRIPT="%%p"
@set OUTF="%~dp0\BACKUP_EXIT_CALLED"
@REM ---------------------------------------------------------------------------
@REM - Get date and time.
@REM ---------------------------------------------------------------------------
@for /F "tokens=1*" %%p in ('date /T') do @set DATE=%%p %%q
@for /F %%p in ('time /T') do @set DATE=%DATE% %%p
@REM ---------------------------------------------------------------------------
@REM - Check for proper parameter use.
@REM ---------------------------------------------------------------------------
@REM @if "%6" == "" goto BadParams
@REM @if "%7" == "" goto GoodParams
@REM :BadParams
@REM @echo %DATE% backup_exit_notify expects 6 parameters: %* >> %OUTF%
@REM @goto EndMain
@REM :GoodParams
@REM ---------------------------------------------------------------------------
@REM - You may want to delete the output file elsewhere in order to
@REM - accumulate successful backup information. If so, delete the
@REM - following line or move it to where it will do the most good.
@REM ---------------------------------------------------------------------------
@if exist %OUTF% del %OUTF%
@REM ---------------------------------------------------------------------------
@echo %DATE% ----------------------------- >> %OUTF%
@echo %DATE% CLIENT: %1 >> %OUTF%
@echo %DATE% POLICY: %2 >> %OUTF%
@echo %DATE% SCHEDULE: %3 >> %OUTF%
@echo %DATE% SCHEDULE TYPE: %4 >> %OUTF%
@echo %DATE% STATUS: %5 >> %OUTF%
@echo %DATE% STREAM: %6 >> %OUTF%
@echo %DATE% ----------------------------- >> %OUTF%
@REM ---------------------------------------------------------------------------
@REM - might want to mail this info to someone
@REM - usually nobody wants to see status 0 or 1
if /i %5 GEQ 2 call %NB_MAIL_SCRIPT% you@yourdomain.com "Backup failure on %1 status %5" %OUTF%
@REM ---------------------------------------------------------------------------
:EndMain
@endlocal
@REM - End of Main Program -----------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top