Re: Network 8.4 on Windows + Nagios XI
Posted: Wed Jul 25, 2018 6:14 am
If I use the following
@Echo Off
@set ERRORS=0
@set status=Good
@del tmplog/%1-job.log 2> nul
@del tmplog/%1-ERRORS.log 2> nul
@Nsradmin -s EVS01BKP01 -i %1.txt >tmplog/%1-job.log
@more "tmplog/%1-job.log" |find /i /c "ERROR" >tmplog/%1-ERRORS.log
@for /f "tokens=1-3" %%i in (tmplog/%1-ERRORS.log) do (set ERRORS=%%i)
@if "%ERRORS%"=="0" goto ERRORSGOOD
@goto ERRORSBAD
@:ERRORSBAD
@set status=FAILED
@:ERRORSGood
@if "%ERRORS%" NEQ "0" @Echo job %1 has %status% with %ERRORS% Errors "| JOB-ERRORS=%ERRORS%;;;
exit /b 0
if "%ERRORS%" NEQ "0" exit 2
if "%ERRORS%" == "0" exit 1
I am still getting the invalid return code 255
Kindly Suggest
TIA
@Echo Off
@set ERRORS=0
@set status=Good
@del tmplog/%1-job.log 2> nul
@del tmplog/%1-ERRORS.log 2> nul
@Nsradmin -s EVS01BKP01 -i %1.txt >tmplog/%1-job.log
@more "tmplog/%1-job.log" |find /i /c "ERROR" >tmplog/%1-ERRORS.log
@for /f "tokens=1-3" %%i in (tmplog/%1-ERRORS.log) do (set ERRORS=%%i)
@if "%ERRORS%"=="0" goto ERRORSGOOD
@goto ERRORSBAD
@:ERRORSBAD
@set status=FAILED
@:ERRORSGood
@if "%ERRORS%" NEQ "0" @Echo job %1 has %status% with %ERRORS% Errors "| JOB-ERRORS=%ERRORS%;;;
exit /b 0
if "%ERRORS%" NEQ "0" exit 2
if "%ERRORS%" == "0" exit 1
I am still getting the invalid return code 255
Kindly Suggest
TIA