Consultor Eletrônico



Kbase P135502: How to locate all java processes running on a machine that are using a TCP port and locate their ass
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/05/2009
Status: Verified

GOAL:

How to locate all java processes running on a machine that are using a TCP port and locate their associated Process IDs?

GOAL:

How to identify AdminServer processes and PID being used by the AdminServer process?

GOAL:

How to locate Process IDs (PIDS) for all java processes that are using a TCP port number?

GOAL:

How to identify PIDS that are java processes making use of TCP ports?

FACT(s) (Environment):

UNIX
OpenEdge 10.x

FIX:

The following is a script that will allow you to locate all java processes running on a machine that are making use of TCP ports. The information gathered from this script can be useful in identifying port numbers that are being used by an AdminServer as well as information regarding arguments being passed to these processes.

1. Create a file called findadminserverpid.sh
2. Place the following lines into that script.

#!/bin/sh
LIST="`lsof | grep TCP | grep java | cut -c10-15 | sort -u`"
OUTFILE=./findadminserverpid.out
rm $OUTFILE
for L in $LIST
do
#ps -fp $L
pargs -a $L >> $OUTFILE
done
3. Then change the permissions on the script that you can execute it. Example: chmod 777 findadminserverpid.sh
4. Then invoke the script from a UNIX shell prompt. Example: . findadminserverpid.sh
Note: This script should be ran as root so that you can obtain process information for all java processes making use of TCP ports.
5. The output from the script will be placed into a file in your working directory called: findadminserverpid.out

The output of the file will be be placed in your working directory. Please note the format of the output file is:

PID followed by command and then arguments that are passed to the command. As this script looks for all java processes making use of TCP ports, you will need to look at each PID and arguments to identify which ones are associated with the AdminServer, NameServer, AppServer Broker or WebSpeed Broker etc... In the output file, look for AdminServerStarter line to identify that the PID is associated with the AdminServer. Then identify the port # number of the AdminServer by looking at the rmi://machinename:port/ associated with your NameServer, AppServer Broker or WebSpeed Broker processes. This information can be very useful when you are not sure which port and AdminServer process is running on.

Sample output:

