[Veritas-bu] Scripting with bperror
2002-12-29 12:02:20
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C2AF5C.0CFE7550
Content-Type: text/plain;
charset="iso-8859-1"
One concern is that bperror is more of a historical reporting tool. If you
want a message for when you fail on a per job basis, you'd be better looking
at a script written in /usr/openv/netbackup/bin/backup_exit_notify. I also
have a script that produces daily reports run via cron. I'll send that as a
separate message as I often bump into the 20K list limit.
Here my modified backup_exit_notify script:
$ cat backup_exit_notify
#!/bin/sh
# $Header: backup_notify,v 1.0 2002/01/22 1l:44:00 integ Exp $
# Modified by Mark Donaldson for Experian 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.log
MAILADDR=YOU AT YOURDOMAIN DOT COM
PATH=$PATH:/usr/openv/netbackup/bin/admincmd
export PATH
echo "`date +%D_%T` $*" | sed 's/ *$//' | tr -s ' ' ',' >>$LOGFILE
CLIENT=$1
CLASS=$2
SCHEDULE=$3
SCHEDULE_TYPE=$4
STATUS=$5
STREAM=$6
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: John.Kenny AT trw DOT com [mailto:John.Kenny AT trw DOT com]
Sent: Tuesday, December 24, 2002 10:39 AM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] Scripting with bperror
I am new to Netbackup. I am also new to Unix. This is a double whammy since
my Master Server is Unix based. Can anyone help me with a script to email
notification when a backup job ends with an error ?
I looked at adding an address to the global properties on the Master Server,
but that will send ALL status messages. I only want the jobs that end with
an error.
------_=_NextPart_001_01C2AF5C.0CFE7550
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [Veritas-bu] Scripting with bperror</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>One concern is that bperror is more of a historical =
reporting tool. If you want a message for when you fail on a per =
job basis, you'd be better looking at a script written in =
/usr/openv/netbackup/bin/backup_exit_notify. I also have a script =
that produces daily reports run via cron. I'll send that as a =
separate message as I often bump into the 20K list limit.</FONT></P>
<P><FONT SIZE=3D2>Here my modified backup_exit_notify script:</FONT>
</P>
<P><FONT SIZE=3D2>$ cat backup_exit_notify</FONT>
<BR><FONT SIZE=3D2>#!/bin/sh</FONT>
<BR><FONT SIZE=3D2># $Header: backup_notify,v 1.0 2002/01/22 1l:44:00 =
integ Exp $</FONT>
</P>
<P><FONT SIZE=3D2># Modified by Mark Donaldson for Experian =
10/2002</FONT>
<BR><FONT SIZE=3D2>#</FONT>
<BR><FONT SIZE=3D2># backup_notify</FONT>
<BR><FONT SIZE=3D2>#</FONT>
<BR><FONT SIZE=3D2># NOTE: this script will always be run in =
"background" mode, meaning that</FONT>
<BR><FONT SIZE=3D2># the =
NetBackup scheduler will NOT wait for it's completion.</FONT>
<BR><FONT SIZE=3D2>#</FONT>
<BR><FONT SIZE=3D2># This script:</FONT>
<BR><FONT SIZE=3D2># receives 5 =
parameters:</FONT>
<BR><FONT SIZE=3D2># =
CLIENT - =
the client hostname</FONT>
<BR><FONT SIZE=3D2># =
CLASS =
- the class label</FONT>
<BR><FONT SIZE=3D2># =
SCHEDULE - the schedule =
label</FONT>
<BR><FONT SIZE=3D2># =
SCHEDULE_TYPE - the type of schedule: FULL INCR =
UBAK UARC</FONT>
<BR><FONT SIZE=3D2># =
STATUS - =
the backup status for this job</FONT>
<BR><FONT SIZE=3D2># =
STREAM - =
the backup stream number for this job</FONT>
<BR><FONT SIZE=3D2># must be =
executable by the root user</FONT>
<BR><FONT SIZE=3D2># should exit =
with 0 upon successful completion</FONT>
</P>
<P><FONT =
SIZE=3D2>LOGFILE=3D/usr/openv/netbackup/logs/history.log</FONT>
<BR><FONT SIZE=3D2>MAILADDR=3DYOU AT YOURDOMAIN DOT COM</FONT>
</P>
<P><FONT SIZE=3D2>PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd</FONT>
<BR><FONT SIZE=3D2>export PATH</FONT>
</P>
<P><FONT SIZE=3D2>echo "`date +%D_%T` $*" | sed 's/ =
*$//' | tr -s ' ' ',' >>$LOGFILE</FONT>
</P>
<P><FONT SIZE=3D2> =
CLIENT=3D$1</FONT>
<BR><FONT SIZE=3D2> =
CLASS=3D$2</FONT>
<BR><FONT SIZE=3D2> SCHEDULE=3D$3</FONT>
<BR><FONT SIZE=3D2>SCHEDULE_TYPE=3D$4</FONT>
<BR><FONT SIZE=3D2> =
STATUS=3D$5</FONT>
<BR><FONT SIZE=3D2> =
STREAM=3D$6</FONT>
</P>
<P><FONT SIZE=3D2>shortclient=3D`echo $CLIENT| cut -f1-2 -d'.'`</FONT>
<BR><FONT SIZE=3D2>shorthost=3D`hostname | cut -f1 -d.`</FONT>
<BR><FONT SIZE=3D2>subjectline=3D"NB $shorthost:$shortclient =
RC=3D$STATUS $CLASS:$SCHEDULE"</FONT>
</P>
<P><FONT SIZE=3D2>if [ $STATUS -gt 0 ]</FONT>
<BR><FONT SIZE=3D2>then</FONT>
<BR><FONT SIZE=3D2> mailx -s "$subjectline" $MAILADDR =
<<-EOF</FONT>
<BR><FONT SIZE=3D2> Date=3D`date`</FONT>
<BR><FONT SIZE=3D2> Client=3D$CLIENT</FONT>
<BR><FONT SIZE=3D2> Class=3D$CLASS</FONT>
<BR><FONT SIZE=3D2> Schedule=3D$SCHEDULE</FONT>
<BR><FONT SIZE=3D2>Sched type=3D$SCHEDULE_TYPE</FONT>
<BR><FONT SIZE=3D2> Status=3D$STATUS</FONT>
<BR><FONT SIZE=3D2> Stream=3D$STREAM</FONT>
</P>
<P><FONT SIZE=3D2>Error Description:</FONT>
<BR><FONT SIZE=3D2>`bperror -S $STATUS -r`</FONT>
<BR><FONT SIZE=3D2>EOF</FONT>
<BR><FONT SIZE=3D2>fi</FONT>
</P>
<P><FONT SIZE=3D2>exit</FONT>
</P>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: John.Kenny AT trw DOT com [<A =
HREF=3D"mailto:John.Kenny AT trw DOT com">mailto:John.Kenny AT trw DOT
com</A>]</FONT>=
<BR><FONT SIZE=3D2>Sent: Tuesday, December 24, 2002 10:39 AM</FONT>
<BR><FONT SIZE=3D2>To: veritas-bu AT mailman.eng.auburn DOT edu</FONT>
<BR><FONT SIZE=3D2>Subject: [Veritas-bu] Scripting with bperror</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>I am new to Netbackup. I am also new to Unix. This is =
a double whammy since my Master Server is Unix based. Can anyone help =
me with a script to email notification when a backup job ends with an =
error ?</FONT></P>
<P><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>I looked at adding an address to the global =
properties on the Master Server, but that will send ALL status =
messages. I only want the jobs that end with an error.</FONT></P>
<P><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C2AF5C.0CFE7550--
|
|
|