I am a newbie to netbackup, and my current experience in 2 Months. I
have small written perl scripts. Go thru these and you are welcome to
modify and post it back with better comments. I am not saying these
are best perl scripts. First one gives you the list of media used by a
particular backup_id and second one will give you which path was
backed up which backup_id.
============
hostname#cat imagereport.pl
#!/bin/perl
#
# A quick hack to display backups and media
# in a little readable format
# Can be used to find out which media can be removed
#
#
%totalmedia = ();
open(fileIN,"bpimmedia -d 01/01/1970|") or die("Cannot run bpimmedia : $!");
@logData = <fileIN>;
close(fileIN);
$arraySize=@logData;
$i = 0;
if ( $logData[$i] =~ /^IMAGE/ ){
%media = ();
@images=split(' ',$logData[$i]);
$i++;
}
while ( $i < $arraySize ) {
if ( $logData[$i] =~ /^FRAG/ ) {
@frags = split(' ',$logData[$i]);
#print "$frags[8], $frags[3]\n";
$media{$frags[8]}+=$frags[3];
}
elsif ( $logData[$i] =~ /^IMAGE/ ){
@backid=split('_',$images[3]);
$mydate = localtime($backid[1]);
#@imagevol=split(' ',`bpflist -d 01/01/1970 -backupid $images[3]
-client $images[1] -l | head -2|tail -1`);
print
"$mydate:$imagevol[9]:$images[3]:$images[4]:$images[6]:$images[9]:$images[1]";
for my $mediaid ( sort keys %media ) {
$sizeOnTape = $media{$mediaid}/(1024*1024);
$mediaused = $mediaused.":".$mediaid;
#printf "%.2f", $sizeOnTape;
$totalmedia{$mediaid}++;
}
print ":$mediaused\n";
$mediaused="";
%media = ();
@images=split(' ',$logData[$i]);
}
$i++;
}
@backid=split('_',$images[3]);
$mydate = localtime($backid[1]);
print "$mydate:$images[3]:$images[4]:$images[6]:$images[9]";
for my $mediaid ( sort keys %media ) {
$sizeOnTape = $media{$mediaid}/(1024*1024);
$mediaused = $mediaused.":".$mediaid;
#printf "%.2f", $sizeOnTape;
}
print ":$mediaused\n";
$mediaused="";
%media = ();
@images=split(' ',$logData[$i]);
$estimate=scalar keys %totalmedia;
print " \n\n=======================================\n";
print " Total number of tapes used: $estimate\n";
print " =======================================\n";
============
===============
#!/bin/perl
#
# Small Reporting utility
#
#
open(fileIN,"bpimmedia -d 01/01/1970|grep '^IMAGE'|") or die("Cannot
open ims, Please run bpimmedia : $!");
@tmplogData = <fileIN>;
close(fileIN);
my @logData = sort byDate @tmplogData;
sub byDate {
#
#
#IMAGE client 7 shooter_1111125908 shooter 19 full 0 10 13 2147483647 0 0
#
#
@recordA= split(/ /,$a);
($dmy,$dateA)=split('_',$recordA[3]);
@recordB= split(/ /,$b);
($dmy,$dateB)=split('_',$recordB[3]);
return ($dateB <=> $dateA);
}
$arraySize=@logData;
$i = 0;
while ( $i < $arraySize ) {
@images=split(' ',$logData[$i]);
@backid=split('_',$images[3]);
$mydate = localtime($backid[1]);
@imagevol=split(' ',`bpflist -d 01/01/1970 -backupid $images[3]
-client $images[1] -l | head -2|tail -1`);
print "$mydate,$images[1],$imagevol[9],$images[6]\n";
@images=split(' ',$logData[$i]);
$i++;
}
============
On 4/19/05, David Rock <dave-bu AT graniteweb DOT com> wrote:
> * Kevin Freels <KFreels AT askjeeves DOT com> [2005-04-18 09:38]:
> > Greetings!!
> >
> > I have more or less asked this question before. I looked through my
> > archives, but I didn't really find the answer I was looking for.
> >
> > I want to have NB email the "details" of each individual backup job when
> > it completes to the admin email address. By this, I mean the same stuff
> > you would see if you went to the Activity Monitor and did a "details" on
> > any of the completed jobs. What I need is the ability to see what media
> > were used for what job so I can create a report each morning about what
> > tapes were used (by job/host) and need to be rotated out of the robot
> > (for off-site archives). I would also settle for individual emails from
> > each job (I could pipe that to a file and form my own "report" if
> > needed).
> >
> > I looked through all the logs under netbackup/logs and really didn't see
> > anything separated by job ID. I imagine that bpend_notify can be
> > used/altered to do this, but where is the individual job ID info/history
> > kept? Is that actually under the db directory (didn't see anything
> > there)?
> >
> > I'm wondering if bpdbjobs would be able to do this, but it seems to me
> > that command just lists the processes, not the details. Has anyone done
> > anything like this? I can parse out the detail info using perl if I have
> > to, but I'm really lazy and don't like to re-invent the wheel. :-)
>
> bpdbjobs can list ALL the details;
> bpdbjobs -all_columns
>
> Here is a decent link to help you get the jist of how the file is put
> together, including a couple coding examples of what to do with it. It's
> getting a little dated, but still a good read. Mine is the python one at
> the end.
>
> http://www.backupcentral.com/foms/netbackup-serve/cache/194.html
>
> The 5.x manual has a similar description of the fields, although not
> exactly complete on every field.
>
> --
> David Rock
> david AT graniteweb DOT com
>
>
>
|