Nsclient uses the nrpe method + windows to detect the UDP port bat script

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.