Reference http://www.nsclient.org/nscp/wiki/NRPEListener
Uncomment the configuration item under [nrpe] In nsclient \ NSC. ini
[Nrpe]
Port = 5666
Command_timeout = 60
; Allowed Parameters
Allow_arguments = 1
Allow_nasty_meta_chars = 0
Use_ssl = 1
Allowed_hosts = 192.168.1.0/24
Socket_timeout = 30
; # Manually add
Performance_data = 1
Change [nrpe client handlers] to [nrpe handlers] and add the test script or command
[Nrpe handlers]
; Check_other =-H 192.168.0.1-P 5666-C remote_command-A arguments
My_ping_check = scripts \ check_ping.bat $ arg1 $
My_udp_check = scripts \ check_udp.bat $ arg1 $
; # Monitoring memory
Check_mem = inject checkmem maxwarn = 80% maxcrit = 90% showall = Long TYPE = physical
You can use check_nrpe to add monitoring commands on the monitoring server. You can test the commands in the command line and then add them through centreon or manually.
#./Check_nrpe-H 192.168.1.196-P 5666-C my_udp_check-A 445
The content of the check_udp.bat file is as follows:
@ echo off
REM nrpe UDP port detection
set udp_port = % 1
netstat-an | find ": % udp_port % "| find" UDP "> NUL
If errorlevel 1 goto err
If errorlevel 0 goto OK
goto unknown
: Err
echo critical: port % udp_port % not listening
exit/B 1
: Unknown
echo unknown: something went wrong
exit/B 3
: OK
echo OK: Port % udp_port % working
exit/B 0