NSClient++ connection refused

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
viopoule
Posts: 2
Joined: Thu Oct 01, 2015 6:00 am

NSClient++ connection refused

Post by viopoule »

Hi,

I have installed nagios to monitor remote hosts. I am using NSClient++ to run checks on remote Windows machines. These checks include external Powershell scripts to get specific results like Top 5 cpu consuming processes and others that don't come with NSClient by default. Everything was running perfectly fine until I decided to add new checks that according to the content of a config file would check if a specific process is running (given as an argument), and give different results if it's running or not. I added the following to the nsclient.ini file:

[/settings/external scripts/scripts]
;check process is running
Services_status = cmd /c echo scripts\Services_status.ps1 "--argument" "$ARG1$"; exit($lastexitcode) | powershell.exe -command -
Services_status_aa = cmd /c echo scripts\Services_status_aa.ps1 "--argument" "$ARG1$"; exit($lastexitcode) | powershell.exe -command -

and I also included the scripts (Services_status.ps1 and Service_status_aa.ps1) in the ../scripts folder.

I tested their execution by running nscp test and then the appropriate command and I restarted NSClient++. Afterwards, I run the check on nagios:

bash-4.1$ ./check_nrpe -H 10.76.218.10 -c Services_status -a Indices.EmailReportPublisher
Indices.EmailReportPublisher is Stopped

Everything was fine up to that point, but the problem was created when I tried the exact same process in another host. After the execution from nagios I get:

bash-4.1$ ./check_nrpe -H 10.89.44.171 -c Services_status -a Indices.EmailReportPublisher
Connection refused by host

Something seems to have been broken on the remote Windows machine since neither check_nrpe nor check_nt are returning what they are expected to.

Can you please help?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: NSClient++ connection refused

Post by hsmith »

Can you look at the NSClient.ini or nsc.ini for errors? Post it here if you want another set of eyes to look it over.
Former Nagios Employee.
me.
viopoule
Posts: 2
Joined: Thu Oct 01, 2015 6:00 am

Re: NSClient++ connection refused

Post by viopoule »

I managed to fix this by completely uninstalling NSClient and then doing a complete installation from scratch (typical and custom installations didn't work). It's strange because although I could add the new checks in one server, I was getting the same error in the next two I tried, and like I said, the fix was to install NSClient again. Thanks for your help!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NSClient++ connection refused

Post by lmiltchev »

I am glad your issue has been resolved! I am locking the thread.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked