03-04-2009 12:01 AM
I need to add a script which will generate a report at specified time with status of all the clients backup with Status code (All servers which are currently running & which are completed/failed). I can configured it by using bperror command. But, It doesn't list the server names which are running at script schedule time.
Do anyone have suggestions of command by which I can get Backup status of each server (Running client servers + completed Backup servers) by status code... or any other way.
My main concern is I should get a running backup server list in addition to completed/failed client backup.
Your suggestions are highly appreciated.
Solved! Go to Solution.
03-09-2009 03:57 AM
Sangore wrote:
"bpimagelist list doesn't work with active backup. But, bpdbjobs -report will work with some extent but, the Problem is, it interacts with job database & show all server list that are in database active / completed. I don't find any option by which I can specify like -hoursago 24 or -d mm/dd/yyyy -e mm/dd/yyyy
Is there any suggestion on this?"
I think you're going to have to use bpimagelist or bperror to get your info on completed jobs for whatever time-period and then parse the output from bpdbjobs to show Active or Queued jobs at the time that the script was run.
03-04-2009 01:01 AM
bperror you say you've already tried.
Have you looked at bpdbjobs ?
e.g. bpdbjobs -report shows those jobs currently queued or running (as per Activity Monitor?)
03-04-2009 06:20 AM
bpimagelist -U -client $CLIENTNAME -hoursago 24 (or however many hours you want to go back)
you can also use
bpimagelist -U -client $CLIENTNAME -d mm/dd/yyyy -e mm/dd/yyyy
03-05-2009 07:07 AM
Yes ! Andy is Correct !
You can get the Current status of Backup and restore jobs using bpdbjobs.
03-06-2009 04:49 AM
Thanks for your response,
bpimagelist list doesn't work with active backup. But, bpdbjobs -report will work with some extent but, the Problem is, it interacts with job database & show all server list that are in database active / completed. I don't find any option by which I can specify like -hoursago 24 or -d mm/dd/yyyy -e mm/dd/yyyy
Is there any suggestion on this?
03-06-2009 04:25 PM
I have a perl example that might start you down the right path. This script monitors a job id and emails out an hourly report until the job is complete. While it is not exactly what you are looking for, some key lines in it might assist with you parsing the bpdbjobs output and then only printing out the last 24hours based on some time match logic.
#!/usr/bin/perl
$jobnum = "1178415";
$subject = "Netbackup_Hourly_Job_Monitor_Status";
$master = "masterservername";
@emails = ('username@email.com');
$num = "0";
while($num ne "3"){
$output = `/usr/openv/netbackup/bin/admincmd/bpdbjobs -report -M $master -gdm -jobid $jobnum`;
($jobid,$jobtype,$state,$status,$class,$sched,$client,$server,$start,$elapsed,$end,$j1,$j2,$j3,$j4,$j5,$kilobytes,$j6,$j7) =
split (',',$output);
$gigabytes = ($kilobytes/1024)/1024;
$gigabytes = sprintf("%0.2f",$gigabytes);
$helapse = ($elapsed/60)/60;
$helapse = sprintf("%0.2f",$helapse);
sjobtype();
sjobstate();
open FILE, ">/tmp/NJMS.tmp";
print FILE " Client: $client \n";
close (FILE);
open FILE, ">>/tmp/NJMS.tmp";
print FILE " Media Server: $server \n";
print FILE " Job State: $rstate \n";
print FILE " Job Type: $rjobtype \n";
print FILE " Elapsed Time (hrs): $helapse\n";
print FILE " Gigabytes: $gigabytes\n";
close (FILE);
mailit();
$num = "$state";
sleep(3600);
}
exit;
sub sjobtype {
if ($jobtype eq "0") {
$rjobtype = "Backup";
} elsif ($jobtype eq "1") {
$rjobtype = "Archive";
} elsif ($jobtype eq "2") {
$rjobtype = "Restore";
} elsif ($jobtype eq "3") {
$rjobtype = "Verify";
} elsif ($jobtype eq "4") {
$rjobtype = "Duplication";
} elsif ($jobtype eq "5") {
$rjobtype = "Import";
} elsif ($jobtype eq "6") {
$rjobtype = "DBBackup";
} elsif ($jobtype eq "7") {
$rjobtype = "Vault";
} else {
$rjobtype = "Unknown";
}
}
sub sjobstate {
if ($state eq "0") {
$rstate = "Queued";
} elsif ($state eq "1") {
$rstate = "Active";
} elsif ($state eq "2") {
$rstate = "Requested";
} elsif ($state eq "3") {
$rstate = "Done";
} else {
$rstate = "Unknown";
}
}
sub mailit {
foreach $emails (@emails) {
$mailit = `/usr/bin/mailx -s $subject $emails < /tmp/NJMS.tmp`;
}
}
03-09-2009 03:57 AM
Sangore wrote:
"bpimagelist list doesn't work with active backup. But, bpdbjobs -report will work with some extent but, the Problem is, it interacts with job database & show all server list that are in database active / completed. I don't find any option by which I can specify like -hoursago 24 or -d mm/dd/yyyy -e mm/dd/yyyy
Is there any suggestion on this?"
I think you're going to have to use bpimagelist or bperror to get your info on completed jobs for whatever time-period and then parse the output from bpdbjobs to show Active or Queued jobs at the time that the script was run.