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
Network 8.4 on Windows + Nagios XI
-
biswajit.banerjee
- Posts: 152
- Joined: Fri Dec 08, 2017 10:24 pm
Re: Network 8.4 on Windows + Nagios XI
The 255 code usually means that the script terminated unexpectedly so there is likely something above the exit line that is not working the way it should.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.