What plugin is suitable for monitor multiple port status

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
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

What plugin is suitable for monitor multiple port status

Post 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.
Regards,
JQ
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: What plugin is suitable for monitor multiple port status

Post 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
Former Nagios employee
https://www.mcapra.com/
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: What plugin is suitable for monitor multiple port status

Post by lmiltchev »

Thanks Matt!

@junqian1992, let us know if the solutions, posted by @mcapra worked for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Re: What plugin is suitable for monitor multiple port status

Post 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.
Regards,
JQ
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: What plugin is suitable for monitor multiple port status

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked