[Veritas-bu] Script to check backups were successful
2003-12-04 12:05:17
Wouldn't it be easier to be silent about successful jobs and alert on failed
jobs?
Try this, it's a daily problems report that gives you quick breakdown by
error code above and detailed errors by server below. I run it every day at
the same time via cron.
-M
#!/bin/ksh
PATH=$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/local
TMPFILE=/var/tmp/`basename $0`.tmp.$$
TMPFILE2=/var/tmp/`basename $0`.tmp2.$$
LOGDIR=/usr/openv/netbackup/logs
LOGFILE=$LOGDIR/`basename $0`.errlog
SHORTHOST=`hostname | cut -f1 -d'.'`
MAILADDR=you AT yourdomain DOT com
cols=72
hours=24
if [ -n "$1" ]
then
if [ $1 -gt 0 ]
then
hours=$1
else
echo "Usage: `basename $0` [hours]"
exit 1
fi
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]*$/) {
count=0
while ( ++count <= NF ) {print $count}}}' | 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
for recip in $MAILADDR ; do
cat $TMPFILE | mailx -s "NB $SHORTHOST ${hours}hr Rpt:Problems Report"
$MAILADDR
done
fi
mv $TMPFILE $LOGFILE
exit
-----Original Message-----
From: Paul Porcelli [mailto:Paul.Porcelli AT aggreko DOT biz]
Sent: Thursday, December 04, 2003 4:01 AM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] Script to check backups were successful
> Hi folks,
> at the moment we are manually checking each backup job via the jnbSA GUI
> to verify that each backup was successful. We go through the Activity
Monitor
> and double click each backup and then check the detailed status.
>
> Rather than go through the manual check, I would prefer to script this and
flag any
> issues via email.
> Can someone recommend the most appropriate commands and/or which log files
I need
> to check.
>
> Thanks again.
> ==
> Paul Porcelli
> Senior Unix Administrator
> Aggreko (UK) Ltd
> Global Technology Centre
>
Visit us at www.aggreko.com
________________________________________________________________________
Confidentiality Notice: This communication and any accompanying
attachments contain confidential information intended for a specific
individual and purpose. This communication is private and protected
by law. If you are not the intended recipient, you are hereby
respectfully notified that any disclosures, copying, forwarding or
distribution, or the taking of any action based on the contents of
this communication is strictly prohibited.
________________________________________________________________________
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
|
|
|