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?
NSClient++ connection refused
Re: NSClient++ connection refused
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.
me.
Re: NSClient++ connection refused
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!
Re: NSClient++ connection refused
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!