[Veritas-bu] Looking for a script
2005-11-09 18:05:24
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_000_01C5E581.E7EF44E4
Content-Type: text/plain;
charset="iso-8859-1"
Here's mine - I run it daily via cron. Summarizes errorcode at top and
detailed report per server below. Change the email address at top.
-M
-----Original Message-----
From: veritas-bu-admin AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-admin AT mailman.eng.auburn DOT edu]On Behalf Of Major, Rusty
Sent: Wednesday, November 09, 2005 2:40 PM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] Looking for a script
Does anyone have a script already written that will poll the jobs db and
pull out any jobs that are either failed or not completed and put them in a
text file? Just don't want to reinvent the wheel if I don't have to.
Thanks,
Rusty Major, MCSE, BCFP
Data Assurance Engineer
(281) 584-4693
VeriCenter, Inc.
------_=_NextPart_000_01C5E581.E7EF44E4
Content-Type: application/octet-stream;
name="problems_report"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="problems_report"
#!/bin/ksh=0A=
=0A=
PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/local=0A=
OUTFILE=3D/var/tmp/`basename $0`.$$.out=0A=
=0A=
MAILADDR=3D"Netbackup.Reports"=0A=
=0A=
cols=3D92=0A=
hours=3D24=0A=
=0A=
if [ -n "$1" ] =0A=
then=0A=
if [ $1 -gt 0 ]=0A=
then=0A=
hours=3D$1=0A=
else=0A=
echo "Usage: `basename $0` [hours]"=0A=
exit 1=0A=
fi=0A=
fi=0A=
=0A=
echo "## Problem Summary..." >$OUTFILE=0A=
bperror -columns $cols -U -backstat -by_statcode -hoursago $hours | =
\=0A=
awk 'BEGIN {switch=3D0}=0A=
{if ( $1>0 && $1~/^[0-9][0-9]*$/ ) {switch=3D1}=0A=
if ( switch=3D=3D1 ) {=0A=
if ( $1~/^[0-9][0-9]*$/ ) {print}=0A=
else {=0A=
count=3D0=0A=
while ( ++count <=3D NF ) { print "\t\t" $count }=0A=
}=0A=
}=0A=
}' >>$OUTFILE=0A=
=0A=
svrlist=3D`bperror -columns $cols -U -backstat -by_statcode -hoursago =
$hours | \=0A=
awk 'BEGIN {switch=3D0}=0A=
{if ( $1>0 && $1~/^[0-9][0-9]*$/ ) {switch=3D1}=0A=
if ( switch=3D=3D1 && $1!~/^[0-9][0-9]*$/) {=0A=
count=3D0 =0A=
while ( ++count <=3D NF ) {print $count}}}' | sort -u`=0A=
=0A=
echo "\n## Problem Detail by server..." >>$OUTFILE=0A=
for each in $svrlist=0A=
do=0A=
echo "\n## Client: $each" >>$OUTFILE=0A=
bperror -client $each -columns $cols -U -problems -hoursago $hours =
>>$OUTFILE=0A=
done=0A=
=0A=
cp $OUTFILE /usr/openv/netbackup/logs/scripts/problems.rpt.lastrun=0A=
if [ `egrep -vc "^ *$|^#" $OUTFILE` -gt 0 ] ; then=0A=
for recip in $MAILADDR ; do=0A=
mailx -s "NB Rpt: ${hours}hr Rpt:Problems Report" $MAILADDR =
<$OUTFILE=0A=
done=0A=
fi=0A=
=0A=
[ -f $OUTFILE ] && rm -f $OUTFILE=0A=
exit=0A=
------_=_NextPart_000_01C5E581.E7EF44E4--
|
|
|