cancel
Showing results for 
Search instead for 
Did you mean: 

CLI commands for specific backup information

JARKUS
Level 2

Hello,

First I apologize if this theme was already discussed, but I did not found anything was helped me.

I am trying to find out CLI command which would give me for <client>:

1. jobid's -jobs which already finished, failed, completed etc with status code
2. policy name - policy name related to the client
3. date
4. kind of backup - incr, full, etc

Is there any command please which could provide these infos?

Thanks in advance

7 REPLIES 7

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified
You can parse the output of bpdbjobs -all_columns.
Herewith all the fields:
https://www.veritas.com/content/support/en_US/doc/123533878-127136857-0/v123536850-127136857

Hello,

Thank you for your answer but I cannot get the right one. I want to find out the policy name, status code of backup, date etc from the command.. for example I know only client name and the rest should be the output from command.

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

Everything you need is in bpdjobs. On a Unix/Linux server, grep for the client name, pipe through awk to print the fields you want.

Use the TN shared above for the fields and the forum post for awk example.

*** EDIT ***

@mph999 explains over here how awk and -most_columns can be used:

https://vox.veritas.com/t5/NetBackup/command-to-get-the-stat-and-end-time-of-a-client-backup/m-p/506...

-most_columns seems to contain everything you need - just add 'grep' to only extract the client you are looking for.
(class = policy)

job id = $1
policy name =  $5
status code of backup = $4
date (start date) = $9

bpdbjobs -most_columns | grep <client-name> |awk -F, '{print $1" "$5" "$4" "$9}'

 

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

@JARKUS

Backup Status report will probably be easier:

bperror -U -backstat -client client_name

Example output:
STATUS CLIENT     POLICY  SCHED   SERVER   TIME COMPLETED
0           client1          policy1   Weekly    Server       01/28/2017 18:36:21

The default period is last 24 hours. 
You can adjust period with:
-hoursago hours
or
-d start-date -e -end-date

Nicolai
Moderator
Moderator
Partner    VIP   

or consider to install Netbackup opscenter for reporting purposes.

Per Mariannes reply, many moons ago I put together a script mainly to pull off details of any jobs that failed overnight, but as you can see from the $BPERROR  variable usage the script can be changed to pick up any jobs depending upon their status code (e.g. >=0 would give all jobs). Output will also include if a job failed & then re-ran & completed successfully.

BPERROR=/opt/openv/netbackup/bin/admincmd/bperror ; export BPERROR
$BPERROR -backstat -U| awk '($1 >= 0) {print $0}'|cut -c8-20|grep -v CLIENT|sort -u > failed_clients
#$BPERROR -backstat -U| awk '($1 > 0) {print $0}'|cut -c8-20|grep -v CLIENT|sort -u > failed_clients
#$BPERROR -backstat -U| awk '($1 > 1) {print $0}'|cut -c8-20|grep -v CLIENT|sort -u > failed_clients
cd /app/site/scripts
if [ ! -s /app/site/scripts/failed_clients ]
then
  echo "No clients have had any failed jobs in the last 24 hours"
  rm failed_clients
  exit
fi
echo "The following clients have had one or more failed jobs in the last 24 hours"
echo "***************************************************************************"
echo
cat failed_clients|
while read CLIENT
do
  echo
  echo "JOBS RUN FOR CLIENT $CLIENT"
  echo "*********************************"
  $BPERROR -backstat -client $CLIENT| cut -d " " -f6 | sort -u > failed_jobid
  cat failed_jobid|
        while read JOB_ID
        do
                echo
                echo "JOB_ID $JOB_ID"
                $BPERROR -backstat -U -jobid $JOB_ID
        done
done
rm failed_clients
rm failed_jobid

& you would get similar output to the following:

The following clients have had one or more failed jobs in the last 24 hours
***************************************************************************


JOBS RUN FOR CLIENT cream
*********************************

JOB_ID 1288562
STATUS CLIENT        POLICY           SCHED      SERVER      TIME COMPLETED
  0    cream         Catalog_Backup_D Daily_FULL cream       01/30/2018 01:24:09

JOB_ID 1288564
STATUS CLIENT        POLICY           SCHED      SERVER      TIME COMPLETED
  0    cream         Catalog_Backup_D Daily_FULL cream       01/30/2018 01:06:29

JOB_ID 1288565
STATUS CLIENT        POLICY           SCHED      SERVER      TIME COMPLETED
2074    cream         Catalog_Backup_D Daily_FULL cream       01/30/2018 01:06:40
                 (Disk volume is down)
  0    cream         Catalog_Backup_D Daily_FULL cream       01/30/2018 01:24:07