cancel
Showing results for 
Search instead for 
Did you mean: 

How to exclude 157/150 error on Blat

PhaniKumar82
Level 5
Partner

Team,

I need solution for the following issue

we have configured blat on our environment so using blat we are getting backup failure alert & based on that ticket will be created

 

Netbackup master server : 7.5.0.3 on windows 2008 R2

but isue is we want to exclude 157/150 error code since these are not actual failures but still we are getting tickets for these alerts but same way we have excluded status code 0 whihc is succesfully excluded but am not sure what wrong with mentioned error

 

i have attached nbmail script pelase help me to get rid of 157/150 error codes

 

Regards,

Phani Kumar

1 ACCEPTED SOLUTION

Accepted Solutions

Yasuhisa_Ishika
Level 6
Partner Accredited Certified

I have checked this on my lab machine. I believe this surely works.

SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F "tokens=5" %%i IN ("%2") DO SET STATUS=%%i
SET STATUS=!STATUS:~0,-1!
IF "%STATUS%"=="0" GOTO :EOF
IF "%STATUS%"=="90" GOTO :EOF
IF "%STATUS%"=="150" GOTO :EOF
IF "%STATUS%"=="157" GOTO :EOF
IF "%STATUS%"=="190" GOTO :EOF

View solution in original post

9 REPLIES 9

Yasuhisa_Ishika
Level 6
Partner Accredited Certified

You treated %errorlevel% as NetBackup status code, but it isn't. %errorlevel% is return code of previous command in batch file. You should modify your batch file as below.

Original:

FINDSTR /C:"media manager received no data for backup image" %3
IF {%errorlevel%}=={0} goto :EOF
FINDSTR /C:"termination requested by administrator" %3
IF {%errorlevel%}=={0} goto :EOF
FINDSTR /C:"was partially successful" %3
IF {%errorlevel%}=={0} goto :EOF
IF {%errorlevel%}=={90} goto :EOF
IF {%errorlevel%}=={150} goto :EOF
IF {%errorlevel%}=={157} goto :EOF
IF {%errorlevel%}=={190} goto :EOF

Modified:

FINDSTR /C:"media manager received no data for backup image" %3
IF {%errorlevel%}=={0} goto :EOF
FINDSTR /C:"termination requested by administrator" %3
IF {%errorlevel%}=={0} goto :EOF
FINDSTR /C:"was partially successful" %3
IF {%errorlevel%}=={0} goto :EOF
REM for status code 90
FINDSTR /C:"media manager received no data for backup image" %3
IF {%errorlevel%}=={0} goto :EOF
REM for status code 150
FINDSTR /C:"termination requested by administrator" %3
IF {%errorlevel%}=={0} goto :EOF
REM for status code 157
FINDSTR /C:"suspend requested by administrator" %3
IF {%errorlevel%}=={0} goto :EOF
REM for status code 190
FINDSTR /C:"found no images or media matching the selection criteria" %3
IF {%errorlevel%}=={0} goto :EOF

PhaniKumar82
Level 5
Partner

Hi

i have modified script as you said but stil getting 157 error code

 

FINDSTR /C:"media manager received no data for backup image" %3
IF {%errorlevel%}=={0} goto :EOF
FINDSTR /C:"termination requested by administrator" %3
IF {%errorlevel%}=={0} goto :EOF
FINDSTR /C:"was partially successful" %3
IF {%errorlevel%}=={0} goto :EOF
REM for status code 90
FINDSTR /C:"media manager received no data for backup image" %3
IF {%errorlevel%}=={0} goto :EOF
REM for status code 150
FINDSTR /C:"termination requested by administrator" %3
IF {%errorlevel%}=={0} goto :EOF
REM for status code 157
FINDSTR /C:"suspend requested by administrator" %3
IF {%errorlevel%}=={0} goto :EOF
REM for status code 190
FINDSTR /C:"found no images or media matching the selection criteria" %3
IF {%errorlevel%}=={0} goto :EOF
IF "%~4"=="" (

blat %3 -s %2 -t %1 -i NetBackup -server smtp.moc.com -q
)ELSE (
blat %3 -s %2 -t %1 -i NetBackup -server smtp.moc.com -q -attach %4

 

Regards,

Phani Kumar
)

