如何获得云代工应用程序实例的指南?

时间:2015-10-29 08:36:23

标签: guid cloudfoundry

Cloud Foundry App / stats api(/ v2 / apps /:guid / stats)提供了每个CF App实例的详细信息。

但它只提供实例索引(例如:“0”,“1”,“2”等)

CF App Stats API:http://apidocs.cloudfoundry.org/222/apps/get_detailed_stats_for_a_started_app.html

GET on https://api.ng.bluemix.net/v2/apps/<app-guid>/stats

示例回复:

{
    "0":
    {
        "state": "RUNNING",
        "stats":
        {
            "name": "testlibappcf",
            "uris":
            [
                "testlibappcf.mybluemix.net"
            ],
            "host": "169.54.206.30",
            "port": 61814,
            "uptime": 84972,
            "mem_quota": 536870912,
            "disk_quota": 1073741824,
            "fds_quota": 16384,
            "usage":
            {
                "time": "2015-10-29 08:25:45 +0000",
                "cpu": 0.0015772999557422517,
                "mem": 181530624,
                "disk": 187355136
            }
        }
    },
    "1":
    {
        "state": "RUNNING",
        "stats":
        {
            "name": "testlibappcf",
            "uris":
            [
                "testlibappcf.mybluemix.net"
            ],
            "host": "75.126.172.157",
            "port": 61588,
            "uptime": 263802,
            "mem_quota": 536870912,
            "disk_quota": 1073741824,
            "fds_quota": 16384,
            "usage":
            {
                "time": "2015-10-29 08:25:45 +0000",
                "cpu": 0.002226168338735689,
                "mem": 184090624,
                "disk": 187158528
            }
        }
    },
    "2":
    {
        "state": "RUNNING",
        "stats":
        {
            "name": "testlibappcf",
            "uris":
            [
                "testlibappcf.mybluemix.net"
            ],
            "host": "50.22.22.171",
            "port": 61970,
            "uptime": 74472,
            "mem_quota": 536870912,
            "disk_quota": 1073741824,
            "fds_quota": 16384,
            "usage":
            {
                "time": "2015-10-29 08:25:45 +0000",
                "cpu": 0.0019144080402859489,
                "mem": 213286912,
                "disk": 187158528
            }
        }
    }
}

由于每个Application实例都存在于Warden容器中,有没有办法获取CF App Instance Id(container-guid)?

2 个答案:

答案 0 :(得分:4)

现在接受的答案已过期。

Cloud Foundry现在通过CF_INSTANCE_GUID公开实例GUID。

答案 1 :(得分:1)

Cloud Foundry中的应用程序具有GUID,而个别实例则没有。