how can find and monitor specific port

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
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

how can find and monitor specific port

Post by baber »

Dear all

Hi

i have an application that run on tomcat if tomcat service is down my application not work means wen i get ps -ef | grep java

Code: Select all


ps -ef | grep java

root     21012     1  1 Nov20 ?        06:43:25 /opt/jre1.8.0_31/bin/java -Djava.util.logging.config.file=/usr/local/tomcat-p2/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server -Xms16g -Xmx24g -Djava.endorsed.dirs=/usr/local/tomcat-p2/endorsed -classpath /usr/local/tomcat-p2/bin/bootstrap.jar:/usr/local/tomcat-p2/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat-p2 -Dcatalina.home=/usr/local/tomcat-p2 -Djava.io.tmpdir=/usr/local/tomcat-p2/temp org.apache.catalina.startup.Bootstrap start
and use this for find port

Code: Select all


netstat -ntpl | grep java

tcp        0      0 :::18443                    :::*                        LISTEN      21012/java
tcp        0      0 :::8081                     :::*                        LISTEN      21012/java
tcp        0      0 ::ffff:127.0.0.1:18005      :::*                        LISTEN      21012/java
tcp        0      0 :::18009                    :::*                        LISTEN      21012/java


now i want chk this is running or not and just thing i think is chk port meas if the port number that this server is running on that is up thus my application work else not working but now 2 question:

1 - how can understand on which port number tomcat (this aplication) has been serviced?

2 - for chk service status for port i found this plugin

https://exchange.nagios.org/directory/P ... pl/details

now is that ok ?

./check_port.pl -p 21 -h 10.4.1.29

BR
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: how can find and monitor specific port

Post by ruffsense »

why not monitor the service?
I don't insult, I diagnose.
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

Re: how can find and monitor specific port

Post by baber »

ruffsense wrote:why not monitor the service?
this is linux service and it will start on a define port
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: how can find and monitor specific port

Post by ruffsense »

I don't insult, I diagnose.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: how can find and monitor specific port

Post by avandemore »

/usr/local/nagios/libexec/check_tcp can check a tcp port for you. Refer to your Systems Administrator to find out what port a service uses.
Previous Nagios employee
Locked