1. Run this command: cf app <app_name> --guid
. It shows the app_guid.
2. Run this command: cf curl /v2/apps/<app_guid>/stats
or
cf curl /v3/processes/<app_guid>
/stats . It shows the host
IP
address and port of the Diego cell in which the app instance is running.
3. Run the command bosh vms | grep <host>
to retrieve the diego_cell
name where host is the IP address listed in step 2.
4. Run this command bosh -d <cf-deployment> ssh <diego_cell>
to SSH into the Diego cell to login.
5. Run cfdot actual-lrps | grep <host> | grep <app_guid>
| jq '.instance_guid'
or cfdot actual-lrps | grep <host> | grep <port>
| jq '.instance_guid'
It shows the instance_guid
, which is the app container guid.
Note: If you do not see any output from the above command, refer to Alternate method to locate an app instance_guid in VMware Tanzu Application Service (TAS) for VMs for information how to locate the instance_guid with a different method.
6. Run ps axjfww | grep <instance_guid>
-C 1 | grep [j]ava. The 2nd, 3rd and 4th columns show the app OS pid.
Note: the brackets '[]' around the character 'j' in "java" prevents an extra undesired line in the output.
diego_cell/660729bc-6c0a-4bee-91f8-cf1aedd6a71a:~$ ps axjfww | grep 92c8482b-c806-4de0-6e39-77dc -C 1 | grep [j]ava 2047566 2047698 2047698 2047698 ? -1 Ssl 2000 3:19 | \_ /home/vcap/app/.java-buildpack/open_jdk_jre/bin/java -agentpath:/home/vcap/app/.java-buildpack/open_jdk_jre/bin/jvmkill-1.17.0_RELEASE=printHeapHistogram=1 -Djava.io.tmpdir=/home/vcap/tmp -XX:ActiveProcessorCount=4 -Djava.ext.dirs= -Djava.security.properties=/home/vcap/app/.java-buildpack/java_security/java.security -Xmx411542K -Xss1M -XX:ReservedCodeCacheSize=240M -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=125033K -cp /home/vcap/app/.:/home/vcap/app/.java-buildpack/container_security_provider/container_security_provider-1.19.0_RELEASE.jar org.springframework.boot.loader.JarLauncher
In the example above, the OS pid is 2047698.
In the example above, the OS pid is 2047698.