VERITA备份日常监控

一. 相关检查方法、命令

1.1 启动NBU的图形管理界面:

/usr/openv/netbackup/bin/jnbSA &

1.2字符界面命令:

1.2.1catlog 日志备份时间

bpdbjobs |grep -i cata|grep " 0 " |head -1|awk '{print "/usr/openv/netbackup/bin/admincmd/bpdbjobs -all_columns -jobid ",$1}'

1.2.2文件系统使用率

df -h

1.2.3空白磁带数目是否充足

available_media |grep -i tld |grep -i ava|wc -l

1.2.4最近失败的200条作业,备份时间过长的也需要注意

bpdbjobs |grep -v " 0 " |head -200

1.2.6驱动器状态

vmoprcmd -d

二. 日常检查流程

2.1确认VERITAS NBU进程状态

2.2确认备份任务状态

2.3确认磁带、磁带机的工作状态

2.4确认文件系统状态

2.1检查NBU进程状态:

需要每天监控activity monitor,确认在备份服务器上运行的进程有:avrd、vmd、tldd、ltid、bprd、nbdbd、bpdbm、bpsched、bpjobd。

如果前四个进程avrd、vmd、tldd、ltid有一个没有运行,则备份系统工作不正常。

简单的处理方法:重新启动NBU服务器进程

方法如下:

a)退出NBU的java管理界面,以root身份在命令行状态下输入:netbackup stop

b)使用bpps –a检查上述进程的状态

c)如果进程没有被kill干净,继续执行netbackup stop命令。

d)如果无法结束所有的进程,需要使用bp.kill_all来进行终结。

e)当使用bpps –a看到没有NBU的进程输出时,表明所有的NBU进程已经结束。使用命令:netbackup start启动NBU进程,并用bpps –a确认。

f)如果问题依然存在,请与厂家联系检查VERITAS工作状态。

2.2检查备份任务状态。

需要每天监控activity monitor,观察已经发生备份的任务状态返回值,返回值为0表明备份成功;如果返回值不为0,表明备份失败。对于数据库Archivelog的备份,由于备份的频率目前设置为每一小时一次,因此如果在下面的备份作业中,如果Archivelog的备份成功,可以忽略上面错误的备份。

典型的备份错误有:

a)

Archivelog备份返回值为1,而且后续的备份均返回1。

通常情况,需要进行Oracle 数据库的Archivelog同步。

Oracle数据库Archivelog同步的方法为:

以Oracle数据库用户登录到Oracle数据库服务上,通过RMAN来运行下面的命令:

$ su – oracle

$ rman

RMAN> connect target /

RMAN> change archivelog all validate;

RMAN> exit

b)

备份作业返回值为41、54。

检查服务器网络工作状态:

首先找到备份失败的服务器IP地址,确认IP地址可以ping通。

使用telnet工具,进行如下操作:

telnet 服务器IP地址 13782

如果返回信息如下,表明VERITAS NBU通信正常。

Trying...

Connected to 服务器IP地址.

Escape character is '^]'.

如果系统直接返回到命令行状态,请检查问题服务器的service和inetd设置,确保bpcd进程存在。

并使用如下命令检查bpcd的工作状态:

netstat |grep bpcd

c)

备份作业返回96、219。

请检查磁带机、磁带的工作状态

2.3检查磁带和磁带机状态:

磁带机和磁带常见的错误为96、219,需要确认磁带机状态是否up,磁带库是否闪红灯,使用bpmedialist命令查看是否磁带已经写满或者处于frozen状态,磁带是否卡在了磁带机里。

如果磁带显示frozen,可以使用bpmedia –unfreeze –m labelid来清除此状态,如果磁带反复显示frozen,可能磁带坏,请与厂家联系磁盘检查。

补充:可以在java界面中选择“Media and Device Management”来查看现在media分配的情况。

观察磁带机工作状态的方式有2种:Java GUI界面和命令行。

a)

Java GUI界面方式:

在Java GUI界面下,可以在Media and Device ManagementàDevice Monitor选项中,观察到磁带机的状态。例如磁带机正在使用中、磁带机DOWN、磁带机空闲等。

b)

命令行方式:

使用命令行方式观察磁带机的状态,相关的命令有vmdareq、vmoprcmd。

如果观察到磁带机DOWN,建议先检查是否有卡带现象。确定没有卡带现象后,可以做简单的磁带机UP操作。磁带机UP操作可以通过上面所述的Java GUI界面和命令行方式来执行。命令行方式举例如下:

vmoprcmd –h hostID –up driveID

其中,hostID是SSO服务器名称,driveID是磁带机的序号,目前备份系统中2台磁带机的序号取值为0和1。

经过简单UP后,如果磁带机仍然出现DOWN现象,请与厂家联系解决。

2.4检查文件系统状态

在备份服务器和其它服务器上使用如下命令

df –k

