NSClient++ connection refused
Posted: Thu Oct 01, 2015 6:24 am
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?
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?