Nsclient not response on Windows client.

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
Ensenada
Posts: 2
Joined: Fri Jun 18, 2021 1:36 am

Nsclient not response on Windows client.

Post by Ensenada »

Hello,

Im trying to configure NRPE check on nagios on windows client, this is the nsclient.ini:

Code: Select all

[/settings/log]

; LOG LEVEL - Log level to use. Available levels are error,warning,info,debug,trace
level = info
; DATEMASK - The size of the buffer to use when getting messages this affects the speed and maximum size of messages you can recieve.
date format = %Y-%m-%d %H:%M:%S
; FILENAME - The file to write log data to. Set this to none to disable log to file.
file name = ${exe-path}/nsclient.log

; A list of modules.
[/modules]

; CheckDisk - CheckDisk can check various file and disk related things.
CheckDisk = 1
; CheckEventLog - Check for errors and warnings in the event log.
CheckEventLog = 1
; CheckExternalScripts - Execute external scripts
CheckExternalScripts = 1
; CheckHelpers - Various helper function to extend other checks.
CheckHelpers = 1
; CheckNSCP - Use this module to check the health and status of NSClient++ itself
CheckNSCP = 1
; CheckSystem - Various system related checks, such as CPU load, process state, service state memory usage and PDH counters.
CheckSystem = 1
; NRPEServer - A server that listens for incoming NRPE connection and processes incoming requests.
NRPEServer = 1
; CheckTaskSched - Check status of your scheduled jobs.
CheckTaskSched = 1
; WEBServer - A server that listens for incoming HTTP connection and processes incoming requests. It provides both a WEB UI as well as a REST API in addition to simplifying configuration of WEB Server module.
WEBServer = 1
; CheckNet - Network related check such as check_ping.
CheckNet = 1

; Section for REST API
[/settings/WEB/server]

; ALLOWED HOSTS - A coma separated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = 0.0.0.0/0

;CACHE ALLOWED HOSTS - If host names (DNS entries) should be cached, improves speed and security somewhat but won’t allow you to have dynamic IPs for your Nagios server.
cache allowed hosts = true

; PORT NUMBER - Port to use for REST API.
port = 8443

; CERTIFICATE - Ssl certificate to use for the ssl server
certificate = ${certificate-path}/certificate.pem

; Section for REST API roles
[/settings/WEB/server/roles]

limited=*.get

; Section for REST API users
[/settings/WEB/server/users/centreon]

password=
role=limited

; Section for NRPE (NRPEServer.dll) (check_nrpe) protocol options.
[/settings/NRPE/server]

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

; 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 = true

; ALLOWED HOSTS - A coma separated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = NagiosIP

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

; Needed for long output, with check_centreon_nrpe
payload length = 8192
 
; EXTENDED RESPONSE - Send more then 1 return packet to allow response to go beyond payload size (requires modified client).
; extended response = true 
 
; ALLOW INSECURE CHIPHERS and ENCRYPTION - Only enable this if you are using legacy check_nrpe client.
insecure = true

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

[/settings/external scripts]
allow arguments = 1
allow nasty characters = 1

[/settings/external scripts/scripts/default]
ignore perfdata = true

[/settings/external scripts/scripts]
check_logfiles=scripts\\centreon\\check_logfiles.exe $ARG1$
check_centreon_plugins=scripts\\centreon\\centreon_plugins.exe --plugin=$ARG1$ --mode=$ARG2$ $ARG3$

test=cscript.exe //T:30 "C:\Program Files\Centreon NSClient++\scripts\powershell.ps1"
When i try to call powershell.ps1:

Code: Select all

./check_nrpe -H serverIP -p 5666 -t 20 test
There is no response, but a timeout error. Firewall access its open.

Do I have to set a password in nsclient.ini? In this case, where do I have to configure it in Nagios console?

Thanks,
Best regards
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nsclient not response on Windows client.

Post by mcapra »

You might try calling powershell instead of cscript. Here's a common NSClient++ command template for Powershell scripts, from the official docs:

Code: Select all

test=cmd /c echo scripts\powershell.ps1; exit($lastexitcode) | powershell.exe -command -
I'd have to see the specific contents of the Powershell script to offer much more insight than that.
Former Nagios employee
https://www.mcapra.com/
Ensenada
Posts: 2
Joined: Fri Jun 18, 2021 1:36 am

Re: Nsclient not response on Windows client.

Post by Ensenada »

Thanks for the answer but still not work.

The script is a test file: write-host "WARN: Everything is not going to be fine!"

I also try with another .vbs script and response its the same.

I think that i must change something on nagios server, but i dont know what
Locked