Video Screencast Help

Need Script to collect failed backup report

Created: 07 May 2013 | 8 comments

Hi All,

Can anybody help me to get a script to collect failed backup report on daily basis and last successful backup for the failed clients? Below are the overview of environment :

Master Server : Linux- Netbackup 7.1

Media Server (6 in no.) : AIX- Netbackup 7.1

Clients : Mostly- Netbackup 7.1

Operating Systems:

Comments 8 CommentsJump to latest comment

Nicolai's picture

You should consider to deploy OpsCenter for backup reporting.

http://eval.symantec.com/mktginfo/enterprise/white_papers/b-nbu_7_opscenter_analytics_WP.en-us.pdf

http://www.symantec.com/opscenter-analytics

Opscenter is free if you have Netbackup

OpsCenter analytics is licensed.

Assumption is the mother of all mess ups.

If this post answered your'e qustion -  Please mark as a soloution.

niteshry's picture

Thanks Nicolai for your suggesstion. But In my backup enviornment no OpsCenter is implemented and my client need a script to collect failed jobs.

 

Can anyone help me in this regard ?

Flako's picture

For some quick daily Reporting you might check these commands :

    bperror -backstat -by_statcode -hoursago 36 -U

    bperror -backstat -hoursago 36 -U|grep -v ' 0 '

    bperror -backstat -hoursago 78 -U|grep <client_name> [|grep <policy_name>] [|grep <schedule_name>]

Have fun,
Ingo

Andy Welburn's picture

We used the following (dirty) UNIX script on a daily basis utilising the bperror command mentioned by Flako (it does not, however, detail the last successful client backup - I'll leave that to you!) (EDIT: but you could incorporate, for each failed client, bpimagelist -U -client $CLIENT -d 12/31/12 | head -3 | tail -1 or something more appropriate to yourself?)

bperror -backstat -U| awk '($1 > 1) {print $0}'|cut -c8-20|grep -v \
CLIENT|sort -u > failed_clients
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

 

It *will* also report if said failed job re-started & completed successfully (using the same job_id)

(***EDIT #2: just realised OP is nearly 2 months old & no return since - hopefully managed to work something out!)

Flako's picture

First i do a "bperror -backstat -hoursago 48 -U |grep -v ' 0 '"

In a script i read the client, the policy and the schedule of the failing job.

For every failing client/policy/schedule i do a

"bperror -backstat -U -hoursago ?? -client <client> | grep <policy>  | grep <Schedule>"

That way i see if and when was another run of the failing job.

 

i.e.:

root@klnnbus1:/ :-) bperror -backstat -U -hoursago 72 -client dsnklnp740-2b
STATUS CLIENT        POLICY           SCHED      SERVER      TIME COMPLETED
  0    dsnklnp740-2b OS-CUM-NEW       CINC_Daily dsnklnt4-2  07/19/2013 17:08:30
 59    dsnklnp740-2b OS-CUM-NEW       FULL_Sat   dsnklnt4-2  07/20/2013 13:06:18
                 (access to the client was not allowed)
 59    dsnklnp740-2b OS-CUM-NEW       FULL_Sat   dsnklnt4-2  07/20/2013 14:10:54
                 (access to the client was not allowed)
 59    dsnklnp740-2b OS-CUM-NEW       FULL_Sat   dsnklnt4-2  07/20/2013 14:57:33
                 (access to the client was not allowed)
  0    dsnklnp740-2b OS-CUM-NEW       FULL_Sat   dsnklnt4-2  07/22/2013 09:46:55
root@klnnbus1:/ :-)

StefanosM's picture

if someone has a way to get a report - opscenter, UNIX shell, Perl whatever - of failed backups and not failed jobs, please share it with us. l'm begging symantec for this report for years.
To clear it more, I do not want to see at the report a job that failed and the succeeded. This is a succesfull backup

Andy Welburn's picture

Hmmm ..... have seen jobs fail & show as failed in the Actiivity Monitor but subsequently re-start as a different job ids & succeed - that's gonna take scripting beyond my basic skills!

 

Flako's picture

A report of "failed backup and not failed jobs"  ??

Thats what parameter "-backstat" in the bperror CMD means "back(up)stat(us)" .

You dont have to mess with job ids or restarts or whatever.

Just do the

"bperror -backstat -U -hoursago ?? -client <client> | grep <policy>  | grep <Schedule>"

and you get a Date Sorted List of the Backups for this client/policy/schedule.

But you are right, there may be several ways to get to a nice list.     ;-)