We introduce a way to find the application's name of the process in the diego_cell VM in this article. Here are procedures:
1.) ssh into the diego_cell VM with a high CPU load
bosh -d cf-xxxxxxxxxxx ssh diego_cell/xxxxxxxxxxx
2.) Use "
top" command to find out the process ID with high CPU usage. It is 22408 in this sample.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
22408 2000 20 0 2049924 239580 9452 S 210.3 11.5 143:02.83 java
3.) Find out the PPID of 22408. We can see the PPID is 22067.
diego_cell/7ce2b916-4fa9-4606-b6bf-f7442266eb42:~$ ps -ef|egrep "22408|PPID"
UID PID PPID C STIME TTY TIME CMD
2000 22408 22067 0 2022 ? 02:23:02 /home/vcap/app/.java-buildpack/open_jdk_jre/bin/java -agentpath:/home/vcap/app/.java-buildpack/open_jdk_jre/bin/jvmkill-1.16.0_RELEASE=printHeapHistogram=1 -Djava.io.tmpdir=/home/vcap/tmp -XX:ActiveProcessorCount=4 -Djava.ext.dirs=/home/vcap/app/.java-buildpack/container_security_provider:/home/vcap/app/.java-buildpack/open_jdk_jre/lib/ext -Djava.security.properties=/home/vcap/app/.java-buildpack/java_security/java.security -Xmx404644K -Xss1M -XX:ReservedCodeCacheSize=240M -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=131931K -cp /home/vcap/app/. org.springframework.boot.loader.JarLauncher
bosh_e0+ 1967261 1923715 0 06:24 pts/0 00:00:00 grep -E --color=auto 22408|PPID
diego_cell/7ce2b916-4fa9-4606-b6bf-f7442266eb42:~$
4.) Retrieve the instance_guid of this PPID. It is the last column. The command is "
ps -ef|grep 22067|grep garden"

5.) With the instance_guid, we can find app_guid of the application, which is the first 5 fields of process_guid.
diego_cell/7ce2b916-4fa9-4606-b6bf-f7442266eb42:~$ cfdot actual-lrps |grep f09cc4d8-f034-4ca4-58d3-e28a
{"process_guid":"1747dab5-fbc7-4544-b9a1-12ec75ed4599-3abe3ee3-64bb-4988-8507-1e648737f7a9","index":0,"domain":"cf-apps","instance_guid":"f09cc4d8-f034-4ca4-58d3-e28a","cell_id":"7ce2b916-4fa9-4606-b6bf-f7442266eb42","address":"172.30.1.23","ports":[{"container_port":8080,"host_port":61008,"container_tls_proxy_port":61001,"host_tls_proxy_port":61010},{"container_port":2222,"host_port":61009,"container_tls_proxy_port":61002,"host_tls_proxy_port":61011}],"instance_address":"172.32.2.5","preferred_address":"INSTANCE","crash_count":6,"crash_reason":"failed to create credentials directory","state":"RUNNING","since":1663748870905779423,"modification_tag":{"epoch":"14ba500c-d234-4473-70ff-4e45f6b70fa9","index":297},"presence":"ORDINARY"}
diego_cell/7ce2b916-4fa9-4606-b6bf-f7442266eb42:~$
6.) The last step is retrieving the detailed information of this application with the app_guid, including its name. We can exit from diego_cell and use "cf curl".
diego_cell/7ce2b916-4fa9-4606-b6bf-f7442266eb42:~$ exit
logout
Connection to 172.30.1.23 closed.
Succeeded
ubuntu@opsmgr-01-slot-21-pez-vmware-com:~$ cf curl /v2/apps/1747dab5-fbc7-4544-b9a1-12ec75ed4599/stats
{
"0": {
"state": "RUNNING",
"isolation_segment": null,
"stats": {
"name": "eureka-server",
"uris": [
"eureka-server.cfapps-01.slot-21.pez.vmware.com"
],
"host": "172.30.1.23",
"port": 61008,
"uptime": 12694439,
"mem_quota": 1073741824,
"disk_quota": 1073741824,
"fds_quota": 16384,
"usage": {
"time": "2023-02-15T06:41:50+00:00",
"cpu": 0.0016562391705231478,
"mem": 243067066,
"disk": 169447424
}
}
}
}
ubuntu@opsmgr-01-slot-21-pez-vmware-com:~$ cf curl /v2/apps/1747dab5-fbc7-4544-b9a1-12ec75ed4599/summary
{
"guid": "1747dab5-fbc7-4544-b9a1-12ec75ed4599",
"name": "eureka-server",
"routes": [
{
"guid": "6c48abdd-f730-4a6a-a5b7-28d23a077630",
"host": "eureka-server",
"port": null,
"path": "",
"domain": {
"guid": "de055ae2-c13c-4a50-b54c-9996d9efce30",
"name": "cfapps-01.slot-21.pez.vmware.com"
}
}
],
"running_instances": 1,
"services": [],
"available_domains": [
{
"guid": "de055ae2-c13c-4a50-b54c-9996d9efce30",
"name": "cfapps-01.slot-21.pez.vmware.com",
"internal": false,
"router_group_guid": null,
"router_group_type": null
},
{
"guid": "97293fc5-b871-4017-9667-90465394754c",
"name": "apps.internal",
"internal": true,
"router_group_guid": null,
"router_group_type": null
}
],
"production": false,
"space_guid": "c8b77f1b-c49e-4ce1-ba57-36221fff8df4",
"stack_guid": "f4d3c1a8-223c-408c-a686-43ab90e437e5",
"buildpack": null,
"detected_buildpack": "java",
"detected_buildpack_guid": "14940558-9b15-485d-b342-bb0c9bfd7f23",
"environment_json": {},
"memory": 1024,
"instances": 1,
"disk_quota": 1024,
"state": "STARTED",
"version": "3abe3ee3-64bb-4988-8507-1e648737f7a9",
"command": null,
"console": false,
"debug": null,
"staging_task_id": "c35d0847-07ce-4702-8a56-ff9b32882ff3",
"package_state": "STAGED",
"health_check_type": "port",
"health_check_timeout": null,
"health_check_http_endpoint": null,
"staging_failed_reason": null,
"staging_failed_description": null,
"diego": true,
"docker_image": null,
"package_updated_at": "2022-04-05T17:54:55Z",
"detected_start_command": "JAVA_OPTS=\"-agentpath:$PWD/.java-buildpack/open_jdk_jre/bin/jvmkill-1.16.0_RELEASE=printHeapHistogram=1 -Djava.io.tmpdir=$TMPDIR -XX:ActiveProcessorCount=$(nproc) -Djava.ext.dirs=$PWD/.java-buildpack/container_security_provider:$PWD/.java-buildpack/open_jdk_jre/lib/ext -Djava.security.properties=$PWD/.java-buildpack/java_security/java.security $JAVA_OPTS\" && CALCULATED_MEMORY=$($PWD/.java-buildpack/open_jdk_jre/bin/java-buildpack-memory-calculator-3.13.0_RELEASE -totMemory=$MEMORY_LIMIT -loadedClasses=20879 -poolType=metaspace -stackThreads=250 -vmOptions=\"$JAVA_OPTS\") && echo JVM Memory Configuration: $CALCULATED_MEMORY && JAVA_OPTS=\"$JAVA_OPTS $CALCULATED_MEMORY\" && MALLOC_ARENA_MAX=2 SERVER_PORT=$PORT eval exec $PWD/.java-buildpack/open_jdk_jre/bin/java $JAVA_OPTS -cp $PWD/. org.springframework.boot.loader.JarLauncher",
"enable_ssh": true,
"ports": null
}