Page 1 of 2

NS Client Error after upgrade

Posted: Tue Mar 08, 2016 1:34 pm
by sutenag
System:

Nagios XI Version : 5.2.3
searnanpmon01.vix.local 2.6.32-358.2.1.el6.x86_64 x86_64
CentOS release 6.4 (Final)
Gnome is not installed
Apache Information

PHP Version: 5.3.3
Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Server Name: IP
Server Address:
Server Port: 80

We have some BOG/Jboss checkers that was in state unknown after we have upgrade our nagios server from 2012R1.7. After some research we found that the nsclient version 0.3.9 can be the source so we upgrade the client to 0.4.3 and now we got connection refused by host on this BOG checker

COMMAND: /usr/local/nagios/libexec/check_nrpe -u -H 10.208.85.30 -t 90 -c check_vix_pendingcards -a '0' '7'
OUTPUT: Connection refused by host

I attache the old NSC.ini file and the new nsclient.ini + the new log file from windows server

Re: NS Client Error after upgrade

Posted: Tue Mar 08, 2016 2:54 pm
by rkennedy
I also don't see a section for the NRPE settings in your configuration file. I just switched out your config with mine, and here are the changes I made to get yours working.

After your first allowed hosts (this section) -

Code: Select all

; Undocumented section
[/settings/default]

; Undocumented key
password = ergpass.123

; Undocumented key
allowed hosts = 10.203.1.6,10.247.40.26
add -

Code: Select all

[/settings/NRPE/server]
allowed_hosts = 10.203.1.6,10.247.40.26
; Undocumented key
verify mode = none

; Undocumented key
insecure = true

; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = 1

; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in 

arguments.
allow nasty characters = 1

; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = 1

; PORT NUMBER - Port to use for NRPE.
port = 5666

; EXTENDED RESPONSE - Send more then 1 return packet to allow response to go beyond payload size (requires modified client if legacy is true this defaults to 

false).
extended response = 0
Then, under the [/modules] section, add -

Code: Select all

; Undocumented key
NRPEServer = 1
That's just the explanation though, below is the full config file -

Code: Select all

; Undocumented section
[/settings/default]

; Undocumented key
password = ergpass.123

; Undocumented key
allowed hosts = 10.203.1.6,10.247.40.26

[/settings/NRPE/server]
allowed_hosts = 10.203.1.6,10.247.40.26
; Undocumented key
verify mode = none

; Undocumented key
insecure = true

; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = 1

; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in 

arguments.
allow nasty characters = 1

; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = 1

; PORT NUMBER - Port to use for NRPE.
port = 5666

; EXTENDED RESPONSE - Send more then 1 return packet to allow response to go beyond payload size (requires modified client if legacy is true this defaults to 

false).
extended response = 0

; Undocumented section
[/modules]
NRPEListener.dll
NSClientListener.dll
NRPEClient.dll
check_nrpe.dll

; Undocumented key
NRPEServer = 1


; Undocumented key
CheckExternalScripts = 1


; Undocumented key
CheckHelpers = 1

; Undocumented key
CheckEventLog = 1

; Undocumented key
CheckNSCP = 1

; Undocumented key
CheckDisk = 1

; Undocumented key
CheckSystem = 1

; Undocumented key
NSClientServer = 1

;# COMMAND ALLOW NASTY META CHARS
;  This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow_nasty_meta_chars=1

;# COMMAND ARGUMENT PROCESSING
;  This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed.
allow_arguments=1

;# SCRIPT DIRECTORY
;  All files in this directory will become check commands.
;  *WARNING* This is undoubtedly dangerous so use with care!
script_dir=c:\afc\scripts\nagios

[Script Wrappings]
vbs=cscript.exe //T:30 //NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS%
ps1=cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
bat=scripts\%SCRIPT% %ARGS%

[/External Scripts]
;check_es_long=scripts\long.bat
;check_es_ok=scripts\ok.bat
;check_es_nok=scripts\nok.bat
;check_vbs_sample=cscript.exe //T:30 //NoLogo scripts\check_vb.vbs
;check_powershell_warn=cmd /c echo scripts\powershell.ps1 | powershell.exe -command -
check_test=perl c:\afc\scripts\nagios\test.pl $ARG1$ $ARG2$
check_vix_pmstatus=perl c:\afc\scripts\nagios\pmstatus.pl $ARG1$
check_vix_pendingcards=perl c:\afc\scripts\nagios\check_vix_pendingorders.pl -f $ARG1$ -t $ARG2$ -c
check_vix_pendingproducts=perl c:\afc\scripts\nagios\check_vix_pendingproducts.pl
check_daily_ignore=perl c:\afc\scripts\nagios\check_daily_ignore.pl

[/External Alias]
alias_cpu=checkCPU warn=80 crit=90 time=5m time=1m time=30s
alias_cpu_ex=checkCPU warn=$ARG1$ crit=$ARG2$ time=5m time=1m time=30s
alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll=long type=physical type=virtual type=paged type=page
alias_up=checkUpTime MinWarn=1d MinWarn=1h

alias_disk=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED
alias_disk_loose=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED ignore-unreadable
alias_volumes=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll=volumes FilterType=FIXED
alias_volumes_loose=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll=volumes FilterType=FIXED ignore-unreadable 

alias_service=checkServiceState CheckAll
alias_service_ex=checkServiceState CheckAll "exclude=Net Driver HPZ12" "exclude=Pml Driver HPZ12" exclude=stisvc
alias_process=checkProcState "$ARG1$=started"
alias_process_stopped=checkProcState "$ARG1$=stopped"
alias_process_count=checkProcState MaxWarnCount=$ARG2$ MaxCritCount=$ARG3$ "$ARG1$=started"
alias_process_hung=checkProcState MaxWarnCount=1 MaxCritCount=1 "$ARG1$=hung"

