Page 2 of 3
Re: Network 8.4 on Windows + Nagios XI
Posted: Tue Jun 19, 2018 12:24 am
by biswajit.banerjee
Hi,
As per suggestion, we perform below steps.
Firstly go to command prompt. then
cd C:\Program Files\NSClient++\scripts\
run:
Check_Networker_Job.bat EVS01CRS01
And get output is.
we got one file and it has below content.
Invalid switch - "EVS01CRS01-ERRORS.log".
Re: Network 8.4 on Windows + Nagios XI
Posted: Tue Jun 19, 2018 10:23 am
by cdienger
Edit the script and change lines 4 and 5 to:
@del tmplog/%1-job.log 2> nul
@del tmplog/%1-ERRORS.log 2> nul
Run the script again from the Windows' command line and let us know the results. If it looks good, try again from the XI command line.
Re: Network 8.4 on Windows + Nagios XI
Posted: Wed Jun 20, 2018 2:22 am
by biswajit.banerjee
Hi,
We have replaced given two line as per suggestion.
Now when we check it on command prompt by nscp test it giving below output.
The command (checknetworkerjob) returned an invalid code:255
One output file is not getting by name 1 now.
And when we checking from nagios server we getting below.
[root@evs01nsg01 libexec]# ./check_nrpe -H 172.16.5.226 -c checknetworkerjob
The command (checknetworkerjob) returned an invalid return code: 255
Please suggest, in check_networker_job script line number 6 below content is given.
@Nsradmin -s EVS01BKP01 -i %1.txt >tmplog/%1-job.log
Please confirm EVS01BKP01 is right or not because it's a networker backup server name.
Re: Network 8.4 on Windows + Nagios XI
Posted: Wed Jun 20, 2018 11:27 am
by cdienger
I cannot say if the options provided to the nsradmin command are correct since it is a third party tool. This should be something to test though on the Windows server:
nsradmin -s EVS01BKP01 -i test.txt >tmplog/test-job.log
Re: Network 8.4 on Windows + Nagios XI
Posted: Thu Jun 28, 2018 4:26 am
by biswajit.banerjee
Sorry for the delayed response .
When we run as suggested , it closes the command prompt .
Re: Network 8.4 on Windows + Nagios XI
Posted: Thu Jun 28, 2018 10:11 am
by cdienger
That sounds unexpected. You'll need to look into the nsradmin command to make sure it is able to run and return valid data.
Re: Network 8.4 on Windows + Nagios XI
Posted: Fri Jul 20, 2018 5:00 am
by biswajit.banerjee
Hi
We have modified the script and geting the output of
Check_Networker_Job.bat EVS01CRS01
Job EVS01CRS01 est GOOD avec 0 ERRORS | JOB-ERRORS=0;;;
But nscp test or call from Nagios is still giving invalid return code 255
Can you suggest any way out .
thanks
Re: Network 8.4 on Windows + Nagios XI
Posted: Fri Jul 20, 2018 8:22 am
by cdienger
The nsclient log may have some more information. I would also try removing the last to lines of logic check for error count and just try to exit with a 0. I think this can be done with the line:
...
@:ERRORSGood
@Echo le job %1 est %status% avec %ERRORS% ERREURS "| JOB-ERRORS=%ERRORS%;;;
@exit 0
Re: Network 8.4 on Windows + Nagios XI
Posted: Tue Jul 24, 2018 1:27 am
by biswajit.banerjee
After @exit 0 , command prompt of Windows is closing , which is the same issue earlier .
Also Nagios query and nscp test is faling with 255 code .
Can you suggest more on this .
Thanks
Re: Network 8.4 on Windows + Nagios XI
Posted: Tue Jul 24, 2018 2:15 pm
by cdienger
I commented some stuff out just to test the returning values and have had success with:
@Echo Off
set ERRORS=0
set status=Good
::del tmplog/%1-job.log 2>1>nul
::del tmplog/%1-ERRORS.log 2>1>nul
::Nsradmin -s frroilegp01 -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
::Echo le job %1 est %status% avec %ERRORS% ERREURS "| JOB-ERRORS=%ERRORS%;;;
echo test99
exit /b 0
if "%ERRORS%" NEQ "0" exit 2
if "%ERRORS%" == "0" exit 1
Note that the 255 error usually means there is an error in the script prior to the actual exiting and I had to use "exit /b <exit_code>" to return the exit codes.