[Veritas-bu] Daily batch of status notifications? NB 3.4
2002-10-28 12:15:58
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_01C27EA5.AE698610
Content-Type: text/plain
Here's a script I use that mails two reports each morning covering the
previous 24 hours run. It summarizes media errors & backup errors.
The script looks like this, there's an example output example below that...
$ cat auto_reports
#!/bin/ksh
MAILADDR=YOU AT YOURDOMAIN DOT COM
PATH=$PATH:/usr/openv/netbackup/bin/admincmd
TMPFILE=/var/tmp/`basename $0`.tmp.$$
cols=92
hours=24
bperror -columns $cols -U -media -hoursago $hours | \
awk 'BEGIN {set=0 }
{ if ( $0~/media id [0-9][0-9][0-9][0-9][0-9][0-9] removed from media/ )
{
set=1
remline=$0 }
else {
if ( set==0 ) {
print }
else {
set=0
if ( $0!~/expired/ ) {
print remline
print $0 }
}
}
}' >$TMPFILE
if [ `wc -l $TMPFILE | awk '{print $1}'` -gt 1 ] ; then
mailx -s "NB ${hours}hr Rpt:Media Report" $MAILADDR <$TMPFILE
fi
echo "## Problem Summary..." >$TMPFILE
bperror -columns $cols -U -backstat -by_statcode -hoursago $hours | \
awk 'BEGIN {switch=0}
{if ( $1>0 && $1~/^[0-9][0-9]*$/ ) {switch=1}
if ( switch==1 ) {
if ( $1~/^[0-9][0-9]*$/ ) {print}
else {
count=0
while ( ++count <= NF ) { print "\t\t" $count }
}
}
}' >>$TMPFILE
svrlist=`bperror -columns $cols -U -backstat -by_statcode -hoursago $hours |
\
awk 'BEGIN {switch=0}
{if ( $1>0 && $1~/^[0-9][0-9]*$/ ) {switch=1}
if ( switch==1 && $1!~/^[0-9][0-9]*$/) {print} }' | sort -u`
echo "\n## Problem Detail by server..." >>$TMPFILE
for each in $svrlist
do
echo "\n## Client: $each" >>$TMPFILE
bperror -client $each -columns $cols -U -problems -hoursago $hours
>>$TMPFILE
done
if [ `egrep -vc "^ *$|^#" $TMPFILE` -gt 0 ] ; then
mailx -s "NB ${hours}hr Rpt:Problems Report" $MAILADDR <$TMPFILE
fi
[ -f $TMPFILE ] && rm -f $TMPFILE
exit
#############
Report sample 1 (Error Code summary)
## Problem Summary...
41 network connection timed out
dev00.devel.in.exactis.com
senderx1.prod.in.exactis.com
54 timed out connecting to client
inbound00.lodo.exactis.com
## Problem Detail by server...
## Client: dev00.devel.in.exactis.com
TIME SERVER/CLIENT TEXT
10/27/2002 18:08:14 backup00.lodo.in.infobeat.com dev00.devel.in.exactis.com
backup of
client dev00.devel.in.exactis.com exited with status 41
(network
connection timed out)
## Client: senderx1.prod.in.exactis.com
TIME SERVER/CLIENT TEXT
10/27/2002 19:09:18 backup00.lodo.in.infobeat.com
senderx1.prod.in.exactis.com backup of
client senderx1.prod.in.exactis.com exited with status
41 (network
connection timed out)
## Client: inbound00.lodo.exactis.com
TIME SERVER/CLIENT TEXT
10/27/2002 18:04:07 backup00 inbound00.lodo.exactis.com timed out trying to
connect to
inbound00.lodo.exactis.com
10/27/2002 18:04:08 backup00.lodo.in.infobeat.com inbound00.lodo.exactis.com
backup of
client inbound00.lodo.exactis.com exited with status 54
(timed out
connecting to client)
######################3
Report sample 2 (Media error summary)
TIME SERVER/CLIENT TEXT
10/13/2002 08:16:55 backup00.lodo.in.infobeat.com
backup00.lodo.in.exactis.com ioctl
(MTWEOF) failed on media id 000093, drive index 3, I/O
error
(bptm.c.14706)
10/13/2002 08:16:55 backup00.lodo.in.infobeat.com
backup00.lodo.in.exactis.com FROZE media
id 000093, could not write tape mark to begin new image
###################
HTH - Mark
-----Original Message-----
From: Browne, Alexander (Alec) [mailto:abrowne AT tigr DOT org]
Sent: Friday, October 25, 2002 2:25 PM
To: 'veritas-bu AT mailman.eng.auburn DOT edu'
Subject: [Veritas-bu] Daily batch of status notifications? NB 3.4
We use a notification setup whereby an email is sent out for each non-zero
exit status job that completes. This tends to fill up the inbox. Is there
a way to send one email a day with a list of the exit status codes for the
previous night's backups? This idea is partly inspired by the option on
this mailing list to get messages in a batch.
Thanks!
------_=_NextPart_001_01C27EA5.AE698610
Content-Type: text/html
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=3DUS-ASCII">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [Veritas-bu] Daily batch of status notifications? NB =
3.4</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>Here's a script I use that mails two reports each =
morning covering the previous 24 hours run. It summarizes media =
errors & backup errors.</FONT></P>
<P><FONT SIZE=3D2>The script looks like this, there's an example output =
example below that...</FONT>
</P>
<P><FONT SIZE=3D2>$ cat auto_reports</FONT>
<BR><FONT SIZE=3D2>#!/bin/ksh</FONT>
</P>
<P><FONT SIZE=3D2>MAILADDR=3DYOU AT YOURDOMAIN DOT COM</FONT>
<BR><FONT =
SIZE=3D2>PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd</FONT>
<BR><FONT SIZE=3D2>TMPFILE=3D/var/tmp/`basename $0`.tmp.$$</FONT>
</P>
<P><FONT SIZE=3D2>cols=3D92</FONT>
<BR><FONT SIZE=3D2>hours=3D24</FONT>
</P>
<P><FONT SIZE=3D2>bperror -columns $cols -U -media -hoursago $hours | =
\</FONT>
<BR><FONT SIZE=3D2> awk 'BEGIN {set=3D0 }</FONT>
<BR><FONT SIZE=3D2> { if ( $0~/media id =
[0-9][0-9][0-9][0-9][0-9][0-9] removed from media/ ) {</FONT>
<BR><FONT SIZE=3D2> =
set=3D1</FONT>
<BR><FONT SIZE=3D2> =
remline=3D$0 }</FONT>
<BR><FONT SIZE=3D2> else {</FONT>
<BR><FONT SIZE=3D2> if ( =
set=3D=3D0 ) {</FONT>
<BR><FONT =
SIZE=3D2> print =
}</FONT>
<BR><FONT SIZE=3D2> =
else {</FONT>
<BR><FONT =
SIZE=3D2> =
set=3D0</FONT>
<BR><FONT =
SIZE=3D2> if ( =
$0!~/expired/ ) {</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; print remline</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; print $0 }</FONT>
<BR><FONT SIZE=3D2> }</FONT>
<BR><FONT SIZE=3D2> }</FONT>
<BR><FONT SIZE=3D2> }' >$TMPFILE</FONT>
</P>
<P><FONT SIZE=3D2>if [ `wc -l $TMPFILE | awk '{print $1}'` -gt 1 ] ; =
then</FONT>
<BR><FONT SIZE=3D2> mailx -s "NB =
${hours}hr Rpt:Media Report" $MAILADDR <$TMPFILE</FONT>
<BR><FONT SIZE=3D2>fi</FONT>
</P>
<P><FONT SIZE=3D2>echo "## Problem Summary..." =
>$TMPFILE</FONT>
<BR><FONT SIZE=3D2>bperror -columns $cols -U -backstat -by_statcode =
-hoursago $hours | \</FONT>
<BR><FONT SIZE=3D2> awk 'BEGIN =
{switch=3D0}</FONT>
<BR><FONT =
SIZE=3D2> {if ( =
$1>0 && $1~/^[0-9][0-9]*$/ ) {switch=3D1}</FONT>
<BR><FONT =
SIZE=3D2> =
if ( switch=3D=3D1 ) {</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; if ( $1~/^[0-9][0-9]*$/ ) {print}</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; else {</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; count=3D0</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; while ( ++count <=3D NF ) { print =
"\t\t" $count }</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; }</FONT>
<BR><FONT =
SIZE=3D2> =
}</FONT>
<BR><FONT =
SIZE=3D2> }' =
>>$TMPFILE</FONT>
</P>
<P><FONT SIZE=3D2>svrlist=3D`bperror -columns $cols -U -backstat =
-by_statcode -hoursago $hours | \</FONT>
<BR><FONT SIZE=3D2> awk 'BEGIN =
{switch=3D0}</FONT>
<BR><FONT =
SIZE=3D2> {if ( =
$1>0 && $1~/^[0-9][0-9]*$/ ) {switch=3D1}</FONT>
<BR><FONT =
SIZE=3D2> =
if ( switch=3D=3D1 && $1!~/^[0-9][0-9]*$/) {print} }' | sort =
-u`</FONT>
</P>
<P><FONT SIZE=3D2>echo "\n## Problem Detail by server..." =
>>$TMPFILE</FONT>
<BR><FONT SIZE=3D2>for each in $svrlist</FONT>
<BR><FONT SIZE=3D2>do</FONT>
<BR><FONT SIZE=3D2> echo "\n## Client: $each" =
>>$TMPFILE</FONT>
<BR><FONT SIZE=3D2> bperror -client $each -columns $cols -U =
-problems -hoursago $hours >>$TMPFILE</FONT>
<BR><FONT SIZE=3D2>done</FONT>
</P>
<P><FONT SIZE=3D2>if [ `egrep -vc "^ *$|^#" $TMPFILE` -gt 0 ] =
; then</FONT>
<BR><FONT SIZE=3D2> mailx -s "NB ${hours}hr Rpt:Problems =
Report" $MAILADDR <$TMPFILE</FONT>
<BR><FONT SIZE=3D2>fi</FONT>
</P>
<P><FONT SIZE=3D2>[ -f $TMPFILE ] && rm -f $TMPFILE</FONT>
<BR><FONT SIZE=3D2>exit</FONT>
</P>
<P><FONT SIZE=3D2>#############</FONT>
<BR><FONT SIZE=3D2>Report sample 1 (Error Code summary)</FONT>
</P>
<P><FONT SIZE=3D2>## Problem Summary...</FONT>
<BR><FONT SIZE=3D2> 41 network connection timed =
out</FONT>
<BR> =
<FONT =
SIZE=3D2>dev00.devel.in.exactis.com</FONT>
<BR> =
<FONT =
SIZE=3D2>senderx1.prod.in.exactis.com</FONT>
<BR><FONT SIZE=3D2> 54 timed out connecting to =
client</FONT>
<BR> =
<FONT =
SIZE=3D2>inbound00.lodo.exactis.com</FONT>
</P>
<P><FONT SIZE=3D2>## Problem Detail by server...</FONT>
</P>
<P><FONT SIZE=3D2>## Client: dev00.devel.in.exactis.com</FONT>
<BR><FONT SIZE=3D2> =
TIME =
SERVER/CLIENT  =
; =
TEXT</FONT>
<BR><FONT SIZE=3D2>10/27/2002 18:08:14 backup00.lodo.in.infobeat.com =
dev00.devel.in.exactis.com backup of</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; client =
dev00.devel.in.exactis.com exited with status 41 (network</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; connection timed =
out)</FONT>
</P>
<P><FONT SIZE=3D2>## Client: senderx1.prod.in.exactis.com</FONT>
<BR><FONT SIZE=3D2> =
TIME =
SERVER/CLIENT  =
; =
TEXT</FONT>
<BR><FONT SIZE=3D2>10/27/2002 19:09:18 backup00.lodo.in.infobeat.com =
senderx1.prod.in.exactis.com backup of</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; client =
senderx1.prod.in.exactis.com exited with status 41 (network</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; connection timed =
out)</FONT>
</P>
<P><FONT SIZE=3D2>## Client: inbound00.lodo.exactis.com</FONT>
<BR><FONT SIZE=3D2> =
TIME =
SERVER/CLIENT  =
; =
TEXT</FONT>
<BR><FONT SIZE=3D2>10/27/2002 18:04:07 backup00 =
inbound00.lodo.exactis.com timed out trying to connect to</FONT>
<BR><FONT SIZE=3D2>  =
; =
inbound00.lodo.exactis.com</FONT>
<BR><FONT SIZE=3D2>10/27/2002 18:04:08 backup00.lodo.in.infobeat.com =
inbound00.lodo.exactis.com backup of</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; client =
inbound00.lodo.exactis.com exited with status 54 (timed out</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; connecting to =
client)</FONT>
</P>
<P><FONT SIZE=3D2>######################3</FONT>
<BR><FONT SIZE=3D2>Report sample 2 (Media error summary)</FONT>
</P>
<P><FONT SIZE=3D2> =
TIME =
SERVER/CLIENT  =
; =
TEXT</FONT>
<BR><FONT SIZE=3D2>10/13/2002 08:16:55 backup00.lodo.in.infobeat.com =
backup00.lodo.in.exactis.com ioctl</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; (MTWEOF) failed on =
media id 000093, drive index 3, I/O error</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; =
(bptm.c.14706)</FONT>
<BR><FONT SIZE=3D2>10/13/2002 08:16:55 backup00.lodo.in.infobeat.com =
backup00.lodo.in.exactis.com FROZE media</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; id 000093, could =
not write tape mark to begin new image</FONT>
<BR><FONT SIZE=3D2>###################</FONT>
</P>
<P><FONT SIZE=3D2>HTH - Mark</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Browne, Alexander (Alec) [<A =
HREF=3D"mailto:abrowne AT tigr DOT org">mailto:abrowne AT tigr DOT
org</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Friday, October 25, 2002 2:25 PM</FONT>
<BR><FONT SIZE=3D2>To: 'veritas-bu AT mailman.eng.auburn DOT edu'</FONT>
<BR><FONT SIZE=3D2>Subject: [Veritas-bu] Daily batch of status =
notifications? NB 3.4</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>We use a notification setup whereby an email is sent =
out for each non-zero exit status job that completes. This tends =
to fill up the inbox. Is there a way to send one email a day with =
a list of the exit status codes for the previous night's backups? =
This idea is partly inspired by the option on this mailing list to get =
messages in a batch.</FONT></P>
<P><FONT SIZE=3D2>Thanks!</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C27EA5.AE698610--
|
|
|