alias_event_log=CheckEventLog file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated gt -2d AND severity NOT IN ('success', 'informational') AND 

source != 'SideBySide'" truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)"

alias_file_size=CheckFiles "filter=size > $ARG2$" "path=$ARG1$" MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" max-dir-depth=10
alias_file_age=checkFile2 filter=out "file=$ARG1$" filter-written=>1d MaxWarn=1 MaxCrit=1 "syntax=%filename% %write%"

alias_sched_all=CheckTaskSched "filter=exit_code ne 0" "syntax=%title%: %exit_code%" warn=>0
alias_sched_long=CheckTaskSched "filter=status = 'running' AND most_recent_run_time < -$ARG1$" "syntax=%title% (%most_recent_run_time%)" warn=>0
alias_sched_task=CheckTaskSched "filter=title eq '$ARG1$' AND exit_code ne 0" "syntax=%title% (%most_recent_run_time%)" warn=>0

alias_updates=check_updates -warning 0 -critical 0

check_ok=CheckOK Everything is fine!
Let us know if you run into any issues.

Re: NS Client Error after upgrade

Posted: Wed Mar 09, 2016 8:14 am
by sutenag
This solve the critical state with connection refused by host, now its on unknown status.

Run command from ssh putty

[root@searnanpmon01 ~]# /usr/local/nagios/libexec/check_nrpe -u -H 10.208.85.30 -t 90 -c check_vix_pendingcards -a '0' '7'
Unknown command(s): check_vix_pendingcards

In the log file i see , attahed
2016-03-09 14:09:25: error:D:\source\nscp\include\nscapi\nscapi_core_helper.cpp:95: Failed to execute command: check_vix_pendingcards

That path does not exist on the server, the scripts are under C:\AFC\scripts\nagios\, is this the main problem to this? Seems obviously. Question is only how to fix it.

have attache a screen over the service

This is the problem that needs to be solved.

This is the configuration in the nsclient.ini file:

check_vix_pendingcards=perl c:\afc\scripts\nagios\check_vix_pendingorders.pl -f $ARG1$ -t $ARG2$ -c
check_vix_pendingproducts=c:\perl\bin\perl.exe c:\afc\scripts\nagios\check_vix_pendingproducts.pl

The entire path to the perl script is given and can be run on the command line from the server cmd

C:\Program Files\NSClient++>c:\perl\bin\perl.exe c:\afc\scripts\nagios\check_vix_pendingproducts.pl
OK - No files older than one hour found

Re: NS Client Error after upgrade

Posted: Wed Mar 09, 2016 10:03 am
by lmiltchev
I don't see the "check_vix_pendingcards" command defined anywhere in the "nsclient.ini" file... Can you show us a latest "nsclient.ini" file, where you have this command defined?

Re: NS Client Error after upgrade

Posted: Wed Mar 09, 2016 10:21 am
by sutenag
Have pm you the ini file, its defined in the last section
[/External Scripts]

Think i have add this wrong can you help me how this should look like.

Re: NS Client Error after upgrade

Posted: Wed Mar 09, 2016 10:48 am
by lmiltchev
Can you remove the single quotes from your command? Try:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -u -H 10.208.85.30 -t 90 -c check_vix_pendingcards -a 0 7
Did this work?

Edit: I forgot to mention that your command seems to be defined properly. I don't see why you are getting "That path does not exist on the server" errors. Did you restart NSClient++ service after modifying the "nsclient.ini" file?

I dont' have any perl scripts that I can test, but I placed my "check_winfile.exe" script in a "non-default" directory, similar to yours:

Code: Select all

check_winfile_alt = C:\AFC\scripts\nagios\check_winfile.exe //T:30 //NoLogo $ARG1$
My check, ran from the CLI in Nagios XI seems to be working with the "custom" path:

Code: Select all

[root@localhost libexec]# ./check_nrpe -H x.x.x.x -c check_winfile_alt -a '--target C:\TEMP\check_license.sh'
FILE OK - 1 files to consider |'selected files'=1 'all files'=1 'deleted files'=0

Re: NS Client Error after upgrade

Posted: Wed Mar 09, 2016 11:06 am
by sutenag
output:
[root@searnanpmon01 libexec]# ./check_nrpe -u -H 10.208.85.30 -t 90 -c check_vix_pendingcards -a 0 7
Unknown command(s): check_vix_pendingcards

yes i have restart the nsclient service servals time

Can it help you if i pm you the perl script?

I see that the file is named check_vix_pendingcards.pl in the checker its only defined as check_vix_pendingcards no .pl ??

Re: NS Client Error after upgrade

Posted: Wed Mar 09, 2016 11:21 am
by lmiltchev
Can it help you if i pm you the perl script?
It may help - we will try to recreate the issue in house. It will take some time though.

Run the following command, and show the output:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 10.208.85.30

Re: NS Client Error after upgrade

Posted: Wed Mar 09, 2016 11:24 am
by sutenag
output
[root@searnanpmon01 libexec]# /usr/local/nagios/libexec/check_nrpe -H 10.208.85.30
I (0.4.3.143 2015-04-29) seem to be doing fine...

Have pm you the perl script

fyi Sean Sax did the upgrade and have also fix our webinject problem we had after the upgrade

Re: NS Client Error after upgrade

Posted: Wed Mar 09, 2016 11:48 am
by ssax
I've sent you a PM with an updated nsclient.ini to test with, let us know the results.