Page 1 of 1
How to check amount of connections on remote port
Posted: Mon Jun 15, 2015 8:03 am
by intern_nagios
Hi there,
Do you know if there is an way to check the amount of connections on a remote host/port? Let's say I want to know how many connections on port 1723 (VPN) on "server x" are active?
I tried a couple of "check connections" plugins on the Nagios Exchange but I can't make them check an remote host.
Thanks.
Re: How to check amount of connections on remote port
Posted: Mon Jun 15, 2015 8:07 am
by eloyd
You need to use an agent on the remote host to run the check and return results back to Nagios, or else use passive checks. Google for NRPE, or wrap checks in the check_by_ssh wrapper, or Google for Nagios passive checks.
Re: How to check amount of connections on remote port
Posted: Mon Jun 15, 2015 10:20 am
by jolson
Re: How to check amount of connections on remote port
Posted: Mon Jun 15, 2015 10:23 am
by eloyd
Sorry for my terseness. Was writing from smartphone.

Re: How to check amount of connections on remote port
Posted: Mon Jun 15, 2015 10:43 am
by abrist
@eloyd: terse, but correct nonetheless

@OP: eloyd is correct, you need to run the connections check from the remote host in order to collect the desired info.
Re: How to check amount of connections on remote port
Posted: Tue Jun 16, 2015 6:08 am
by intern_nagios
Thanks guys.
I use the plugin "check_connections.sh" to count the amount of connections on a to be determined port. The command to run the plugin is specified as following:
Code: Select all
define command{
command_name check_vpn_connections
command_line $USER1$/check_connections.sh -s all '( dport = :1723 )' -w 200 -c 300
}
In NRPE.cfg, I specified the following:
Code: Select all
command[check_vpn_connections]=/usr/lib64/nagios/plugins/check_connections.sh -s all '( dport = :1723 )' -w $ARG1$ -c $ARG2$
Something strange, is that the first 3 lines are yellow and red, but my line for the conncetions stays red.
command[check_dell_alertlog]=
/usr/lib64/nagios/plugins/check_openmanage –only alertlog
command[check_dell_critical]=
/usr/lib64/nagios/plugins/check_openmanage –only critical
command[check_dell_warning]=
/usr/lib64/nagios/plugins/check_openmanage –only warning
command[check_vpn_connections]=/usr/lib64/nagios/plugins/check_connections.sh -s all '( dport =
:1723 )' -w $ARG1$ -c $ARG2$
Afterwards, I restarted the NRPE service
The output is as following:
Code: Select all
[root@xxx plugins]# ./check_nrpe -H xxxx -c check_vpn_connections -a 20 30
NRPE: Command 'check_vpn_connections' not defined
I guess the color indicates I'm doing something wrong, as the output says the same. Does anyone have a clue?
Thanks
Re: How to check amount of connections on remote port
Posted: Tue Jun 16, 2015 9:33 am
by tmcdonald
The color itself is just syntax highlighting, but you're right in that it does look weird. NRPE is probably seeing that "dport =" part and hanging on that.
Can you try to modify the check_connections.sh script to hard-code in the -s all '( dport = :1723 )' part? That might be the easiest way short of patching NRPE (which would take a while).
Re: How to check amount of connections on remote port
Posted: Sun Jun 28, 2015 3:02 pm
by intern_nagios
I'm using an other plug-in now, that's not great but it should do the work. Thanks for cooperating.
Re: How to check amount of connections on remote port
Posted: Mon Jun 29, 2015 9:10 am
by tmcdonald
I'll be closing this thread now, but feel free to open another if you need anything in the future!