Ever wonder which applications are running on a particular Diego cell?
There is a nifty article on the Pivotal Knowledge Base which goes through how to find this info in PCF 1.7
. This points us to getting the list of application process guids for the cell by curling rep
. The user Muni Chada in the comments of the article points out how to use the certificates for rep
to make the https call.
Combining these two you can get the list of applications:
cd /var/vcap/jobs/rep/config/certs; \
curl -k -s https://localhost:1801/state --cert server.crt \
--key server.key | python -m json.tool |grep process_guid | \
cut -d ':' -f2|cut -c 3-38| \
xargs -I '<guid>' cf curl '/v2/apps/<guid>'| \
grep '"name"'|cut -d ':' -f2|sort -u
Which outputs something similar to:
"cf-env",
"spring-music",
"spring-music2",
"spring-music3",
"spring-music4",
"spring-music5",
"spring-music6",
"spring-music243",
The command above has a few dependencies:
- You can
bosh ssh
onto the cell. - The cell has the CF CLI installed. We colocate the toolbelt-boshrelease on every deployment so we already have the CF CLI available without manually installing it.
- You’ve done a
cf login
Tada!
Here are a few helpful articles to figure out what is running in CF:
- Nifty scripts for discovering which apps are known to the Cloud Controller: https://starkandwayne.com/blog/admin-scripting-your-way-around-cloud-foundry/
- Get the list of cells an application is running on: https://starkandwayne.com/blog/connecting-to-a-container-in-cloud-foundry/