Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

full backup size for a list of servers

Status
Not open for further replies.

bolobaboo

MIS
Aug 4, 2008
120
US
Hi
I have list of servers. Do anybody have script which i can run and it tells me their full backup size and how long they took ?
 
It won't be as helpful since you likely are running Windows, but this is something I put together:

bpimagelist -st full -A -d mm/dd/yyyy hh:mm:ss | nawk -f backuprpt.awk

backuprpt.awk
BEGIN {printf ("%-11s %-26s %-12s %-10s %-8s %-10s %-7s %-10s\n","Client","Policy", "Type", "Date", "Time", "Run Time", "MB", "# of Files");print "=======================================================
=================================================="}
/^Client:/{if ($2 ~ "[a-z]") client = index($2, ".") ? substr($2, 1, index($2, ".")-1) : $2; else client = $2}
/^Class:/||/^Policy:/{if ($2 ~ "[a-z]") class = index($2, ".") ? substr($2, 1, index($2, ".")-1) : $2; else class = $2}
/^Schedule Type:/{type = $3}
/^Backup Time:/{date = $3; time = $4}
/^Elapsed Time:/{elapsed = $3}
/^Kilobytes:/{$2=$2/1024; MB = $2; TMB+=$2}
/^Number of Files:/{files = $4; tfiles+=$4; printf ("%-11s %-26s %-12s %-7s %-6s %-10s %-7.0f %-10s\n", client, class, type, date, time, elapsed, MB, files)}

END {TGB=TMB/1024; printf "\n---------------------------------------------------------------------------------------------------\nTotals:\n\t\tSize:\t %.2f GB\t\n", TGB; printf "\t\tFiles:\t %d\n\n", tf
iles}
 
master server is on unix , can you put in KSH or perl ?
 
Hi
johngigis

one more favor. can you twick so i get one entry with largest size in backup size ?
example ..
gvpw128 000:10:34 1278
gvpw129 002:51:50 26798
gvpw129 000:10:23 1279
gvpw129 001:01:35 8163
gvpw129 000:08:06 1046
gvpw132 005:44:51 62332
gvpw132 000:40:38 5336
gvpw132 001:04:00 8309
gvpw132 000:10:27 1284

i need only
gvpw128 000:10:34 1278
gvpw129 002:51:50 26798
gvpw132 005:44:51 62332

Thank you very much
 
bolobaboo,

Sorry, my scripting isn't that great, so I'm not sure how to update the awk script to only print the largest record. If you just want size info, you can use something like this:

# Change the value of HOURSAGO below before running the script
HOURSAGO=24
sumtotkb=0
# list all clients
ls -1 $DBPATH/images |
while read client
do

# calculating sum of the kilobytes
sumkb=0
$BPPATH/bpimagelist -A -L -client $client -hoursago $HOURSAGO 2>/dev/null | grep "^Kilobytes" |
while read txt kb
do
let sumkb=${sumkb}+${kb}
done # calculating sum of kilobytes
# Make the output more human readable
outtxt="$sumkb kb"
echo "$sumkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
printf "%-40s %6s %2s\n" $client $outtxt
let sumtotkb=${sumtotkb}+${sumkb}
done # reading clients
outtxt="$sumtotkb kb"
echo "$sumtotkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
echo "$sumGB/1024" | bc -l | read sumTB
if [ $sumTB -gt 0 ]; then
printf "%7.2f %s" $sumTB "TB" | read outtxt
fi
printf "%-45s %6s %2s\n" "Total Amount" $outtxt

Hope that helps!

John
 
Sorry, I missed the first few lines of my copy and paste. Below is the full script:

#!/bin/ksh
BPPATH=/usr/openv/netbackup/bin/admincmd
DBPATH=/usr/openv/netbackup/db
# Change the value of HOURSAGO below before running the script
HOURSAGO=24
sumtotkb=0
# list all clients
ls -1 $DBPATH/images |
while read client
do

# calculating sum of the kilobytes
sumkb=0
$BPPATH/bpimagelist -A -L -client $client -hoursago $HOURSAGO 2>/dev/null | grep
"^Kilobytes" |
while read txt kb
do
let sumkb=${sumkb}+${kb}
done # calculating sum of kilobytes
# Make the output more human readable
outtxt="$sumkb kb"
echo "$sumkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
printf "%-40s %6s %2s\n" $client $outtxt
let sumtotkb=${sumtotkb}+${sumkb}
done # reading clients
outtxt="$sumtotkb kb"
echo "$sumtotkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
echo "$sumGB/1024" | bc -l | read sumTB
if [ $sumTB -gt 0 ]; then
printf "%7.2f %s" $sumTB "TB" | read outtxt
fi
printf "%-45s %6s %2s\n" "Total Amount" $outtxt


John
 
Hi
Johngigs
It seems you did not get my point ...my question to your awk script ...if i have ran multiple full backup for same client ..then how to print just one entry per client and also print only that entry whcih is largest in size .
 
bolobaboo,

I understood the question, but I'm not sure how to handle that condition with awk. I know it's possible, but I don't know/recall how.

If you post the script in the awk forum someone can probably get you the info you need pretty easily.

Thanks,

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top