确认文件系统有可以使用的空间。文件系统如果写满,备份系统将工作不正常。

备注:

如果经过了很长时间(如7,8个小时)一个备份任务一直处于active或者queued状态,同时显示此任务的字节数没有增长,需要把此任务kill掉。因为这样会阻止下一个任务的执行。


三NBU常用的命令

  1. 在命令提示符下输入available_media,查看当前磁带使用情况
  2. 在命令提示符下输入bpmedialist命令查看当前磁带使用情况及是否冻结
  3. 在命令提示符号下输入bpexpdate –m a00001 –d 0来使磁带过期
  4. 在命令提示符号下输入bpmedia –unfreeze –m a00001来使磁带解除冻结状态
  5. 在命令提示符号下输入vmquery –m a00001来查看磁带的归属情况
  6. 在命令提示符号下输入vmquery –deassignbyid a00001 4 0来取消磁带的分配日期
  7. 在命令提示符号下输入bprecover –l a00001 –d hcart来查看catalog磁带中的内容
  8. 在命令提示符号下输入bprecover –r a00001 –d hcart来恢复catalog
  9. 在命令提示符号下输入bpexpdate –backupid wbs_1039674374 –d 0来删除一个备份影像,其中wbs_1039674374是backupid,可以通过report中的Images on Media报告来查看backupid
  10. 如何收集NBU备份服务器的相关信息

    查看并导出所有备份策略内容到c:bppllist1.txt:

    C:Program FilesVERITASNetBackupbinadmincmd>bppllist -allpolicies -L -verbose >c:bppllist1.txt
  11. 列出当前存储单元并导出内容到c:bpstulist1.txt:

    C:Program FilesVERITASNetBackupbinadmincmd>bpstulist -L -verbose >c:bpstulist1.txt
  12. 查看磁带使用情况并导出内容到c:available_media.txt:

    C:Program FilesVERITASNetBackupbingoodies>available_media >c:available_media.txt
  13. 查看磁带归属情况:

    显示所有卷并导出内容到c:vmquery.txt:

    C:Program FilesVERITASVolmgrbin>vmquery -a >c:vmquery.txt
  14. 列出卷池并导出内容到c:vmpool.txt:

    C:Program FilesVERITASVolmgrbin>vmpool -listall >c:vmpool.txt
  15. 列出license导出内容到c:nbulicense.txt:

    C:Program FilesVERITASNetBackupbinadmincmd>bpminlicense -list_keys> c:nbulicense.txt

    其它信息请用nbsupport170工具收集。方法是解压缩nbsupport170

    .zip到备份服务器上某个临时文件夹,运行nbsupport.exe,然后在当前文件夹下的output中会生成一个.cab打包文件。所有与备份服务器运行相关的信息文件全在里面。

    16、bpexpdate过期磁带,报”requested media id is in use”错误解决办法

如果你确认这个media并没有在使用,可以手工释放这个media占用的资源

首先使用/usr/openv/netbackup/bin/admincmd/nbrbutil -dump命令得到磁带占用资源的id

nbumaster:~ # /usr/openv/netbackup/bin/admincmd/nbrbutil -dump

Allocation Requests

(AllocationRequestSeq )

MDS allocations in EMM:

  1. MdsAllocation: allocationKey=91666 jobType=1 mediaKey=4000261 mediaId=YZ5350 driveKey=2000012 driveName=HP.ULTRIUM4-SCSI.004 drivePath=/dev/nst0 stuName=nbumaster-hcart-robot-tld-0 masterServerName=nbumaster mediaServerName=nbumaster ndmpTapeServerName= diskVolumeKey=0 mountKey=0 linkKey=0 fatPipeKey=0 scsiResType=1 serverStateFlags=1
  2. MdsAllocation: allocationKey=91667 jobType=1 mediaKey=4000264 mediaId=YZ5353 driveKey=2000008 driveName=HP.ULTRIUM4-SCSI.000 drivePath=/dev/nst5 stuName=nbumaster-hcart-robot-tld-0 masterServerName=nbumaster mediaServerName=nbumaster ndmpTapeServerName= diskVolumeKey=0 mountKey=0 linkKey=0 fatPipeKey=0 scsiResType=1 serverStateFlags=1

nbumaster:~ #

然后使用/usr/openv/netbackup/bin/admincmd/nbrbutil –releaseMDS 即上面的“allocationKey=”后面相应的数值,来释放资源

这样我们便能成功执行bpexpdate命令

17、查询目前有哪些磁带正在被哪个驱动器调用,以及正在运行哪些备份任务

nbumaster:~ # /usr/openv/netbackup/bin/admincmd/nbrbutil -dump

18、列出所有的job的明细

nbumaster:~ # /usr/openv/netbackup/bin/admincmd/bpdbjobs

将bpdbjobs输出到/tmp/bpdbjobs.txt文件中

