Programmatically find warden directory of an app instance

119 views
Skip to first unread message

romand...@gmail.com

unread,
Mar 30, 2015, 4:00:09 PM3/30/15
to vcap...@cloudfoundry.org
Hi,
supposing to have full access to Cloud Foundry, how I can find automatically /programmatically  the exact directory of the warden container of an application instance?
I've tried some solution like watching inside the routing table or the CC DB, or looking for a listening port, but I haven't found anything useful.
Can you, please, help me?

Thanks in advance

Daniele Romano

James Bayer

unread,
Mar 30, 2015, 6:08:03 PM3/30/15
to vcap...@cloudfoundry.org
first, find the bosh job index of the DEA that has the app instance. hit the stats endpoint for the app [1] using something like:

cf curl /v2/apps/`cf app james-static --guid`/stats
{
   "0": {
      "state": "RUNNING",
      "stats": {
         "name": "james-static",
         "uris": [
            "james-static.cfapps.io"
         ],
         "host": "10.10.17.37",
         "port": 61035,
         "uptime": 442307,
         "mem_quota": 1073741824,
         "disk_quota": 1073741824,
         "fds_quota": 16384,
         "usage": {
            "time": "2015-03-30 22:02:07 +0000",
            "cpu": 4.020839857362368e-05,
            "mem": 4595712,
            "disk": 8392704
         }
      }
   }
}

this james-static is running on the DEA with the private IP 10.10.17.37
you can compare this to the output of "bosh vms" to find the right DEA bosh job index. "bosh ssh" to that VM.

now you can use the high app CPU instructions to see approximate steps to identify the warden container:
http://docs.cloudfoundry.org/running/troubleshooting/troubleshooting-apps.html

the DEA has an /var/vcap/data/dea_next/db/instances.json
file which should show the app instance guid and associate it with the warden handle.

optional, now you can now use the warden handle with a command like this to get inside the container:

/var/vcap/packages/warden/warden/src/wsh/wsh --socket /var/vcap/data/warden/depot/WARDEN-HANDLE/run/wshd.sock --user vcap


--
You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/011a49fe-f0c0-4025-b711-009994f1eee8%40cloudfoundry.org.

To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.



--
Thank you,

James Bayer

James Myers

unread,
Mar 30, 2015, 6:11:42 PM3/30/15
to vcap...@cloudfoundry.org, romand...@gmail.com
Hi Daniele,

We have a story to add a log statement that allows a user to map an application to a warden container handle[1]. Once you have the warden container handle you should be able to find your warden container in `/var/vcap/data/warden/depot`. 

Hope this helps,

Jim and Dan, CF Runtime Team

romand...@gmail.com

unread,
Apr 11, 2015, 3:17:32 AM4/11/15
to vcap...@cloudfoundry.org, romand...@gmail.com
Thank you very much!
Reply all
Reply to author
Forward
0 new messages