289: /usr/lib/inet/inetd start
argv[0]: /usr/lib/inet/inetd
argv[1]: start
827: /usr/java/bin/java -server -Xmx128m -XX:+BackgroundCompilation -XX:PermSize=32m
argv[0]: /usr/java/bin/java
argv[1]: -server
argv[2]: -Xmx128m
argv[3]: -XX:+BackgroundCompilation
argv[4]: -XX:PermSize=32m
argv[5]: -XX:MaxPermSize=128m
argv[6]: -XX:+CMSPermGenSweepingEnabled
argv[7]: -classpath
argv[8]: /usr/share/webconsole/private/container/bin/bootstrap.jar:/usr/share/webconsole/private/c
ontainer/bin/commons-logging.jar:/usr/share/webconsole/private/container/bin/log4j.jar:/usr/java/l
ib/tools.jar:/usr/java/jre/lib/jsse.jar
argv[9]: -Djava.security.manager
argv[10]: -Djava.security.policy==/var/webconsole/domains/console/conf/console.policy
argv[11]: -Djavax.net.ssl.trustStore=/var/webconsole/domains/console/conf/keystore.jks
argv[12]: -Djava.security.auth.login.config=/var/webconsole/domains/console/conf/consolelogin.conf
argv[13]: -Dcatalina.home=/usr/share/webconsole/private/container
argv[14]: -Dcatalina.base=/var/webconsole/domains/console
argv[15]: -Dcom.sun.web.console.home=/usr/share/webconsole
argv[16]: -Dcom.sun.web.console.conf=/etc/webconsole/console
argv[17]: -Dcom.sun.web.console.base=/var/webconsole/domains/console
argv[18]: -Dcom.sun.web.console.logdir=/var/log/webconsole/console
argv[19]: -Dcom.sun.web.console.native=/usr/lib/webconsole
argv[20]: -Dcom.sun.web.console.appbase=/var/webconsole/domains/console/webapps
argv[21]: -Dcom.sun.web.console.secureport=6789
argv[22]: -Dcom.sun.web.console.unsecureport=6788
argv[23]: -Dcom.sun.web.console.unsecurehost=127.0.0.1
argv[24]: -Dwebconsole.default.file=/etc/webconsole/console/default.properties
argv[25]: -Dwebconsole.config.file=/.etc/webconsole/console/service.properties
argv[26]: -Dcom.sun.web.console.startfile=/var/webconsole/tmp/console_start.tmp
argv[27]: -Djava.awt.headless=true
argv[28]: -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
argv[29]: org.apache.catalina.startup.Bootstrap
argv[30]: start
3465: /usr1/oe_101b64_dlc/jre/bin/java -Djava.class.path=/usr1/oe_101b64_dlc/java/ext
argv[0]: /usr1/oe_101b64_dlc/jre/bin/java
argv[1]: -Djava.class.path=/usr1/oe_101b64_dlc/java/ext/jmxri.jar:/usr1/oe_101b64_dlc/java/ext/mgm
t_agent.jar:/usr1/oe_101b64_dlc/java/ext/mgmt_client.jar:/usr1/oe_101b64_dlc/java/ext/mgmt_config.
jar:/usr1/oe_101b64_dlc/java/ext/sonic_Client.jar:/usr1/oe_101b64_dlc/java/progress.jar:/usr1/oe_1
01b64_dlc/java/osmetrics.jar:/usr1/oe_101b64_dlc/java/jdbc.jar:/usr1/oe_101b64_dlc/java/base.jar:/
usr1/oe_101b64_dlc/java/openedge.jar:/usr1/oe_101b64_dlc/java/util.jar:/usr1/oe_101b64_dlc/java/ex
t/soap.jar:/usr1/oe_101b64_dlc/java/prorepl.jar:/usr1/oe_101b64_dlc/java/ext/wsdl4j.jar
argv[2]: -Dadmsrv.jvm=/usr1/oe_101b64_dlc/jre/bin/java
argv[3]: -Djava.command=java
argv[4]: -Dsun.os.patch.level=unknown
argv[5]: -DWork.Dir=/usr1/or_101b64_wrk
argv[6]: -Djava.endorsed.dirs=/usr1/oe_101b64_dlc/jre/lib/endorsed
argv[7]: -Dsun.java2d.fontpath=
argv[8]: -Djava.util.prefs.PreferencesFactory=java.util.prefs.FileSystemPreferencesFactory
argv[9]: -Djava.security.policy=/usr1/oe_101b64_dlc/java/java.policy
argv[10]: -Dfile.encoding=ISO646-US
argv[11]: -Dsun.arch.data.model=32
argv[12]: -DInstall.Dir=/usr1/oe_101b64_dlc
argv[13]: -Djvmstart.debug=0
argv[14]: com.progress.chimera.adminserver.AdminServerStarter
3544: /usr1/oe_101b64_dlc/jre/bin/java -classpath /usr1/oe_101b64_dlc/jre/i18n.jar:/u
argv[0]: /usr1/oe_101b64_dlc/jre/bin/java
argv[1]: -classpath
argv[2]: /usr1/oe_101b64_dlc/jre/i18n.jar:/usr1/oe_101b64_dlc/jdk/lib/tools.jar:/usr1/oe_101b64_dl
c/java/progress.jar:/usr1/oe_101b64_dlc/java/ext/mgmt_client.jar
argv[3]: -DInstall.Dir=/usr1/oe_101b64_dlc
argv[4]: -Djava.security.policy=/usr1/oe_101b64_dlc/java/java.policy
argv[5]: -DCanonicalName=local.localhost:ID=AppServer
argv[6]: com.progress.ubroker.broker.ubroker
argv[7]: -t
argv[8]: AS
argv[9]: -i
argv[10]: asbroker1
argv[11]: -r
argv[12]: rmi://uxtssolar3:20931/asbroker1
argv[13]: -f
argv[14]: /usr1/oe_101b64_dlc/properties/ubroker.properties
15593: /tools/solaris/java/j2sdk1.4.2_06/jre/bin/java -classpath /view/rdl101b_solaris
argv[0]: /tools/solaris/java/j2sdk1.4.2_06/jre/bin/java
argv[1]: -classpath
argv[2]: /view/rdl101b_solaris/vobs_prgs/solaris/dlc/jre/i18n.jar:/tools/solaris/java/j2sdk1.4.2_0
6/lib/tools.jar:/view/rdl101b_solaris/vobs_prgs/solaris/dlc/java/progress.jar:/view/rdl101b_solari
s/vobs_prgs/solaris/dlc/java/ext/mgmt_client.jar
argv[3]: -DInstall.Dir=/view/rdl101b_solaris/vobs_prgs/solaris/dlc
argv[4]: -Djava.security.policy=/view/rdl101b_solaris/vobs_prgs/solaris/dlc/java/java.policy
argv[5]: -DCanonicalName=local.localhost:ID=NameServer
argv[6]: com.progress.nameserver.NameServer
argv[7]: -i
argv[8]: NS1
argv[9]: -r
argv[10]: rmi://uxtssolar3:20931/NS1
argv[11]: -f
argv[12]: /view/rdl101b_solaris/vobs_prgs/solaris/dlc/properties/ubroker.properties.