Page 1 of 1

how can find and monitor specific port

Posted: Sun Dec 04, 2016 11:13 am
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

Re: how can find and monitor specific port

Posted: Sun Dec 04, 2016 3:14 pm
by ruffsense
why not monitor the service?

Re: how can find and monitor specific port

Posted: Sun Dec 04, 2016 4:24 pm
by baber
ruffsense wrote:why not monitor the service?
this is linux service and it will start on a define port

Re: how can find and monitor specific port

Posted: Sun Dec 04, 2016 4:38 pm
by ruffsense

Re: how can find and monitor specific port

Posted: Mon Dec 05, 2016 2:48 pm
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.