12-02-2008 08:49 PM
Hi,
I would like to add more in my auto email notification with my backup policy name, beside the backup status.
currentl in my email subject Backup on mlyorabk - 0 (how to add the backup policy name)
@blat %3 -s %2 -t %1 -i Netbackup -server smtp.seagate.com -q- currently settings in my nbmail.cmd and i use blat software
%2 is subject - how i can add the backup policy name, when each backup policy complete succesful will send the email
notification with backup policy name,beside the backup status
which script i need to change??
regards
Danny Tan
12-03-2008 04:01 PM
You can set the logging level pre client server if you want to, to have it email you also from the client side. On the Master server go to Netbackup Management > Host Properties > Clients, then open the Properties for the client you want to setup, then go to Universal Settings and change it to Client sends email and enter the email address.
Also, The bpstart_notify.bat and bpend_notify.bat export information to a file named BP_RES.txt, the notify files are located in (%InstallDirectory%\Veritas\Netbackup\Bin) and (%InstallDirectory%\Veritas\Netbackup\Bin\goodies), the BP_RES.txt file is in (%InstallDirectory%\Veritas\Netbackup\Bin).
The information that is saved to the BP_RES.txt file has the information you need or want. It is possible to use this information to help you out with additional output. You can also possibly add information that is exported to a different file.
12-04-2008 12:53 AM
Pls guide it
@blat %3 -s %2 -t %1 in nbmail.cmd
%2 is -how i add the backup policy name , so backup complete with display the subject with backup policy name, client and backup status.
i unable to find the BP_RES.txt file in path veritas\netbackup\bin goodies. i already set the logging level pre client.
also, for bpstart_notify.bat, can i modify it in this script, so what is the mail notification for subject with my policy name, and backup status.
@REM print a generic message since backup is neither full, nor cumulative incremental
echo backup/restore finished on %1 using policy %2 with schedule %3 and status %5, bpres = %6 >> bin\BP_RES.txt---------------> what is mean ?
@echo 0 >> %6
GOTO :EOF
@REM exit 0
:FULL
echo full backup finished on %1 using policy %2 with schedule %3 and status %5, bpres = %6 >> bin\BP_RES.txt
echo 0 >> %6
GOTO :EOF
@REM exit 0
:CINC
@echo cumulative incremental backup finished on %1 using policy %2 with schedule %3 and status %5, bpres = %6 >> bin\BP_RES.txt
@echo 0 >> %6
GOTO :EOF
@REM exit 0
:FAIL
@REM no schedule type information was sent. A failure has occured. Write status 1 to results files.
@echo 1 >> %6
GOTO :EOF
@REM exit 0
12-04-2008 08:55 AM
The line:
echo backup/restore finished on %1 using policy %2 with schedule %3 and status %5, bpres = %6 >> bin\BP_RES.txt
is printing everything from backup/restore to %6 to a file named BP_RES.txt in the bin directory of Netbackup. the >> is used to append to the file name BP_RES.txt. if you see just > then it is simply writing over the previous BP_RES.txt file.
As stated in the bpstart_notify and bpend_notify batch files, the scripts receive 6 parameters:
@REM %1 = CLIENT_NAME
@REM %2 = POLICY_NAME
@REM %3 = SCHEDULE_NAME
@REM %4 = SCHEDULE_TYPE, one of the following: FULL, INCR, CINC, UBAK, UARC
@REM %5 = STATUS, always 0
@REM %6 = RESULT_FILE
you can use these to create an output file to use with sending email. I'll put together a small script for you to use, in which I will post later.
12-04-2008 11:44 AM
As I specified before in an earlier post, you can have the client send the email out instead of the Netbackup master. So when an email is sent to you it from the NBU master it would look similar to this: Backup on NetbackupMaster - 0, If you were to have the client send it out the subject would look similar to Backup on ClientServer - 1.
To do this Open Netbackup Admin Console, then go to Netbackup Management > Host Properties > Clients, double click on the client that you want notifications from. Once the Client Properties window opens go to Universal Settings, at the bottom of the window you should see Server sends mail or Client sends mail, select client sends mail and enter the desired email address then click ok and close the NBU Admin Console and reopen it. during the next backup of that server you will receive an email from it with the name in the subject. As for the name of the policy, I do not know how to do this through the Admin Console, it will have to be through a script, in which I am working on.
12-04-2008 06:12 PM
As for the name of the policy, I do not know how to do this through the Admin Console, it will have to be through a script, in which I am working on.......?
thank, pls kindly update me is any script able to help me. current, i am using nbmail cmd script to pass the email notification. should i stop it if i got your script. or how i pass the subject name to this nbmail script.
pls guide me..totally need it .thank for help
regards
Tong
12-05-2008 03:38 PM
This is the way I have set the script set up to work, Please follow the instructions below.
Locate the nbmail.cmd file (%InstallDir%\Veritas\Netbackup\bin). You will need to add the following line email-PolicyStatus.vbs, to the section below and comment out the blat %TEMP%\nbmail.tmp -s %2 -t %1 -q line from nbmail.cmd. if you do not comment out the other line about the email-PolicyStatus.vbs you will receive two emails for each confirmation.
@copy /y %3 %TEMP%\nbmail.tmp > NUL
@IF "%~4"=="" (
::blat %TEMP%\nbmail.tmp -s %2 -t %1 -q
email-PolicyStatus.vbs
) ELSE (
blat %TEMP%\nbmail.tmp -s %2 -t %1 -q -attach %4
)
Copy and paste the code below into notepad and save it as a .vbs file. The file needs to be saved in the same location as the nbmail.cmd file. This directory is generally in the Veritas\Netbackup\bin folder.
You should then receive emails with the policy name in the subject line, as long as that policy was setup to have the server or client send the emails.
' *** CODE ***
' ***********************************************************
' **** Author: Chad Freiling ****
' **** Date: Dec. 5, 2008 ****
' **** ****
' **** Description: ****
' **** Finds a String in a Line read from a text file ****
' **** stores the policy name then emails the ****
' **** information to an email set in this file. ****
' **** ****
' **** This file must be in the following location ****
' **** %InstallPath%\VERITAS\NetBackup\bin ****
' **** Otherwise it will not work correctly. ****
' **** ****
' ***********************************************************
Dim x, strClient, strPolicy, strSize, strFile, strString ,strSearchString, strMatch
Dim BlatCMD, blatFile ' Path and File name that is sent out from netbackup server, generally it is nbmail.tmp
Const ForReading = 1
Const ForWriting = 2
' String to look for, this is not case sensitive, it will be converted to Upper Case
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "POLICY:" ' Change between the " " for string
' Path and Filename to search through
strFile = "BACKUP_EXIT_CALLED"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFile, ForReading)
Set objws = CreateObject("WScript.Shell")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("SYSTEM")
' tmp file that will be sent with the email, this file is created by NBU
' this file is generally found in C:\Windows\Temp\
blatFile = "C:\Windows\Temp\nbmail.tmp"
' Start to read through the file
Do Until objFile.AtEndOfStream
strSearchString = ucase(objFile.ReadLine)
Set colMatches = objRegEx.Execute(strSearchString)
If colMatches.Count > 0 Then
For Each strMatch in colMatches
' Remove all information but the policy name
strResult = trim(Replace(right(strSearchString, len(strSearchString) - instr(strSearchString, strMatch) + 1), strMatch, ""))
strResult = """Backup job completed for Policy " & strResult & """"
' *** Configuration for Blat to email information ***
' blatFile should be set to the tmp file that is normally sent
BlatCMD = "blat " & blatFile & " -to {removed email address} -s " & strResult
' Run Blat
objws.run BlatCMD
Next
End If
Loop
' *** END CODE ***
Hope this helps.
12-08-2008 07:02 PM
Hi,
thank for script. but fail to send any notification after configure step guide by you
pls refer below nbmail.cmd script
also, i already save the script as PolicyStatus.vbs.
@REM $Header: nbmail.cmd,v 1.3 2003/06/25 18:07:46 $@REM@REM bcpyrght@REM ***************************************************************************@REM * $VRTScprght: Copyright 1993 - 2004 VERITAS Software Corporation, All Rights Reserved $ *@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 three parameters on -@REM - the command line: -@REM - -@REM - %1 is the recipient's address -@REM - %2 is the subject line -@REM - %3 is the message file name -@REM - -@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@REM - -@REM - A public domain SMTP mail client for NT called BLAT is available at: -@REM - -@REM - http://www.interlog.com/~tcharron/blat.html -@REM - -@REM - Here's how to use BLAT with the NetBackup NT server. -@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@rem@blat %3 -s %2 -t %1 -i Netbackup -server www.mes.pen.maly.seagate.com -q@copy /y %3 %TEMP%\nbmail.tmp > NUL
@IF "%~4"=="" (
::blat %TEMP%\nbmail.tmp -s %2 -t %1 -q
email-PolicyStatus.vbs
) ELSE (
blat %TEMP%\nbmail.tmp -s %2 -t %1 -q -attach %4
)
@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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12-08-2008 09:44 PM
hi,
where i should put this script in nbmail.cmd and can i save that code you are give into as PolicyStatus.vbs
@copy /y %3 %TEMP%\nbmail.tmp > NUL
@IF "%~4"=="" (
::blat %TEMP%\nbmail.tmp -s %2 -t %1 -q
email-PolicyStatus.vbs
) ELSE (
blat %TEMP%\nbmail.tmp -s %2 -t %1 -q -attach %4
below is my original nbmail.cmd script file.
@REM $Header: nbmail.cmd,v 1.3 2003/06/25 18:07:46 $
@REM
@REM bcpyrght
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 1993 - 2004 VERITAS Software Corporation, All Rights Reserved $ *
@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 three parameters on -
@REM - the command line: -
@REM - -
@REM - %1 is the recipient's address -
@REM - %2 is the subject line -
@REM - %3 is the message file name -
@REM - -
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@REM - -
@REM - A public domain SMTP mail client for NT called BLAT is available at: -
@REM - -
@REM - http://www.interlog.com/~tcharron/blat.html -
@REM - -
@REM - Here's how to use BLAT with the NetBackup NT server. -
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@rem
@blat %3 -s %2 -t %1 -i Netbackup -server www.mes.pen.maly.seagate.com -q
@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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12-09-2008 07:29 PM
Hi,
Need advice urgent , after add some more script on nbmail.cmd. unable to get the email notification with
Error bpbrm(pid=484) cannot send mail to root on client mlysanbk.
i already save code as email-PolicyStatus.vbs
@REM $Header: nbmail.cmd,v 1.3 2003/06/25 18:07:46 $
@REM
@REM bcpyrght
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 1993 - 2004 VERITAS Software Corporation, All Rights Reserved $ *
@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 three parameters on -
@REM - the command line: -
@REM - -
@REM - %1 is the recipient's address -
@REM - %2 is the subject line -
@REM - %3 is the message file name -
@REM - -
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@REM - -
@REM - A public domain SMTP mail client for NT called BLAT is available at: -
@REM - -
@REM - http://www.interlog.com/~tcharron/blat.html -
@REM - -
@REM - Here's how to use BLAT with the NetBackup NT server. -
@REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@copy /y %3 %TEMP%\nbmail.tmp > NUL
@IF "%~4"=="" (
::blat %TEMP%\nbmail.tmp -s %2 -t %1 -i Netbackup -server www.mes.pen.maly.seagate.com -q
email-PolicyStatus.vbs
) ELSE (
blat %TEMP%\nbmail.tmp -s %2 -t %1 -i Netbackup -server www.mes.pen.maly.seagate.com -q -attach %4
)
@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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12-10-2008 08:56 AM
The pid is the job ploicy number that is given when the policy is ran. Also, you need to keep in mind how the client is setup in Netbackup. Is it setup to have the server send mail or the client sends mail.
Does the policy give you an error number? You can find out more information from the log file that was created during the process of the job. go to %InstallDir%\Veritas\Netbackup\logs\bpbrm (since it gave you the bpbrm(pid=484), you know it is in the bpbrm log folder, if you do not have a bpbrm folder in the logs dir then you will need to create one then run the job again. If you do have it, then locate the dated file for when the job ran, i.e. if you ran it on the 6th of Dec 2008 it will be 120608. Open the log file and do a search for 484 or the PID number. You can then look through and find an error number or reason.
Also, make sure that it is using the proper email server.
12-10-2008 06:34 PM
Hi,
in bpbrm log, i find out the error log below,
<16> bpbrm Exit: cannot send mail to root on client mlysanbk
<2> set_job_details: LOG 1228878601 16 bpbrm 484 cannot send mail to root on client mlysanbk
also, in master server, in client properties, for universal settings, I already set as server send mail
note: my configuration on email server is correct.
Gaik Tong