Page 1 of 1

What plugin is suitable for monitor multiple port status

Posted: Tue Dec 04, 2018 1:42 am
by junqian1992
Hi all,
I want to monitor all the port on the server by using nrpe.
The check_listen_tcp_udp can check the port status, but if the server exist many port is very hard to configure since i need to configure many plugin command on the nrpe.conf.
can recommend what plugin is suitable for me to monitor port range ? like tcp 5000 to 5200 port. if one port down it will critical.

Thank you.

Re: What plugin is suitable for monitor multiple port status

Posted: Tue Dec 04, 2018 10:11 am
by mcapra
junqian1992 wrote:The check_listen_tcp_udp can check the port status, but if the server exist many port is very hard to configure since i need to configure many plugin command on the nrpe.conf.
check_multi is one way to work around that constraint.

This plugin can check a TCP port range:
https://github.com/gavincarr/nagios-of- ... _tcp_range

You could create a check_udp subroutine that looks almost identical to the check_tcp subroutine, with the protocol set to UDP instead of assuming a default. Call that on line 45 with an "and" conditional.

Docs for that Perl module:
https://perldoc.perl.org/IO/Socket/INET.html

Re: What plugin is suitable for monitor multiple port status

Posted: Tue Dec 04, 2018 3:16 pm
by lmiltchev
Thanks Matt!

@junqian1992, let us know if the solutions, posted by @mcapra worked for you.

Re: What plugin is suitable for monitor multiple port status

Posted: Wed Dec 05, 2018 9:05 pm
by junqian1992
Hi,
@mcapra Thanks for your suggestion.
Last night i try to run the check_multi on my server is working, but my server is more than 300++ port, i only monitor 100 port it cause the CPU high load, the check command is using check_listening_tcp_udp.

example:

Code: Select all

#command[check_open_port_status2]=/usr/lib64/nagios/plugins/check_multi -f /usr/lib64/nagios/plugins/openport/open_port2.cmd
#command[check_open_port_status3]=/usr/lib64/nagios/plugins/check_multi -f /usr/lib64/nagios/plugins/openport/open_port3.cmd
#command[check_open_port_status4]=/usr/lib64/nagios/plugins/check_multi -f /usr/lib64/nagios/plugins/openport/open_port4.cmd
#command[check_open_port_status5]=/usr/lib64/nagios/plugins/check_multi -f /usr/lib64/nagios/plugins/openport/open_port5.cmd
#command[check_open_port_status6]=/usr/lib64/nagios/plugins/check_multi -f /usr/lib64/nagios/plugins/openport/open_port6.cmd
each open_port*.cmd got 20 check command, and i set it running every 5min.

and the TCP port range plugin unable to run it, it show :

Code: Select all

Can't locate Nagios/Plugin/Getopt.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./check_tcp_range lineke/Getopt.pm

[root@nagios-serverxxxx libexec]# find / -name Getopt.pm
/usr/local/share/perl5/Nagios/Monitoring/Plugin/Getopt.pm
/usr/share/autoconf/Autom4te/Getopt.pm
/usr/share/automake-1.13/Automake/Getopt.pm
i have try to reinstall perl also encountered same error.

Re: What plugin is suitable for monitor multiple port status

Posted: Thu Dec 06, 2018 10:14 am
by lmiltchev
It seems like you are missing the perl-Nagios-Plugin. On RHEL/CentOS you can install it by running:

Code: Select all

yum install perl-Nagios-Plugin -y
Note: The package is provided by the epel repo. If you don't have it enabled, you should do so before running the command above.