Port checking difficulties
Posted: Tue Aug 23, 2016 2:13 pm
I'm trying to check if a port is listening and haven't had much success.
I first tried using the check_listen_tcp_udp.sh script out on the host that is running the service I want to monitor
https://exchange.nagios.org/directory/P ... sh/details
This is my command definition out on the remote host;
This runs successfully on my remote host;
This is the service as defined on my nagios server;
I use nrpe for other commands successfully on this server but this one fails when I run the test;
I was not able to resolve this and thought to change my method by checking the port from *outside* of the remote host with the pre-existing tcp_check command.
I am able to successfully check a port on the remote host from the nagios server;
This is the pre-existing command definition in commands.cfg on the nagios server;
This is how the service is defined in localhost.cfg;
This doesn't work, the services pages shows this failure;
I've invested a pretty good amount of time with the docs and with Google, but I'm still missing something. Any help would be apprecieated.
I'm also interested in thoughts related to the merits of checking whether the port is listening from the client, or contactable via an external command.
Thanks, Rob
I first tried using the check_listen_tcp_udp.sh script out on the host that is running the service I want to monitor
https://exchange.nagios.org/directory/P ... sh/details
This is my command definition out on the remote host;
Code: Select all
command[check_nexus_listen]=/usr/lib64/nagios/plugins/check_listen_tcp_udp.sh -p 8070 -P tcpCode: Select all
# /usr/lib64/nagios/plugins/check_listen_tcp_udp.sh -p 8070 -P tcp
OK - Listening on :::8070 (protocol: tcp)Code: Select all
define service{
use generic-service
host_name nexusfirewall
service_description Nexus listening port
check_command check_nrpe!check_nexus_listen
}Code: Select all
[root@engmon objects]# /usr/local/nagios/libexec/check_nrpe -H 10.177.177.220 -c check_total_procs
PROCS OK: 381 processes | procs=381;600;700;0;
[root@engmon objects]# /usr/local/nagios/libexec/check_nrpe -H 10.177.177.220 -c check_nexus_listen
NRPE: Unable to read outputI am able to successfully check a port on the remote host from the nagios server;
Code: Select all
# /usr/local/nagios/libexec/check_tcp -H 10.177.177.220 -p 8070
TCP OK - 0.001 second response time on 10.177.177.220 port 8070|time=0.001022s;;;0.000000;10.000000Code: Select all
# 'check_tcp' command definition
define command{
command_name check_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
}
Code: Select all
define service{
use local-service
host_name engmon
service_description tcp8070 on Nexusfirewall
check_command check_tcp!10.177.177.220!8070
}
Code: Select all
tcp8070 on Nexusfirewall UNKNOWN 08-23-2016 15:06:04 0d 1h 3m 25s 4/4 check_tcp: Port must be a positive integer I'm also interested in thoughts related to the merits of checking whether the port is listening from the client, or contactable via an external command.
Thanks, Rob