02-29-2016 11:06 PM
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.
Solved! Go to Solution.
03-03-2016 08:20 AM
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
02-29-2016 11:36 PM
Please show us your script?
Have you added a command to actually send the email?
02-29-2016 11:45 PM
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...
03-01-2016 06:28 AM
Is 'mailx' on your backup server working?
Can you use mailx on cmd to send a test email?
Is the $OUTF created?
03-01-2016 07:23 AM
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
03-03-2016 01:39 AM
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?
03-03-2016 01:39 AM
Hi Genericus, version is 6.5
03-03-2016 02:24 AM
Set an if condition on $4 (Policy type) to then email the correct people.
03-03-2016 05:32 AM
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.
03-03-2016 08:20 AM
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
03-06-2016 11:04 PM
thanks everyone!