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_01C52B13.6D7421AC
Content-Type: text/plain;
charset="iso-8859-1"
There's been some interest in this but the posting, thanks to Exchange,
wraps poorly. Here's two scripts as attachments. The first is the script
below, with a minor variation to print KB, MB, & GB as appropriate. I just
threw this together as a response to the posting.
The second, larger script is my more comprehensive daily script. It
defaults to 24 hours but will accept a number of hours to report as a
command-line parameter. It has three sections, backup totals for the entire
period, then per client totals with policies broken out below each client
total. Finally, there's a policy totals section for those who have many
clients per policy.
Just change the MAILADDR variable in the big script to what you want. I run
it daily by cron, 24-hour reporting daily with a 72-hour report on Monday
morning to give me the weekend totals.
Good luck!
-M
-----Original Message-----
From: veritas-bu-admin AT mailman.eng.auburn DOT edu
Here's a quick and dirty script to sum every client over the past 24 hours:
#!/bin/ksh
PATH=$PATH:/usr/openv/netbackup/bin/admincmd
for client in `bpplclients -allunique -noheader | awk '{print $3}'`
do
bpimagelist -client $client -hoursago 24 -l | \
awk 'BEGIN {sum=0}
{if ($1=="IMAGE"){sum=sum+$19}}
END {printf("%20s %10d KB\n","'$client'",sum)}'
done
exit
Bah! Reporting products? That's what "awk" is for! :-)
-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
carrd AT ijet DOT com
Sent: Wednesday, March 16, 2005 1:43 PM
Cc: veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] NB script that show size of data backed up
I was just looking for a daily tally.
-----Original Message-----
From: Ed Wilts [mailto:ewilts AT ewilts DOT org]
Sent: Wednesday, March 16, 2005 3:41 PM
To: David Carr
Cc: veritas-bu AT mailman.eng.auburn DOT edu
Subject: Re: [Veritas-bu] NB script that show size of data backed up
On Wed, Mar 16, 2005 at 02:44:13PM -0500, carrd AT ijet DOT com wrote:
> I am looking for a script that shows the size of the data backed up per
client. We are using NetBackup 4.5 on Solaris master with Windows, Linux and
Solaris clients.
NetBackup does a pretty poor job of reporting out of the box, and
depending on what kind of time period you're looking at, it won't do it
at all.
We went with a 3rd party reporting product that gives us excellent
reporting functionality over wide user-defined time periods. Management
loves the pretty pictures and techies love looking at the raw growth
numbers (grouped by whatever whatever you want/need).
http://www.aptare.com
.../Ed
--
Ed Wilts, Mounds View, MN, USA
mailto:ewilts AT ewilts DOT org
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
------_=_NextPart_000_01C52B13.6D7421AC
Content-Type: application/octet-stream;
name="totals.sh"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="totals.sh"
#!/bin/ksh=0A=
=0A=
PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd=0A=
=0A=
for client in `bpplclients -allunique -noheader | awk '{print $3}'`=0A=
do=0A=
bpimagelist -client $client -hoursago 24 -l 2>/dev/null| \=0A=
awk 'BEGIN {sum=3D0}=0A=
{if ($1=3D=3D"IMAGE"){sum=3Dsum+$19}}=0A=
END {if(sum<10000){printf("%20s %10.1f =
KB\n","'$client'",sum)}else=0A=
{if(sum<10000000){printf("%20s %10.1f =
MB\n","'$client'",sum/1024)}else=0A=
{printf("%20s %10.1f GB\n","'$client'",sum/1024/1024)}}=0A=
}'=0A=
done=0A=
------_=_NextPart_000_01C52B13.6D7421AC
Content-Type: application/octet-stream;
name="rpt_backup_totals.sh"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="rpt_backup_totals.sh"
#!/bin/ksh=0A=
=0A=
PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/local=0A=
OUTFILE=3D/var/tmp/`basename $0`.$$.out=0A=
TMPFILE1=3D/var/tmp/`basename $0`.$$.tmp1=0A=
TMPFILE2=3D/var/tmp/`basename $0`.$$.tmp2=0A=
LOGFILE=3D/usr/openv/netbackup/logs/`basename $0`.errlog=0A=
=0A=
MAILADDR=3D"Netbackup.Reports"=0A=
=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=
echo "## Report Start: `date` for past $hours hours." >$OUTFILE=0A=
exec >>$OUTFILE 2>&1=0A=
=0A=
bpimagelist -hoursago $hours | awk '$1=3D=3D"IMAGE" {print $6,$7,$19}' =
| sort -u >$TMPFILE1=0A=
=0A=
echo "\n## General Statistics"=0A=
=0A=
awk 'BEGIN {nj=3D0;sum=3D0}=0A=
{nj++ ; sum=3Dsum+($3/1024)}=0A=
END {printf("\tTotal Backup Jobs: %d\n",nj)=0A=
if (sum<1024) { printf("\tTotal Volume: %.1f =
GB\n",sum/1024)}=0A=
else {printf("\tTotal Volume: %.2f TB\n",sum/1024/1024)}}' =
$TMPFILE1=0A=
=0A=
echo "\n## Backup totals by client" =0A=
=0A=
for client in `bpplclients -allunique -noheader|awk '{print $3}'|sort =
`=0A=
do=0A=
awk 'BEGIN {sum=3D0;OFMT=3D"%8.1f";print}=0A=
{if ($1~/^'$client'_/) {sum=3Dsum+$3}}=0A=
END { if (sum=3D=3D0) {printf("%s =3D null\n","'$client'")} else =
{=0A=
if (sum<1024) {=0A=
printf("%s =3D %.1f KB\n","'$client'",sum)=0A=
} else {=0A=
if (sum<1048576) {=0A=
printf("%s =3D %.1f MB\n","'$client'",sum/1024)=0A=
} else {=0A=
printf("%s =3D %.1f GB\n","'$client'",sum/1024/1024)=0A=
}}}}' $TMPFILE1=0A=
=0A=
for policy in `awk '$1~/^'$client'_/ {print $2}' $TMPFILE1 | sort =
-u`=0A=
do=0A=
awk 'BEGIN {nj=3D0;sum=3D0;OFMT=3D"%8.1f"}=0A=
{if ($1~/^'$client'_/ && $2=3D=3D"'$policy'" ) =
{sum=3Dsum+$3;nj++}}=0A=
END { if (sum<1024) {=0A=
printf ("\t:%24s %6.1f KB (%d =
jobs)\n","'$policy'",sum,nj)=0A=
} else {=0A=
if (sum<1048576) {=0A=
printf ("\t:%24s %6.1f MB (%d =
jobs)\n","'$policy'",sum/1024,nj)=0A=
} else {=0A=
printf ("\t:%24s %6.1f GB (%d =
jobs)\n","'$policy'",sum/1024/1024,nj)=0A=
}}}' $TMPFILE1=0A=
done =0A=
done=0A=
=0A=
echo "\n\n## Backup totals by policy"=0A=
for policy in `bppllist`=0A=
do=0A=
awk 'BEGIN {sum=3D0;OFMT=3D"%8.1f"}=0A=
{if ($2=3D=3D"'$policy'" ) {sum=3Dsum+$3}}=0A=
END { if (sum<1024) {=0A=
printf ("%24s: %8.1f KB\n","'$policy'",sum)=0A=
} else {=0A=
if (sum<1048576) {=0A=
printf ("%24s: %8.1f MB\n","'$policy'",sum/1024)=0A=
} else {=0A=
printf ("%24s: %8.1f GB\n","'$policy'",sum/1024/1024)=0A=
}}}' $TMPFILE1=0A=
done=0A=
=0A=
=0A=
=0A=
echo "\n## Report Complete" =0A=
echo "## Report Generated by \"$0\"." =0A=
=0A=
mailx -s "NB Rpt: ${hours}hr Backup Totals" $MAILADDR <$OUTFILE=0A=
cp $OUTFILE /usr/openv/netbackup/logs/`basename $0`.lastrun=0A=
=0A=
[ -f $OUTFILE ] && rm -f $OUTFILE=0A=
[ -f $TMPFILE1 ] && rm -f $TMPFILE1=0A=
[ -f $TMPFILE2 ] && rm -f $TMPFILE2=0A=
exit=0A=
------_=_NextPart_000_01C52B13.6D7421AC--
|