Video Screencast Help
Give us your opinion and win with Symantec! Please help us by taking this survey to tell us about your experience with Symantec Connect, so that we can continue to grow and improve.  Take the survey.

Report scripts

Created: 15 Jan 2010 • Updated: 21 May 2010 | 8 comments
Anth105's picture
This issue has been solved. See solution.

Hi All,

Anyone with any ideas on the following ?
I am trying to write a script to automate a report that will have the following details every forthnight ( 15 days).
Client name,  media server and the Sum of  Nb of files, kilobytes, volumes used. 

I know that bpimagelist command will generate some of the requested information but  the sum of  ( Nb of files, kilobytes, and volumes used) during that  period is a major detail I want in  this report.


Or if anyone has another report that can do all the above that would be great.


BTW,  NOM does not meet my need- Addition  info :  NBU 6.5.5  in  Solaris 10

Much appreciate your help

Anthony

Comments 8 CommentsJump to latest comment

quebek's picture

Hello
You can try something like this
bpimagelist -hoursago 360 -U -client client_name |awk '{file+=$4} {kb+=$5} END {print file" " kb}'

the above command will produce the report for last 15 days (24*15=360 hours) for client named client_name for files and kB backed up (all those whould be summed)

below command will gave you the used tapes for last 15 days for this client

bpimagelist -hoursago 360 -U -client client_name -media

having this for one client you can create a loop and use a file client_list where in this file you do have clients names line by line, ie:
for i in `cat client_list` ; do
echo $i
bpimagelist -hoursago 360 -U -client $i |awk '{file+=$4} {kb+=$5} END {print file" " kb}'
bpimagelist -hoursago 360 -U -client $i -media
echo "------------"
done

good luck

SOLUTION
Anth105's picture

Many thanks, Quebek

I will give it a go and let know the outcome

Anthony

Anth105's picture

Quebek;

.bpimagelist -hoursago 360 -U -client client_name |awk '{file+=$4} {kb+=$5} END {print file" " kb}'

 This script works fine except it does not print the sum of the files.

However this below command does generate the sum of the files.

/bpimagelist -hoursago 360 -U -client sapsbp |awk '{files+=$4}{kb+=$5} END {print files"" Files}'
8229

Any idea suggestion  ?

Anthony

Andy Welburn's picture

'cos when I tried it I got 2 values - 1 total number of files and 1 total number of kb.

e.g.
# bpimagelist -hoursago 360 -U -client myclient|awk '{file+=$4} {kb+=$5} END {print file" " kb}'
309009 1173412302

***EDIT***
Also, confirmed these values by running the command without the awk & manually adding the files/kb columns.

***EDIT #2***
Notice you have a leading . (period) on one command & a leading / on the other. I would check where you are trying to run the bpimagelist from & whether it is in your $PATH also.

# which bpimagelist
/opt/openv/netbackup/bin/admincmd/bpimagelist

***EDIT #3***
Sorry about this - you've changed your awk compared to quebeks - the second one where you have output has only printed total for file as you're removed the kb

Anth105's picture

I made the chages as per Andys mail  and re-run the script which works like a charm.

Many thanks for your help

Anthony

Andy Welburn's picture

If this has resolved your issue, can you please mark quebeks post as the solution as mine was just a copy of quebeks original.

Anth105's picture

Hi guys,

Could you help me to write this script output into a .cvs file.?

Many thanks

Anthony

Sriram's picture

You need a minor change:

for i in `cat clientlist`
do
echo "Client-Name,Media-Server,No.Files,Sizein-KB" >> /tmp/report.csv
MS=`bpimagelist -hoursago 360 -client $i -U -media |sed -n '3,$p' |awk '{print $4}'` >> /tmp/report.csv
FILESIZE="`bpimagelist -hoursago 48 -U -client <client> |awk '{file+=$4} {kb+=$5} END {print file"," kb}'`" >> /tmp/report.csv
echo $i","$MS","$FILESIZE >> /tmp/report.csv
done

try this you will get output in CSV format.