bpdbjobs -file /tmp/bpdbjobs.txt

列出所有作业的摘要,可查看目前正处于ACTIVE的任务有多少个

nbumaster:~ # /usr/openv/netbackup/bin/admincmd/bpdbjobs -summary

MASTER SERVER QUEUED REQUEUED ACTIVE SUCCESS PARTSUCC FAILED INCOMP SUSP WAITING_RETRY TOTAL

nbumaster 0 0 5 1320 0 43 0 0 0 1368

nbsupport170工具可以向veritas技术支持中心获取。


  1. Solaris下:

    /usr/openv/volmgr/bin/sgscan changer 查看本机所有Robot设备;

    /usr/openv/volmgr/bin/sgscan tape 查看本机所有的磁带驱动器。

    /usr/openv/volmgr/bin/sgscan disk 查看本机所有的disk,包括本地磁盘和共享磁盘。

  2. robot及磁带驱动器配置:

    /usr/openv/volmgr/bin/tpconfig 提供add ,delete,list NBU可以识别并使用的物理设备。

    /usr/openv/volmgr/bin/stopltid

    /usr/openv/volmgr/bin/stopltid <参数> :当修改配置后请重启:ltid(设备管理进程)。

    tpconfig: 可以进入文本菜单。 先配置robot,再配置磁带驱动器。

    /usr/openv/volmgr/bin/tpconfig -d 可以查看磁带驱动器及robot细节情况。

    当配置完成之后,一定要重启ltid进程。

    robtest

tpconfig -d

Id DriveName Type Residence

Drive Path Status


0 HP.ULTRIUM3-SCSI.000 hcart3 TLD(0) DRIVE=1

/dev/rmt/0cbn UP

/dev/rmt/1cbn UP

Currently defined robotics are:

TLD(0) robotic path = /dev/sg/c0tw500110a0009485aal1

EMM Server = dcd-bjgglc-logcdr

  1. 名词介绍:

    image: 镜像:一个客户端在一次备份中所有数据的集合。

    storage unit: 存储单元:保存备份的逻辑位置,可以是磁盘也可以是磁带。

    volume: 卷: 每一个磁带一个编号,称为一个卷。

    volume: 卷池:一组卷的集合,在备份时需要指明卷池,netbackup会自动维护卷池中的所有卷。

    backup policy: 备份策略:4方面:数据保存在哪个存储单元,什么时段运行,备份哪些client的数据;

    需要备份的数据的位置。

  2. netbackup 进程维护

    /usr/openv/netbackup/bin/bpps -a 查看netbackup 所有进程,也可以通过图形界面查看Daemons状态。

    bp.kill_all 启动netbackup (netbackup stop)

    bp.start_all 停止netbackup (netbackup start)

jnbSA % 启动netbackup图形化界面.

  1. 磁带维护

    /usr/openv/netbackup/bin/goodies/available_media:

    以root用户运行,可以查看磁带的状态等等信息;

    status: full,active,available,frozen,dbbackup.

    当有磁带frozen时,可以用:bpmedia -unfreeze -m A00006,对磁带进行解frozen;

    当磁带反复frozen时,请检查是否有坏,或是此磁带是清洗带。

过期磁带: bpexpdate -m media_id -d 0 eg: bpexpdate -m NU06CU -d 0 使磁带可重写。

bpexpdate -backupid eel_0904219764 -d 0 删除备份

bpexpdate: -m -d

bplist:

bplist -C dcd-bjgglc-rac03-vip -t 4 -l -R 4代表oracle

bplist --help

bpmedialist -l: 查看磁带信息。

bplabel: 对磁带进行label : 有三种方式 :quick erase; long erase; NBU label;

/usr/openv/netbackup/bin/admincmd/bplabel -erase -o -m -d hcart -p NetBackup -host

/usr/openv/netbackup/bin/admincmd/bplabel -erase -l -o -m -d hcart -p NetBackup -host

/usr/openv/netbackup/bin/admincmd/bplabel -m -d hcart -o -p NetBackup [-n drive_name | -u device_number] -host

对磁带label 可以检查,磁带是否有问题,时间也很快。

/usr/openv/netbackup/bin/admincmd/bpdbjobs -report

/usr/openv/netbackup/bin/admincmd/bperror -U –problems 报告24小时内的问题。

/usr/openv/netbackup/bin/admincmd/bpgetconfig | more 获得netbackup的配置信息。

/usr/openv/netbackup/bin/bpclntcmd -hn Client_A 测试到某client是否有问题。

磁带的池:

netbackup : 默认扫描到的磁带都放在此池;除clear带。

none: 默认放清洗带。

其他池可以手工建议:对一个策略建立一个池,从netbackup中找到数据带,分配到相应的策略池中。

并可以对分配完成的磁带进行label操作,可以检查磁带是否有问题。

6.管理维护:

bpadm 可以进行日常维护用,而不用jnbSA 的图形化界面。

