guid - 如何获取 Cloud Foundry 应用程序实例的 GUID?

标签 guid cloud-foundry

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

但它只给出实例索引(例如:“0”、“1”、“2”等)

CF 应用统计 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
            }
        }
    }
}

由于每个应用程序实例都位于 Warden 容器中,是否有办法获取 CF 应用程序实例 ID (container-guid)?

最佳答案

已接受的答案现已过时。

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

关于guid - 如何获取 Cloud Foundry 应用程序实例的 GUID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33409375/

相关文章:

algorithm - 是否可以设计我们自己的算法来创建唯一的 GUID?

java - Spring Cloud ;云类型转换; spring.jpa 属性

java - Eureka/Discovery 服务与路由

mysql - CloudFoundry 中的 ClearDB 的连接问题(在 Pivotal 上)

javascript - Vue 未在 Chrome 中渲染 - Div 被 &lt;!----> 替换

.net - 创建 GUID 常量? (VB.net)

c# - 知道字符串是长字符串还是 Guid 的最佳方法是什么?

mongodb - 大型分布式系统中 ObjectId 与 UUID 的冲突概率

c - 如何在嵌入式C中生成UUID

spring-security - 在 CloudFoundry 上使用 Spring Security 的 HttpSessionSecurityContextRepository 是否存在问题?