Here's my script for this, you can fuss with the output to get a spreadsheet
compatible format if you want.
#!/bin/ksh
MAILADDR=YOU AT YOURDOMAIN DOT COM
PATH=$PATH:/usr/openv/netbackup/bin/admincmd
OUT=/var/tmp/`basename $0`.out.$$
TMP=/var/tmp/`basename $0`.tmp.$$
shorthost=`hostname | cut -f1 -d'.'`
if [ -z "$1" ]
then
hours=24
else
hours=$1
fi
echo "## Backup totals by client for past $hours hours." >$OUT
# Generate client list - this strangness is to get a complete list
# bpimagelist is all clients even if now deleted but only if they have
images
# bpclclients is all current clients, even if they have no images
# The two together should be all clients
bpimagelist -hoursago $hours|awk '$1=="IMAGE" {print $2}' | sort -u >$TMP
bpclclients -allunique -noheader | awk '{print $3}' >>$TMP
sort -u -o $TMP $TMP
for client in `cat $TMP`
do
bpimagelist -hoursago $hours -client $client 2>/dev/null >$TMP
if [ `wc -l $TMP | awk '{print $1}` -eq 0 ]
then
echo "\n Null \t$client"
else
#lost of awk stuff to make pretty output, KB, MB, and GB.
awk 'BEGIN {sum=0;OFMT="%8.1f"}
{if ($1=="IMAGE") {sum=sum+$19}}
END { if (sum<1024) {
printf ("\n%9.1f KB\t%s\n",sum,"'$client'")
} else {
if (sum<1048576) {
printf ("\n%9.1f MB\t%s\n",sum/1024,"'$client'")
} else {
printf ("\n%9.1f GB\t%s\n",sum/1024/1024,"'$client'")
}}}' $TMP
#Subtotal per policy per client
for policy in `awk '$1=="IMAGE" {print $7}' $TMP | sort -u`
do
awk 'BEGIN {sum=0;OFMT="%8.1f"}
{if ($1=="IMAGE" && $7=="'$policy'" ) {sum=sum+$19}}
END { if (sum<1024) {
printf ("\t\t%9.1f KB\tP=%s\n",sum,"'$policy'")
} else {
if (sum<1048576) {
printf ("\t\t%9.1f MB\tP=%s\n",sum/1024,"'$policy'")
} else {
printf ("\t\t%9.1f GB\tP=%s\n",sum/1024/1024,"'$policy'")
}}}' $TMP
done
fi
done >>$OUT
if [ $hours -le 24 ]
then
time="${hours}hr"
else
days=`expr $hours / 24`
time="${days} days"
fi
mailx -s "NB $shorthost: Client Backup Totals: $time" $MAILADDR <$OUT
[ -f $TMP ] && rm -f $TMP
[ -f $OUT ] && rm -f $OUT
exit
-----Original Message-----
From: Siano, James C [mailto:james.c.siano AT lmco DOT com]
Sent: Thursday, March 18, 2004 10:02 AM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] How to get disk space usage per client exported to
spreadsheet
Hello.
I want to determine the disk space backed up per class of machine from a
given full.
Looking for a way to do that.
It would be great if I could get it to a spreadsheet (axles) to I could
manipulate the data.
Windows NT machines (year gig); Unix (yarded)
I've got NBU 4.5 with no fancy advance reporter add-ons.
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
|