bpflist -d 2009-07-01 -e 2009-07-02 -policy dbbackup -client dcd-bjgglc-rac03-vip -U

这一句可能是最有用的。

bpps -a

bpdbjobs -report 执行结果的状态问题: 0 :成功; 96: 没有空闲磁带可用。其他:

bpimage --help

bpflist --help

 

 

 

#######感谢davidmolinedavidmoline

netbackup 在备机注册svc 服务名

https://vox.veritas.com/t5/NetBackup/host-ID-mappings-in-Host-Management/td-p/874340

 

cat /backup/script/nbu/nbu.info

unixpwd
master02
user

pass

 

Have a look at the nbhostmgmt command.
I think you will need to do to do something like (the option for the second one will allow you to share the mapped name

bpnbat -login -info /backup/script/nbu/nbu.info

1. nbhostmgmt -add -host arheadb1.domain -mappingname arheadb.domain
2. nbhostmgmt -add -host arheadb2.domain -mappingname arheadb.domain -isshared

 

 

 

###sample 1

https://vox.veritas.com/t5/NetBackup/bpdbjobs-command-usage/td-p/168926
感谢Darren_Dunham。tbl

##如果检查每日nbu 备份的报错


You can use bpdbjobs and parse out the status from the lines present.

For example:

bpdbjobs | perl -lane 'print if $F[2] eq 'Done' and $F[3] != 0'

 或者

bpdbjobs |grep -v " 0 " |head -200

 

###查看6.查看策略最近24小时备份量

bpimagelist -U -hoursago 24 -policy 策略名 |awk '{sum+=$5} END {print sum/1024/1024 }'

###查看策略详情

bppllist


bppllist 策略名 -U

 


##或者
###
bperror -all -hoursago 24

bperror -all reports ALL errors from the last 24 hours.
perhaps the error is older than 24h, try to specify option -hoursago

bperror -all -hoursago 78 | grep -e "STATUS CODE 50"
verify the command and output, I wrote it from memory.

thomas

 

###参考文档

1 显示NetBackup的进程

/usr/opnev/netbackup/bin/bpps -x

2 启动NetBackup进程
/usr/openv/netbackup/bin/goodies/netbackup start
/usr/openv/netbackup/bin/goodies/bp.start_all

3 停止NetBackup进程
/usr/openv/netbackup/bin/goodies/netbackup stop
/usr/openv/netbackup/bin/goodies/bp.kill_all

4 启动PBX进程

/opt/VRTSpbx/bin/pbx_exchange

 

2|0二、巡检常用命令

1 文件系统使用率

df -h 或 df -k

 

2 空白磁带  

available_media >/tmp/list.txt

vmquery -pn Scratch -bx|grep -v "NONE" |more

cat /tmp/list.txt |grep -i tld |grep -i ava|wc -l

 

3 最近失败的200条备份作业

bpdbjobs |grep -v " 0 " |head -200

 

4 带库驱动器检查

robtest

vmoprcmd -d

tpconfig -l

 

 

3|0三、备份作业、策略

1.列出所有作业摘要

/usr/openv/netbackup/bin/admincmd/bpdbjobs -summary

查看某个作业的详细情况

bpdbjobs -jobid  -all_columns

 

2.查询目前有哪些磁带正在被哪个驱动器调用,以及正在运行哪些备份任务

/usr/openv/netbackup/bin/admincmd/nbrbutil -dump

 

3.调整作业

bpdbjob -cancle -jobid 手工取消作业

bpbackup -i -p policy-name   手工启动策略进行备份

 

4.查看策略详情

bppllist 策略名 -U

 

5.把一条策略状态激活或禁用

bpplinfo 策略名 -modify -active(激活) / -inactive(去激活)

 

6.查看策略最近24小时备份量

bpimagelist -U -hoursago 24 -policy 策略名 |awk '{sum+=$5} END {print sum/1024/1024 }'

 

 ###sample 2

如何查看某个备份发起的时间,和结束时间 ,

原本想用命令,发现不好用,只能用脚本  

 

#bpdbjobs -most_columns| grep policy01 | awk -F"," '{print $1", "$5", "$7", "$9", "$10","$11}' | grep 3913
3913, policy01, server01, 1403812801, 0000000042,1403812843

# bpdbm -ctime 1403812801
1403812801 = Thu Jun 26 22:00:01 2014  = Start Time
# bpdbm -ctime 1403812843
1403812843 = Thu Jun 26 22:00:43 2014 = End Time

The problem is that the environment is used by multiple engineers that can delete log in activity monitor so I checked the "bpimagelist -l" command and the problem is that I don't have the same result

# bpimagelist -l -hoursago 24 -policy policy01 | grep server01 | awk '{print $14", "$15", "$45}'
1403812805, 13, 3913

# bpdbm -ctime 1403812805
1403812805 = Thu Jun 26 22:00:05 2014

As you can see the start time is different here than in bpdbjobs command and end time = 1403812805 + 13

#bpdbm -ctime 1403812818
1403812818 = Thu Jun 26 22:00:18 2014

 

 

###脚本如下:

#Change this value to search further back into the error reports
HOURSAGO=24

#Specify the location of the required scripts, including this one
WORKINGDIR=//backup/script/netbackup_scripts

#The remaining stuff below shouldn't need to be edited
COUNT=0
OUTPUT=/tmp/unixstats1
OUTPUT1=/tmp/goodunix
ADMCMD=/usr/openv/netbackup/bin/admincmd
FORM1=" Successful Backup Jobs"
FORM2=" *************************************************"
FORM7=" Code"
FORM3="Status Client Policy SCHED Server Time "
FORM4="==============================================================================="
FORM5=" Detailed Error Report"
FORM6="_______________________________________________________________________________"
#
# Get rid of any old output files if they are there.

if [ -s $OUTPUT ]
then
rm $OUTPUT
fi
if [ -s $OUTPUT1 ]
then
rm $OUTPUT1
fi

# Format Report with Title, etc.
echo "`date +%m/%d/%y` `date +%H:%M`" > $OUTPUT echo "Netbackup Reporting automagically on the last "$HOURSAGO" hours for all backups. Please do not reply to this email. Thanks! "Ran at: `date +%m/%d/%Y`" ("`date +%H:%M`")" > $OUTPUT echo >> $OUTPUT echo "$FORM6" >> $OUTPUT echo >> $OUTPUT echo "$FORM1" >> $OUTPUT echo "$FORM2" >> $OUTPUT echo "" >> $OUTPUT echo "$FORM4" >>$OUTPUT echo "$FORM3" >> $OUTPUT echo "$FORM7" >> $OUTPUT echo "$FORM4" >>$OUTPUT echo >> $OUTPUT

# Begin Main Script
for i in `$ADMCMD/bpplclients | grep -v "Hardware" | (tee) | cut -c35-68`
do
$ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | fgrep " 0 ">> $OUTPUT
$ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | fgrep " 0 " | cut -c8-20 >> $OUTPUT1
$ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | fgrep " 1 ">> $OUTPUT
$ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | fgrep " 1 " | cut -c8-20 >> $OUTPUT1 done #
# Looking for Backups with Status code 1 too because those are
# partially successful and a backup image was created for them
############################################################################
############################################################################
# Now that the successful backups were reported,
# its time to log the errors
echo >> $OUTPUT
echo >> $OUTPUT
echo >> $OUTPUT
echo >> $OUTPUT
echo "$FORM5" >> $OUTPUT
echo "$FORM6" >> $OUTPUT
echo >> $OUTPUT

 

##参考文档

感谢VirtualDennis

 

https://www.virtualdennis.com/custom-netbackup-daily-report-script-for-unixlinux/

Custom NetBackup Daily Report Script for Unix/Linux

 

I have created/modified some NetBackup scripts to be used for a Daily Status Report, which can be emailed to the NetBackup administrator every morning or whenever convenient (automatically running the script would need to be done through “crond” or some other scheduler). The below scripts will need to be copied exactly as text files to the same directory on the NetBackup Master server. Also, please name the scripts exactly what is in quotations, as other scripts may refer to that script by name.

 

"Daily-Backup-Status-Report" Script

 

#!/bin/bash
#########################################################################
#
# Script to generate a Daily Backup Status Report
# Original Creation Date by David A. Chapa: 11/19/97
# Modification by Dennis L. & Roger Y.: 12/02/97
# 1/2010 & 9/2010 Major Update & Modification by Dennis Laube, http://3.135.210.113
#
# This script generates a status report with the following info:
# -Status of all client backups within the specified timeframe
# -Per Policy Data amount for the last 7 days
# -Per Policy Data amount for the last 24 hours
# -Tape Library Status including number of tapes inside & outside the library
# -Mails the complete report to the "someone_who_cares" variable.
#
# Requires this script as well as "amountprclass", "amountprclass24" and # "tapestat" to be placed under the "WORKINGDIR" location.
#
# When running this script manually, you will see multiple "no entity found" messages. This is normal.
#
#########################################################################
#
#Change this value to email a group or individual
someone_who_cares=backupadmin@mycompany.com
COMPANY="My Company"

#Change this value to search further back into the error reports
HOURSAGO=18

#Specify the location of the required scripts, including this one
WORKINGDIR=/root/netbackup_scripts

#The remaining stuff below shouldn't need to be edited
COUNT=0
OUTPUT=/tmp/unixstats1
OUTPUT1=/tmp/goodunix
ADMCMD=/usr/openv/netbackup/bin/admincmd
FORM1=" Successful Backup Jobs"
FORM2=" *************************************************"
FORM7=" Code"
FORM3="Status Client Policy SCHED Server Time "
FORM4="==============================================================================="
FORM5=" Detailed Error Report"
FORM6="_______________________________________________________________________________"
#
# Get rid of any old output files if they are there.

if [ -s $OUTPUT ]
then
rm $OUTPUT
fi
if [ -s $OUTPUT1 ]
then
rm $OUTPUT1
fi

# Format Report with Title, etc.
echo "`date +%m/%d/%y` `date +%H:%M`" > $OUTPUT echo "Netbackup Reporting automagically on the last "$HOURSAGO" hours for all backups. Please do not reply to this email. Thanks! "Ran at: `date +%m/%d/%Y`" ("`date +%H:%M`")" > $OUTPUT echo >> $OUTPUT echo "$FORM6" >> $OUTPUT echo >> $OUTPUT echo "$FORM1" >> $OUTPUT echo "$FORM2" >> $OUTPUT echo "" >> $OUTPUT echo "$FORM4" >>$OUTPUT echo "$FORM3" >> $OUTPUT echo "$FORM7" >> $OUTPUT echo "$FORM4" >>$OUTPUT echo >> $OUTPUT

# Begin Main Script
for i in `$ADMCMD/bpplclients | grep -v "Hardware" | (tee) | cut -c35-68` do
    $ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | fgrep " 0 ">> $OUTPUT
    $ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | fgrep " 0 " | cut -c8-20 >> $OUTPUT1
    $ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | fgrep " 1 ">> $OUTPUT
    $ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | fgrep " 1 " | cut -c8-20 >> $OUTPUT1 done #
# Looking for Backups with Status code 1 too because those are
# partially successful and a backup image was created for them
############################################################################
############################################################################
# Now that the successful backups were reported,
# its time to log the errors
echo >> $OUTPUT
echo >> $OUTPUT
echo >> $OUTPUT
echo >> $OUTPUT
echo "$FORM5" >> $OUTPUT
echo "$FORM6" >> $OUTPUT
echo >> $OUTPUT

for i in `$ADMCMD/bpplclients | grep -v "Hardware" | (tee) | cut -c35-68` do
    fgrep "$i" "$OUTPUT1" > /dev/null 2>&1
    if [ $? = 0 ]
    then
        continue
    fi

    $ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | egrep -v STATUS | egrep -v " 0 " > /dev/null
    if [ $? = 0 ]
    then
        echo >> $OUTPUT
        echo >> $OUTPUT
        echo "Error Log Report for Client $i" >> $OUTPUT
        echo >> $OUTPUT
        echo >> $OUTPUT
        $ADMCMD/bperror -U -backstat -hoursago $HOURSAGO -client $i | egrep -v STATUS | egrep -v " 0 " >> $OUTPUT
        echo $FORM6 >> $OUTPUT
        $ADMCMD/bperror -U -problems -hoursago $HOURSAGO -client $i >> $OUTPUT
        echo >> $OUTPUT
        echo $FORM4 >> $OUTPUT
        echo >> $OUTPUT
        COUNT=`echo "$COUNT+1" | bc`
    fi
done

# Run "amountprclass24" script and insert into report
echo "Amount of Data Backed Up for the last 24 hours" >> $OUTPUT
$WORKINGDIR/amountprclass24 >> $OUTPUT
echo >> $OUTPUT
echo >> $OUTPUT

# Run "amountprclass" script and insert into report
echo "Amount of Data Backed Up for the last 7 days" >> $OUTPUT $WORKINGDIR/amountprclass >> $OUTPUT echo >> $OUTPUT echo >> $OUTPUT

# Run "tapestat" script to show number of tapes in each pool and if either onsite/offsite
echo "Tape Status & Location" >> $OUTPUT $WORKINGDIR/tapestat >> $OUTPUT echo >> $OUTPUT echo >> $OUTPUT

# Now we can e-mail it to the right person
today=`date +%m/%d/%y`
#
# Uncomment if you want this to be sent to someone_who_cares
cat $OUTPUT | mail -s "$COMPANY Morning Backup Report ( $today $COUNT bad )" $someone_who_cares

 

 

 

"amountprclass" Script

 

#!/bin/ksh
#
################################################################################
# This script will list the amount of data that was backed up in the last 7 days
# listed per policy.
#
# Updates 2010 by Dennis Laube, http://3.135.210.113
################################################################################
#
# Variables
BPPATH=/usr/openv/netbackup/bin/admincmd
DBPATH=/usr/openv/netbackup/db
sumtotkb=0

# list classes
$BPPATH/bppllist |
while read class
do

# calculating sum of the kilobytes
sumkb=0
$BPPATH/bpimagelist -A -L -class $class -hoursago 168 2>/dev/null | grep "^Kilobytes" |
while read txt kb
do
let sumkb=${sumkb}+${kb}
done # calculating sum of kilobytes

# Make the output more human readable
outtxt="$sumkb kb"
echo "$sumkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
printf "%-40s %6s %2s\n" $class $outtxt
let sumtotkb=${sumtotkb}+${sumkb}
done # reading classes
outtxt="$sumtotkb kb"
echo "$sumtotkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
echo "$sumGB/1024" | bc -l | read sumTB
if [ $sumTB -gt 0 ]; then
printf "%7.2f %s" $sumTB "TB" | read outtxt
fi
# Print results
printf "%-45s %6s %2s\n" "Total Amount" $outtxt

 

 

 

"amountprclass24" Script

 

#!/bin/ksh
#
################################################################################
# This script will list the amount of data that was backed up in the last 24 hrs
# listed per policy.
#
# Various Updates 2010 by Dennis Laube, http://3.135.210.113
################################################################################
#
# Variables
BPPATH=/usr/openv/netbackup/bin/admincmd
DBPATH=/usr/openv/netbackup/db
sumtotkb=0

# list classes
$BPPATH/bppllist |
while read class
do

# calculating sum of the kilobytes
sumkb=0
$BPPATH/bpimagelist -A -L -class $class -hoursago 24 2>/dev/null | grep "^Kilobytes" |
while read txt kb
do
let sumkb=${sumkb}+${kb}
done # calculating sum of kilobytes

# Make the output more human readable
outtxt="$sumkb kb"
echo "$sumkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
printf "%-40s %6s %2s\n" $class $outtxt
let sumtotkb=${sumtotkb}+${sumkb}
done # reading classes
outtxt="$sumtotkb kb"
echo "$sumtotkb/1024" | bc -l | read sumMB
if [ $sumMB -gt 0 ]; then
printf "%7.2f %s" $sumMB "MB" | read outtxt
fi
echo "$sumMB/1024" | bc -l | read sumGB
if [ $sumGB -gt 0 ]; then
printf "%7.2f %s" $sumGB "GB" | read outtxt
fi
echo "$sumGB/1024" | bc -l | read sumTB
if [ $sumTB -gt 0 ]; then
printf "%7.2f %s" $sumTB "TB" | read outtxt
fi
# Print results
printf "%-45s %6s %2s\n" "Total Amount" $outtxt

 

 

 

"tapestat" Script

 

#!/usr/bin/ksh
#
# This script shows the current tape status by pool. It will show how many tapes are in the
# robot versus how many tapes are outside the robot as well as the overall total of tapes
# per pool.
# Written by Dennis Laube, http://3.135.210.113 with initial help from Roger Yarrow.
# 1/10 - Updates to script performed, testing with NBU 6.5
# 10/10 - Updates for RedHat, Testing with NBU 7
#
#
# Variables
#
#Change the below variables to reflect the hostnames of your Master and Media Servers
MASTER=netbackup1.mycompany.com
MEDIA=NBU-media2.mycompany.com
VMQUERY=/tmp/vmquery.$$.out
VMPOOL=/tmp/vmpool.$$.out
VMHOST=`/usr/openv/volmgr/bin/tpconfig -d | grep "robot control host" | sed 's/^.*host = //'`
RTYPE=TLD
VOLMGR=/usr/openv/volmgr/bin

# Its sloppy but it works!, Leave commented out
#DL RTYPE=`/usr/openv/volmgr/bin/tpconfig -d | tail -2 | sed 's/(0).*$//' | awk '{print $1}' | head -n 1`
#typeset -l rt=$RTYPE

/bin/rm -f $VMQUERY $VMPOOL

# List out formating for data
echo "Poolname\t\t outside \t inside \t total"
echo " \t\t robot \t robot \t number"
echo "---------------------------------------------------------------"
$VOLMGR/vmcheckxxx -h $MASTER -list -rt $RTYPE -rn 0 -rh $MEDIA > /tmp/inrobot
$VOLMGR/vmpool -h $MASTER -listall -b | tail | sort > $VMPOOL
cat $VMPOOL |
while read POOLNAME line
do
if [ "$POOLNAME" = "DONTUSE" ]; then
continue
fi

#DL $VOLMGR/vmquery -h $MASTER -pn $POOLNAME -b | tail +4 > $VMQUERY
$VOLMGR/vmquery -h $MASTER -pn $POOLNAME -b > $VMQUERY
POOLNAME=`echo "$POOLNAME " | cut -c -20`
ntapestot=`cat $VMQUERY | wc -l`
echo $ntapestot | read tal1
let sumtot=${sumtot}+${tal1}
ntapesin=`cat $VMQUERY | grep $RTYPE | wc -l`
echo $ntapesin | read tal1
let sumin=${sumin}+${tal1}
ntapesin=${tal1}
ntapesout=`cat $VMQUERY | grep NONE | wc -l`
echo $ntapesout | read tal1
let sumout=${sumout}+${tal1}
ntapesout=${tal1}
inrobot=0
cat $VMQUERY | grep NONE |
while read mediaid line
do
INROBOT=`grep $mediaid /tmp/inrobot`
if [ -n "$INROBOT" ]; then
let inrobot=${inrobot}+1
fi
done

let ntapesout=${ntapesout}-${inrobot}
let ntapesin=${ntapesin}+${inrobot}
let sumout=${sumout}-${inrobot}
let sumin=${sumin}+${inrobot}
tapesin=`echo "${ntapesin}"`
#printf "%20s%10d%16d%16d\n" "$POOLNAME" ${ntapesout} ${ntapesin} ${ntapestot}
DISYES=`echo $POOLNAME | grep -i disaster`
if [ -n "$DISYES" ]; then
POOLNAME=`echo "$POOLNAME(scratch) " | cut -c -20`
count=0
cat $VMQUERY |
while read mediaid mediatype robottype robotnum robotslot side op vol mnts lmntdate lmnttime asgndate asgntime pool
do
if [ "${asgndate}" = "---" -a "${asgntime}" = "---" -a "${robottype}" != "NONE" ]; then
let count=${count}+1
fi
done
tapesin=`echo "${ntapesin}($count)"`
fi
printf "%20s%10d%16s%16d\n" "$POOLNAME" ${ntapesout} $tapesin ${ntapestot}
done
echo "---------------------------------------------------------------"
printf "%20s%8d%16d%16d\n" "Total number of tapes:" $sumout $sumin $sumtot
echo "==============================================================="

#Clean up after ourselves
/bin/rm -f $VMQUERY $VMPOOL

 

 

#########sample 333

感谢sclindsclind

https://vox.veritas.com/t5/NetBackup/How-to-determine-on-which-tape-s-the-full-backup-set-is-located/td-p/773044

As far as #3 we use these commands to list the backups and the tapes needed (using the  date/time range given to us by the DBA's)

# bpimagelist -U -d 04/01/2016 16:00:00 -e 04/02/2016 18:00:00 -client xxxxxxxx -policy SAP_yyy 

Backed Up         Expires       Files       KB  C  Sched Type      On Hold Index Status Policy
----------------  ---------- -------- --------  -  --------------- ------- ------------ ------------

04/01/2016 19:32  05/02/2016        1 812522286  N  User Backup     0       0            SAP_yyy
04/01/2016 19:32  05/02/2016        1 843302916  N  User Backup     0       0            SAP_yyy
04/01/2016 19:32  05/02/2016        1 835919279  N  User Backup     0       0            SAP_yyy

# bpimagelist -media -U -d 04/01/2016 16:00:00 -e 04/02/2016 18:00:00 -client xxxxxxxx -policy SAP_yyy

Media ID On Hold   Last Written       Server
-------- -------   ----------------   ----------
BU3081   0         04/02/2016 17:43   zzzzzz
BU3101   0         04/02/2016 17:40   zzzzzz
BU2300   0         04/02/2016 17:36   zzzzzz

 bpimagelist -media -U -d 10/18/2020 00:00:00 -e 10/18/2020 23:50:00 -client sddddb_svc -policy rman_ddddb

 

或者下面的方法,更加准确,类似catalog 获取

#### 使用client 方式 (client 可能会发生变化)

command1 :
/usr/openv/netbackup/bin/admincmd//bpverify -PD -M "1.1.1.1" -X -s 1602897531 -e 1603036799 -primary -client "pddddb04"


command2: (move -X)
/usr/openv/netbackup/bin/admincmd//bpverify -PD -M "1.1.1.1" -s "10/18/2020 00:00:00" -e "10/18/2020 23:50:00" -primary -client "pddddb04"


COMMAND3:
/usr/openv/netbackup/bin/admincmd//bpverify -PD -M "1.1.1.1" -s "09/18/2020 00:00:00" -e "09/18/2020 23:50:00" -primary -client "pddddb04"


#### 使用police 方式 (police 理论上没变化)

command 1:
"/usr/openv/netbackup/bin/admincmd//bpverify" -PD -M "1.1.1.1" -X -s 1600305531 -e 1600444799 -primary -class rman_dddb


command2:
/usr/openv/netbackup/bin/admincmd//bpverify -PD -M "1.1.1.1" -s "10/18/2020 00:00:00" -e "10/18/2020 23:50:00" -primary -class rman_dddb


COMMAND3:
/usr/openv/netbackup/bin/admincmd//bpverify -PD -M "1.1.1.1" -s "09/18/2020 00:00:00" -e "09/18/2020 23:50:00" -primary -class rman_dddb

 


##参考如下:
( [-s mm/dd/yyyy hh:mm:ss] [-emm/dd/yyyy hh:mm:ss] )

 

 

##sample 

这篇文章有关于机械臂和robot 的的方法

https://wenku.baidu.com/view/109c8caffb0f76c66137ee06eff9aef8941e48f4.html