cancel
Showing results for 
Search instead for 
Did you mean: 

How can I acquire the current status of Client servers backup through command line.

Sangore
Level 3

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.

1 ACCEPTED SOLUTION

Accepted Solutions

Andy_Welburn
Level 6

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.

 

View solution in original post

6 REPLIES 6

Andy_Welburn
Level 6

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?)

 

 

Stumpr2
Level 6

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

 

Karthikeyan_Sun
Level 6

 Yes ! Andy is Correct !

You can get the Current status of Backup and restore jobs using bpdbjobs.

Sangore
Level 3

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?

schmaustech
Level 5

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`;
        }
}
 

Andy_Welburn
Level 6

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.