Network 8.4 on Windows + Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
biswajit.banerjee
Posts: 152
Joined: Fri Dec 08, 2017 10:24 pm

Re: Network 8.4 on Windows + Nagios XI

Post 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".
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Network 8.4 on Windows + Nagios XI

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
biswajit.banerjee
Posts: 152
Joined: Fri Dec 08, 2017 10:24 pm

Re: Network 8.4 on Windows + Nagios XI

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Network 8.4 on Windows + Nagios XI

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
biswajit.banerjee
Posts: 152
Joined: Fri Dec 08, 2017 10:24 pm

Re: Network 8.4 on Windows + Nagios XI

Post by biswajit.banerjee »

Sorry for the delayed response .

When we run as suggested , it closes the command prompt .
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Network 8.4 on Windows + Nagios XI

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
biswajit.banerjee
Posts: 152
Joined: Fri Dec 08, 2017 10:24 pm

Re: Network 8.4 on Windows + Nagios XI

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Network 8.4 on Windows + Nagios XI

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
biswajit.banerjee
Posts: 152
Joined: Fri Dec 08, 2017 10:24 pm

Re: Network 8.4 on Windows + Nagios XI

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Network 8.4 on Windows + Nagios XI

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked