获取授权信息

KEY VALUE
username admin
password geovis@123
grant_type password
client_id kubesphere
client_secret kubesphere
  • Headers:
KEY VALUE
Content-Type application/x-www-form-urlencoded
  • 返回值:
{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NDg0NzA4OTUsImlhdCI6MTY0ODQ2MzY5NSwiaXNzIjoia3ViZXNwaGVyZSIsInN1YiI6ImFkbWluIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiIsInVzZXJuYW1lIjoiYWRtaW4ifQ.1wejk7rHKeRs93QO6EOvqXX19o_m2W7T3QzkvjVkWUM",
    "token_type": "Bearer",
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NDg0NzgwOTUsImlhdCI6MTY0ODQ2MzY5NSwiaXNzIjoia3ViZXNwaGVyZSIsInN1YiI6ImFkbWluIiwidG9rZW5fdHlwZSI6InJlZnJlc2hfdG9rZW4iLCJ1c2VybmFtZSI6ImFkbWluIn0.OmRcA_kwLnYiJBSajEp0ahpFC49J-Ahvz-oVZercVv4",
    "expires_in": 7200
}

需要取出 accesstoken_type 字段进行拼接,格式为 token_type access,以上述结果为例,得出授权信息为 Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NDg0NzA4OTUsImlhdCI6MTY0ODQ2MzY5NSwiaXNzIjoia3ViZXNwaGVyZSIsInN1YiI6ImFkbWluIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiIsInVzZXJuYW1lIjoiYWRtaW4ifQ.1wejk7rHKeRs93QO6EOvqXX19o_m2W7T3QzkvjVkWUM

请求主机监控信息

KEY VALUE
cluster default
metrics_filter node_cpu_usage%7Cnode_cpu_total%7Cnode_cpu_utilisation%7Cnode_memory_usage_wo_cache%7Cnode_memory_total%7Cnode_memory_utilisation
  • Headers:
KEY VALUE
Authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NDg0NzA4OTUsImlhdCI6MTY0ODQ2MzY5NSwiaXNzIjoia3ViZXNwaGVyZSIsInN1YiI6ImFkbWluIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiIsInVzZXJuYW1lIjoiYWRtaW4ifQ.1wejk7rHKeRs93QO6EOvqXX19o_m2W7T3QzkvjVkWUM
  • 返回值:
{
    "results": [
        {
            "metric_name": "node_memory_utilisation",
            "data": {
                "resultType": "vector",
                "result": [
                    {
                        "metric": {
                            "__name__": "node:node_memory_utilisation:",
                            "host_ip": "192.168.1.2",
                            "node": "node2",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "0.2497394138546507"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "__name__": "node:node_memory_utilisation:",
                            "host_ip": "192.168.1.3",
                            "node": "node3",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "0.2624477565119847"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "__name__": "node:node_memory_utilisation:",
                            "host_ip": "192.168.1.1",
                            "node": "node1",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "0.33252266194095514"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    }
                ]
            }
        },
        {
            "metric_name": "node_cpu_utilisation",
            "data": {
                "resultType": "vector",
                "result": [
                    {
                        "metric": {
                            "__name__": "node:node_cpu_utilisation:avg1m",
                            "host_ip": "192.168.1.2",
                            "node": "node2",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "0.041843750000028504"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "__name__": "node:node_cpu_utilisation:avg1m",
                            "host_ip": "192.168.1.3",
                            "node": "node3",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "0.04657031249999477"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "__name__": "node:node_cpu_utilisation:avg1m",
                            "host_ip": "192.168.1.1",
                            "node": "node1",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "0.04852083333332471"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    }
                ]
            }
        },
        {
            "metric_name": "node_memory_usage_wo_cache",
            "data": {
                "resultType": "vector",
                "result": [
                    {
                        "metric": {
                            "host_ip": "192.168.1.2",
                            "node": "node2",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "24913227776"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "host_ip": "192.168.1.3",
                            "node": "node3",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "26180972544"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "host_ip": "192.168.1.1",
                            "node": "node1",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "33171427328"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    }
                ]
            }
        },
        {
            "metric_name": "node_memory_total",
            "data": {
                "resultType": "vector",
                "result": [
                    {
                        "metric": {
                            "__name__": "node:node_memory_bytes_total:sum",
                            "host_ip": "192.168.1.2",
                            "node": "node2",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "99756892160"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "__name__": "node:node_memory_bytes_total:sum",
                            "host_ip": "192.168.1.3",
                            "node": "node3",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "99756892160"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "__name__": "node:node_memory_bytes_total:sum",
                            "host_ip": "192.168.1.1",
                            "node": "node1",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "99756892160"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    }
                ]
            }
        },
        {
            "metric_name": "node_cpu_total",
            "data": {
                "resultType": "vector",
                "result": [
                    {
                        "metric": {
                            "__name__": "node:node_num_cpu:sum",
                            "host_ip": "192.168.1.2",
                            "node": "node2",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "64"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "__name__": "node:node_num_cpu:sum",
                            "host_ip": "192.168.1.3",
                            "node": "node3",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "64"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "__name__": "node:node_num_cpu:sum",
                            "host_ip": "192.168.1.1",
                            "node": "node1",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "64"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    }
                ]
            }
        },
        {
            "metric_name": "node_cpu_usage",
            "data": {
                "resultType": "vector",
                "result": [
                    {
                        "metric": {
                            "host_ip": "192.168.1.2",
                            "node": "node2",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "2.678"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "host_ip": "192.168.1.3",
                            "node": "node3",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "2.98"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    },
                    {
                        "metric": {
                            "host_ip": "192.168.1.1",
                            "node": "node1",
                            "role": "master"
                        },
                        "value": [
                            1648465218.948,
                            "3.105"
                        ],
                        "min_value": "",
                        "max_value": "",
                        "avg_value": "",
                        "sum_value": "",
                        "fee": "",
                        "resource_unit": "",
                        "currency_unit": ""
                    }
                ]
            }
        }
    ]
}

其中 node_memory_utilisation 为内存利用率,node_cpu_utilisation 为 CPU 利用率,node_memory_usage_wo_cache 为已用内存(单位为 B),node_memory_total 为总内存(单位为 B),node_cpu_total 为 CPU 总核数,node_cpu_usage 为 CPU 已用核数。