Yasuhisa_Ishika
Level 6
Partner Accredited Certified

So, try this instead.


@ECHO OFF
FOR /F tokens=5 %%i IN ("%2") DO SET STATUS=%%i
SET STATUS=%STATUS:~0,-1%

IF "%STATUS%=="0" GOTO :EOF
IF "%STATUS%=="90" GOTO :EOF
IF "%STATUS%=="150" GOTO :EOF
IF "%STATUS%=="157" GOTO :EOF
IF "%STATUS%=="190" GOTO :EOF


 

PhaniKumar82
Level 5
Partner

Hi

Now we are not getting any mail from BLAT :( :(

Can you please modifiy the script and send as attachment so that will check and update you

 

Regards,

Phani Kumar

 

Yasuhisa_Ishika
Level 6
Partner Accredited Certified

Sorry, my previous post have an error. Please try this instead.

FOR /F tokens=5 %%i IN ("%2") DO SET STATUS=%%i
SET STATUS=%STATUS:~0,-1%
IF "%STATUS%"=="0" GOTO :EOF
IF "%STATUS%"=="90" GOTO :EOF
IF "%STATUS%"=="150" GOTO :EOF
IF "%STATUS%"=="157" GOTO :EOF
IF "%STATUS%"=="190" GOTO :EOF

PhaniKumar82
Level 5
Partner

Hi

 

Still no success ....we are not getting any mails for other backup failures also :(

Regards,

Phani Kumar

Yasuhisa_Ishika
Level 6
Partner Accredited Certified

I have checked this on my lab machine. I believe this surely works.

SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F "tokens=5" %%i IN ("%2") DO SET STATUS=%%i
SET STATUS=!STATUS:~0,-1!
IF "%STATUS%"=="0" GOTO :EOF
IF "%STATUS%"=="90" GOTO :EOF
IF "%STATUS%"=="150" GOTO :EOF
IF "%STATUS%"=="157" GOTO :EOF
IF "%STATUS%"=="190" GOTO :EOF

PhaniKumar82
Level 5
Partner

Yasuhisa Ishikawa,

 

Excellent :) Now its working fine

thank you very much for your help

 

Regards,

Phani Kumar

Anurag_Sharma
Level 3
Partner

Yasuhisa Ishikawa,

No Doubts excellent progamming work by you.

I'm one of the colleguage with Phani Kumar.

This script is sending and email for backup failures for all status codes apart from the excluded ones.

The subject of the email is " Backup on CLIENTNAME - STATUS CODE

for example

 

==============================================================================

 

From: NetBackup@xyz.com
Sent: Friday, December 07, 2012 9:42 AM
To: xx.com
Subject: Backup on PNORS474 - 50

 

Backup on client PNORS474 for user root by server MPS6741 failed.

 

Status = client process aborted.

 

Policy = Daily_Incr_2200_SAT_FULL

Schedule = DIFF

 

File list

---------

ALL_LOCAL_DRIVES

===============================================================================

 

We need you help in modifying the subject line from Backup on CLIENTNAME to Backup Failed on CLIENTNAME something like

from Backup on PNORS474 - 50 to Backup failed on PNORS474 - 50

 

If you go further down the script this the portion which determines the subject

 

==========================================================


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

 

IF "%~4"=="" (
blat %3 -s %2 -t %1 -i NetBackup -server smtp.moc.com -q
)ELSE (
blat %3 -s %2 -t %1 -i NetBackup -server smtp.moc.com -q -attach %4
)
 

===============================================================

-s is the varible with value %2 passed to the blat function/binary we some how need to modify that to reflect backup failed on instead of backup on.