环境:
MS Windows 2012 + NetBackup

在NBU备份软件中,如果需要设置邮件通知,可以按照下面的方法操作。

首先,找到文件:nbmail.cmd
C:\Program Files\Veritas\NetBackup\bin\nbmail.cmd
默认的文件内容如下:

@REM $Header: nbmail.cmd,v 1.8 2005/05/10 16:12:29 $

@REM

@REM bcpyrght

@REM ***************************************************************************

@REM * $VRTScprght: Copyright 2014 Symantec Corporation, All Rights Reserved SY39-6648-5573-26-15-5  $ *

@REM ***************************************************************************

@REM ecpyrght

@REM 

@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

@REM -                                                                         -

@REM - HOW TO SEND MAIL FROM THE NT NETBACKUP SERVER                           -

@REM -                                                                         -

@REM - NetBackup checks if the mail script (NetBackup\Bin\nbmail.cmd) exists.  -

@REM - If the script exists, NetBackup runs it passing four parameters on the  -

@REM - command line:                                                       -

@REM -                                                                         -

@REM -      %1 is the recipient's address                                      -

@REM -      %2 is the subject line                                             -

@REM -      %3 is the message file name                                        -
@REM -      %4 is the attached file name                                       -

@REM -                                                                         -

@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@REM -                                                                         -

@REM - HOW TO SEND DR MAIL FROM THE NT NETBACKUP SERVER                        -

@REM -                                                                         -

@REM - NetBackup DR protection checks if the mail script                       -
@REM - (NetBackup\Bin\mail_dr_info.cmd) exists.  If the script exists          -

@REM - NetBackup DR protection runs it passing four parameters on the          -

@REM - command line:                                                           -

@REM -                                                                         -

@REM -      %1 is the recipient's address                                      -

@REM -      %2 is the subject line                                             -

@REM -      %3 is the message file name                                        -
@REM -      %4 is the attached file name                                       -

@REM -                                                                         -

@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

@REM -                                                                         -

@REM - A public domain SMTP mail client for NT called BLAT is available at:    -

@REM -                                                                         -

@REM -                       http://blat.net/                                  -

@REM -                                                                         -

@REM - Here's how to use BLAT with the NetBackup NT server.                    -

@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

@REM
@REM @IF "%~4"=="" (

@REM blat %3 -s %2 -t %1 -i NetBackup -server WARTHOG -q
@REM ) ELSE (
@REM blat %3 -s %2 -t %1 -i NetBackup -server WARTHOG -q -attach %4
@REM )

@REM

@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

@REM - The -i option designates the originator's address, you may change this  -

@REM - or omit it altogether (the default is the sender's address specified    -

@REM - when BLAT was installed).                                               -

@REM -                                                                         -

@REM - The -server option is given as an example, you need to determine the    -

@REM - correct name of your SMTP server.  This option may also be omitted      -

@REM - (the default is the server specified when installing BLAT).             -

@REM -                                                                         -

@REM - You may use any mail program you want, as long as it has a command line -

@REM - interface that can be used to send mail.  Just substitute a call to     -

@REM - your favorite mail program for the call to BLAT above.                  -

@REM -                                                                         -

@REM - After modifying this script to suit your situation (make sure you are   -

@REM - calling a valid mail program and the call is not commented out),        -

@REM - activate it by moving it to the NetBackup\Bin directory.                -

@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

@REM - Some email servers do not handle the formating of the messages created  -

@REM - by NetBackup.  Here is an example of how to get Exchange or IIS to      -

@REM - send the mail messages.						       -

@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@REM - @copy /y %3 %TEMP%\nbmail.tmp > NUL
@REM - @echo . >> %TEMP%\nbmail.tmp
@REM - @IF "%~4"=="" (
@REM - blat %TEMP%\nbmail.tmp -s %2 -t %1 -q
@REM - ) ELSE (
@REM - blat %TEMP%\nbmail.tmp -s %2 -t %1 -q -attach %4
@REM - )
@REM -

@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

可以看到,NBU里面,使用邮箱功能需要用到一个BLAT的工具:http://blat.net/

访问官网后,得到介质的下载路径:
https://sourceforge.net/projects/blat/files/Blat%20Full%20Version/64%20bit%20versions/

最新版本是:3.2.17

下载后,将它解压到MS Windows的c:\Windows\System32中,如下:

在继续下一步前,你需要准备好用于发出邮件的邮箱以及对应邮箱所在的SMTP的服务器地址:
在我的环境中如下,由于信息敏感,图片脱敏:

如上,第一部分为SMTP服务器的地址,第二部分为发送NBU事件的邮箱账户

eg:
blat -install smtp.xxx.com send-me@xxx.com

注意:上面的这一步,其实并没有问你要邮箱账号的口令。

然后,准备一个测试文件:

注意,这里文件的位置在:c:\tmp\helloworld.txt

使用BLAT,测试发送:

eg:
blat c:\tmp\helloworld.txt -s “Subject name” -to recive@xxx.com

从上面截图可以看到,测试发送成功。

收下邮件看看:

修改脚本文件,均位于【C:\Program Files\Veritas\NetBackup\bin】。

接下来可以修改nbmail.cmd的配置了,修改成如下:
原:

@REM @IF "%~4"=="" (

@REM blat %3 -s %2 -t %1 -i NetBackup -server WARTHOG -q
@REM ) ELSE (
@REM blat %3 -s %2 -t %1 -i NetBackup -server WARTHOG -q -attach %4
@REM )

