Video Screencast Help

BLAT and NBMAIL.CMD, NBU 7 on WIN 2008R2

Created: 08 Apr 2010 • Updated: 16 Oct 2010 | 14 comments
Kenneth Hansen's picture
This issue has been solved. See solution.

Hi, have any body got this to work?

Netbackup 7 installed on Windows 2008 R2, Blad version 262.
Running the command:
blat c:\test.txt -s test_subject -to mail@recipient.com works fine, mail arrives.

But using NBMAIL.CMD with this string:
 blat %3 -s %2 -t %1 -i NETBACKUP_MASTER -server mail.recipient.com -q
) ELSE (
 blat %3 -s %2 -t %1 -i NETBACKUP_MASTER -server mail.recipient.com -q -attach %4
)

Does not work.

I use the same NBMAIL-CMD on a NBU 7 install on win dows 2003 X64 with no problem.

Need some  help here please :)

Edited: Corrected -server option ( used a @ instead of . just a typo my script is correct )

Comments 14 CommentsJump to latest comment

Kenneth Hansen's picture

Is there one one that testet blat on win 2008 R2 with NBU 7??

Yasuhisa Ishikawa's picture

Does this really work on Windows 2003?
Is your SMTP server specified by -server option(with @ char) correct?

Authorized Symantec Consultant(ASC) Data Protection in Tokyo, Japan

Kenneth Hansen's picture

Hi, Sorry no it's a type in the thread. Statement is:
-SERVER smtp.server.com
Meanig no @ in there.. 

But, fore some reason NBU does not use the script and no mail is sent. Have you got this successfully working on 2008 R2?

Corrected:

But using NBMAIL.CMD with this string:
blat %3 -s %2 -t %1 -i NETBACKUP_MASTER -server mail.recipient.com -q
) ELSE (
blat %3 -s %2 -t %1 -i NETBACKUP_MASTER -server mail.recipient.com -q -attach %4
)

Reagan's picture

Blat.exe should be placed in C:\Windows\System32 directory before running the install command.

In the older docs, it mentions to place Blat.exe into C:\Windows\WINNT\System32, which doesn't exist in Windows 2008.

Should work.  I got it working on Windows 2008 R2. 

If not, try specifying the complete path for blat in the nbmail.cmd file.

the nbmail.cmd file should be placed in the /netbackup_install_path/bin directory.

Kenneth Hansen's picture

Hi R,
 Yeah Blat.exe is located in C:\Windows\System32\ when installed.
As I said earlier, I can use blat c:\test.txt -s TEST1 -to mail@recipient.com and this workes fine.

Could I ask for some one to post a working script, just change the email to some thine generic so I can try to verify with a working script..
Would be great :)

Thanks

Reagan's picture

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

@REM

@REM bcpyrght

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

@REM * $VRTScprght: Copyright 1993 - 2009 Symantec 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 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
@IF "%~4"=="" (

blat %3 -s %2 -t %1 -i Netbackup_server_name -server mail.acme.com -q
) ELSE (
blat %3 -s %2 -t %1 -i Netbackup_server_name -server mail.acme.com -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

@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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Kenneth Hansen's picture

I've done some more testing on this subject. 

I've enabled logging on my master server, and I get this error:

12:51:55.281 [2820.6884] <2> sendViaMapi: attempting to send mail
12:51:55.297 [2820.6884] <2> sendViaMapi: MAPILogon error (-2147467259).You may have to setup a mail profile for the NetBackup mail account (NetBackup).
12:51:55.297 [2820.6884] <16> process_requests: couldn't send mail message to backup@someone.no

 Netbackup account configured for Blat dows work sendig test mail using blat commands, and this account is configured in nbmail.bat

I guess this  have something to do with the user right on the account running the NBU Services. I Use local system account to run all NBU services. 

I looked at:
http://seer.entsupport.symantec.com/docs/256043.htm
And
http://seer.entsupport.symantec.com/docs/254809.htm

This points me in the direction that I need to setup a service account to run the service's and that this service account need to have send as rights..

Any Ideas?

Karthikeyan Sundaram's picture

confirm if any notification scripts work. A good script to test is backup_notify.cmd*. If the message generated by backup_notify.cmd is received but a message similar to the one above is not, then the nbmail.cmd message is getting blocked.

http://seer.entsupport.symantec.com/docs/243482.htm

Thanks, Karthikeyan Sundaram.

Kenneth Hansen's picture

Thanks for the reply.
I did find out why nbmail.cmd did not send any emails. Reason was that wrong user had owner ship of the file.
My Admin user was the own on the file, I changed it to local administrator and mail was sent. 

But I do want to test backup_notify.cmd as Karthikeyan suggest. But I'm not sure how the syntax for testing this should be.
I've looked in admin guide, and found syntax but I'm not able to recive any emails, and this is on the system that does send status updates when jobs run automaticly.
Do I need to edit the backup_exit_notify.cmd file? What am I missing.

Can anyone help?

Orca's picture

At my site Blat won't run at all..
I'll get a Windows error message that blat has crashed.

I ran the blat -install and that worked fine and put the entered details into the registry.

When I run blat from command-line it will not send a message..

Any details I should add?

Nemesis21's picture
if %5 equ 0 clemail.exe -fromname NBU -from backup@mail.com -to backup@mail.com -body "Backup %2 %1 %4 %5 OK" -subject " Backup %2 %1 %4 %5 OK" -smtpserver mx1.mail.com -quiet
if %5 equ 0 goto fine
if %5 equ 1 clemail.exe -fromname NBU -from backup@mail.com -to backup@mail.com -body "Backup %2 %1 %4 %5 WARNING" -subject " Backup %2 %1 %4 %5 WARNING" -smtpserver mx1.mail.com -quiet
if %5 equ 1 goto fine
clemail.exe -fromname NBU -from backup@mail.com -to backup@mail.com -body "Backup %2 %1 %4 %5 FAILED" -subject " Backup %2 %1 %4 %5 FAILED" -smtpserver mx1.mail.com -quiet
:fine

You can use blat instead clemail

 

Deepak W's picture

Not sure why are you guys using BLAT for NetBackup 7 :(

NetBackup OpsCenter comes bundled for the NetBackup 7 customer and gives you a very robust reporting for NBU 7 environments.

 

-- Deepak W (Kindly close the thread if your query is resolved)

Kenneth Hansen's picture

Hi,

 

I've final found my problem. It was one of the easy one to overlook but non the less.
Running the blad -install in cmd promt, I did not start cmd as an administrator.

I did how ever find a few useful tech notes:

http://seer.entsupport.symantec.com/docs/254809.htm
http://seer.entsupport.symantec.com/docs/314075.htm
http://seer.entsupport.symantec.com/docs/245217.htm
http://seer.entsupport.symantec.com/docs/256043.htm
http://seer.entsupport.symantec.com/docs/243884.htm

Its the last link that solved my problem, only I modified it a bit:
blat %3 -s %2 -t %1 -i Netbackup >>"C:\program files\veritas\netbackup\logs\nbmail_test.txt"
)

This gave me this error:

Blat v2.6.2 w/GSS encryption (build : Feb 25 2007 12:06:19)
 
Failed to open registry key for Blat
To set the SMTP server's name/address and your username/email address for that
server machine do:
blat -install  server_name  your_email_address
or use '-server <server_name>' and '-f <your_email_address>'
aborting, nothing sent
Blat v2.6.2 w/GSS encryption (build : Feb 25 2007 12:06:19)

Seeing this error I found that installing not running cmd as Administrator install did not work. Even though my user is in the local admin group.

SOLUTION