cancel
Showing results for 
Search instead for 
Did you mean: 

how to use backup_exit_notify

kkhoo
Level 5

hi gurus,

i have input conditions in backup_exit_notify.

i run some backup that will fail.

but am not getting any email notification.

please advise.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Genericus
Moderator
Moderator
   VIP   

Here is my email distribution listing: (sorry winders people )

## I exclude notification on some error codes ($5), and I name ALL my Oracle child schedules, Child.Job, so I only get emails from the Parent.($3)

if [ $5 != 0 -a $5 != 1 -a $5 != 71 -a $5 != 150 -a $5 != 800 -a $5 != 191 -a $3 != "Child.Job" ]
then
        if /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep MS-Window
        then
                cat $OUTF | /usr/bin/mailx -s "WINDOWS NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com windows@company.com
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep MS-Exchange
        then
                cat $OUTF | /usr/bin/mailx -s "EXCHANGE NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com windows@company.com
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep VMWARE
        then
                cat $OUTF | /usr/bin/mailx -s "VMWARE NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com windows@companys.com
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep MS-SQL
        then
                cat $OUTF | /usr/bin/mailx -s "MS-SQL NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com windows@company.com dba@company.com
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep Oracle
        then
                cat $OUTF | /usr/bin/mailx -s "ORACLE NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com dba@company.com unix@company.com 
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep Sybase
        then
                cat $OUTF | /usr/bin/mailx -s "SYBASE NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com dba@company.com unix@company.com 
        else
                cat $OUTF | /usr/bin/mailx -s "UNIX NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com unix@company.com 
        fi
fi

NetBackup 8.3.0.1 on Solaris 11, writing to Data Domain 9800 6.2.1.0
duplicating via SLP to LTO5 in SL8500 via ACSLS

View solution in original post

10 REPLIES 10

sdo
Moderator
Moderator
Partner    VIP    Certified

Please show us your script?

Have you added a command to actually send the email?

kkhoo
Level 5

hi sdo,

yes. i think the problem is my script/ condition.

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

NBUDIR="/usr/openv/netbackup/"
LOGDIR="/usr/openv/netbackup/logs/"

mailtodb='myemailadd'

# ----------------------------------------------

# exit not equal 0
# ----------------------------------------------
if [ "$5" -gt 1  &&  "$3" -eq db ]
then
        echo "${1} $0 ${dateStr} $*" | mailx -s "WARNING FROM `hostname -s` ${1} $0 ${dateStr} $*" -r "`hostname -s`" ${mailtodb}
fi

 

 

please advise...

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

Is 'mailx' on your backup server working?

Can you use mailx on cmd to send a test email?

Is the $OUTF created?

Genericus
Moderator
Moderator
   VIP   

What version are you on? Current versions have 8 ( EIGHT ) inputs, I just upgraded and what I ended updoing was essentially running the script manually, like :(path to binary)/backup_exit_notify 1 2 3 4 5 6 7 8 

It should run cleanly. If not you should see the error right away.

 

They did not change any of the existing inputs, they just added additional ones.

From the script I have:

# This script:
#       receives 8 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
#         DONE_TRYING      - 0=will retry, 1=done, will not retry.
#         PRIMARY_JOBID    - the jobid for this job
#       must be executable by the root user
#       should exit with 0 upon successful completion
 

NetBackup 8.3.0.1 on Solaris 11, writing to Data Domain 9800 6.2.1.0
duplicating via SLP to LTO5 in SL8500 via ACSLS

kkhoo
Level 5

thanks Marianne and Genericus,

Email is coming now.

However, we wanted to filter out the "Policy Type".

If it is standard backup... should trigger mail to sysadmins

If it is oracle... trigger mail to dba

Can this be done?

kkhoo
Level 5

Hi Genericus, version is 6.5

revarooo
Level 6
Employee

Set an if condition on $4 (Policy type) to then email the correct people.

 

sdo
Moderator
Moderator
Partner    VIP    Certified

I think you need to use the policy name.

Something like:

bppllist $2 | awk for field that is the policy type... and use an if to decide what to do based upon the policy type.

Genericus
Moderator
Moderator
   VIP   

Here is my email distribution listing: (sorry winders people )

## I exclude notification on some error codes ($5), and I name ALL my Oracle child schedules, Child.Job, so I only get emails from the Parent.($3)

if [ $5 != 0 -a $5 != 1 -a $5 != 71 -a $5 != 150 -a $5 != 800 -a $5 != 191 -a $3 != "Child.Job" ]
then
        if /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep MS-Window
        then
                cat $OUTF | /usr/bin/mailx -s "WINDOWS NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com windows@company.com
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep MS-Exchange
        then
                cat $OUTF | /usr/bin/mailx -s "EXCHANGE NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com windows@company.com
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep VMWARE
        then
                cat $OUTF | /usr/bin/mailx -s "VMWARE NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com windows@companys.com
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep MS-SQL
        then
                cat $OUTF | /usr/bin/mailx -s "MS-SQL NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com windows@company.com dba@company.com
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep Oracle
        then
                cat $OUTF | /usr/bin/mailx -s "ORACLE NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com dba@company.com unix@company.com 
        elif /usr/openv/netbackup/bin/admincmd/bppllist $2 -U | grep "Policy Type" | grep Sybase
        then
                cat $OUTF | /usr/bin/mailx -s "SYBASE NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com dba@company.com unix@company.com 
        else
                cat $OUTF | /usr/bin/mailx -s "UNIX NetBackup Error Status $5, Policy $2, Client $1" \
                operations@company.com unix@company.com 
        fi
fi

NetBackup 8.3.0.1 on Solaris 11, writing to Data Domain 9800 6.2.1.0
duplicating via SLP to LTO5 in SL8500 via ACSLS

kkhoo
Level 5

thanks everyone!