改成:

@IF "%~4"=="" (
blat %3 -s %2 -t %1 -i NetBackup -server your-mail-server.xxx.com -q
) ELSE (
blat %3 -s %2 -t %1 -i NetBackup -server your-mail-server.xxx.com -q -attach %4
)

注意:nbmail.cmd的位置,它有时候可能实际位于bin/goodies下,这样就是不对的,需要移动goodies下面的nbmail.cmd到bin下面。

backup_exit_notify.cmd
改成:

@REM
@REM $Header: backup_exit_notify.cmd,v 1.5 2011/10/19 14:07:15 $
@REM
@REM bcpyrght
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 2014 Symantec Corporation, All Rights Reserved SY39-6648-5573-26-15-5  $ *
@REM ***************************************************************************
@REM ecpyrght
@REM
@REM backup_exit_notify.cmd
@REM
@REM This script is called by the NetBackup scheduler, after an individua
@REM client backup has completed (including media closure and image db
@REM validation.
@REM
@REM NOTE:  this script will always be run in "background" mode, meaning that
@REM        the NetBackup scheduler will NOT wait for it's completion.
@REM
@REM This script:
@REM	receives 8 parameters: 
@REM		%1 = CLIENT           - the client hostname
@REM		%2 = POLICY           - the policy label
@REM		%3 = SCHEDULE         - the schedule label
@REM		%4 = SCHEDULE_TYPE    - the type of schedule:  FULL INCR UBAK
@REM		                                               UARC
@REM		%5 = STATUS           - the backup status for this job
@REM		%6 = STREAM           - the backup stream number for this job
@REM		%7 = DONE_TRYING      - 0=will retry.  1=not retrying
@REM		%8 = PRIMARY_JOBID    - the jobid for this job
@REM
@REM - Main program ------------------------------------------------------------
@REM -
@REM - This script only runs on NT 4.0 and succeeding versions of NT.  You must
@REM - have command extensions enabled.  Check the following registry entry:
@REM -
@REM - HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions
@REM -
@REM - It should be set to 0x1 or you may have problems running this script.
@REM ---------------------------------------------------------------------------
@setlocal ENABLEEXTENSIONS
@set LISTPATHS="%~dp0\goodies\listpaths"
@for /F "delims=|" %%p in ('%LISTPATHS% /s NB_MAIL_SCRIPT') do @set NB_MAIL_SCRIPT="%%p"
@set OUTF="%~dp0\BACKUP_EXIT_CALLED"
@REM ---------------------------------------------------------------------------
@REM - Get date and time.
@REM ---------------------------------------------------------------------------
@for /F "tokens=1*" %%p in ('date /T') do @set DATE=%%p %%q
@for /F %%p in ('time /T') do @set DATE=%DATE% %%p
@REM ---------------------------------------------------------------------------
@REM - Check for proper parameter use.
@REM ---------------------------------------------------------------------------
@if not "%8" == "" goto GoodParams
@echo %DATE% backup_exit_notify expects at least 8 parameters: %* >> %OUTF%
@goto EndMain
:GoodParams
@REM ---------------------------------------------------------------------------
@REM - You may want to delete the output file elsewhere in order to
@REM - accumulate successful backup information.  If so, delete the
@REM - following line or move it to where it will do the most good.
@REM ---------------------------------------------------------------------------
@if exist %OUTF% del %OUTF%
@REM ---------------------------------------------------------------------------
@echo %DATE% ----------------------------- >> %OUTF%
@echo %DATE%        CLIENT:  %1 >> %OUTF%
@echo %DATE%        POLICY:  %2 >> %OUTF%
@echo %DATE%      SCHEDULE:  %3 >> %OUTF%
@echo %DATE% SCHEDULE TYPE:  %4 >> %OUTF%
@echo %DATE%        STATUS:  %5 >> %OUTF%
@echo %DATE%        STREAM:  %6 >> %OUTF%
@echo %DATE%   DONE_TRYING:  %7 >> %OUTF%
@echo %DATE% PRIMARY JOBID:  %8 >> %OUTF%
@echo %DATE% ----------------------------- >> %OUTF%
@REM ---------------------------------------------------------------------------
@REM - might want to mail this info to someone
@REM -
@call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%
@REM ---------------------------------------------------------------------------
:EndMain
@endlocal
@REM - End of Main Program -----------------------------------------------------

如上,将【WARTHOG】换成你实际的邮件服务器的地址。

接下来是NBU Admin Console的配置:

将需要接受邮件的地址写进配置:

eg:
xxx@xxx.com,xxx@xxx.com

多个地址,用【逗号】分开。


Administrator,改成 Server sends mail。

Host Properties中的Clients的配置也要加上邮箱地址,如下:

一样也要改成Server send mail。

配置好了以后,重启服务:

重启服务:
.\bpdown.exe -v -f
.\bpup.exe -v -f

最后,NBU手动发起一个备份,结束后,你就可以收到相关的邮件了,像这样:

——————————————————————
最后,有几个官方文档是这么说的,可以参考下:

https://www.veritas.com/support/en_US/article.TECH24110
https://www.veritas.com/support/en_US/article.TECH74038

——————————————————————
Done。

说点什么

avatar

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

  Subscribe  
提醒
隐藏
变装