云主机资源TOP5
URI
GET /v1/top
请求参数
名称 | 输入 | 类型 | 描述 |
---|---|---|---|
metric | path | string | 可选择:cpu.util、memory.util和cpu_util(deprecated in future) |
start(Optional) | path | Date | UTC,默认为 end 时间点前一天 |
end(Optional) | path | Date | UTC,默认为当前时间 |
响应参数
名称 | 输入 | 类型 | 描述 |
---|---|---|---|
resourceId | body | string | 资源ID |
projectId | body | string | 项目ID |
value | body | string | 值 |
resourceName | body | string | 资源名称 |
请求示例
curl -g -i -X 'GET' -H "X-Auth-Token: gAAAAABgf9rsK32RsEd32-xjinUnkr9Hyv_ZixiLLHNI8ipaimm7peKGnEvo62PA1PzwyPzjO9zDGHY41NRP6nz_r9jA_Cd57V7-MiorJBnCKVfDAqSBW9Gb77VwLioFtH05EsoBpgOtzirlHU3sqmjLlLeLTQNMlMtOAm-7C3Ij9G1Yc0Y6BfA" 'http://gnocchi.openstack.svc.cluster.local:80/v1/top?metric=cpu_util&start=2019-07-12T05:22:49&stop=2019-07-12T05:27:49'
响应示例
[{
"resourceId": "ac6103cf-9729-4327-a5f7-8aad5c8ca8e4",
"projectId": "1eb89ac0025a4c809523b93d2023c4f9",
"value": 59.3735616074861,
"resourceName": "cloud-product-210927110110-1"
}, {
"resourceId": "9cde3602-5ccf-4d11-ae86-84c0ae070cb7",
"projectId": "1afa51ff4a904bc582fedfb2327035c1",
"value": 31.520184716186503,
"resourceName": "alcubierre-upgrade-test-ctrl_all_node_1-uhrzkksuwnpo"
}, {
"resourceId": "5664ec3b-e2f3-4d34-94c3-78073efb5b0d",
"projectId": "1afa51ff4a904bc582fedfb2327035c1",
"value": 6.740852717441395,
"resourceName": "demo"
}, {
"resourceId": "da22d34e-5eb5-40b1-8c74-d1518089de6f",
"projectId": "1eb89ac0025a4c809523b93d2023c4f9",
"value": 2.906230093786667,
"resourceName": "cloud-product-210927110110-2"
}, {
"resourceId": "d07f1ff4-0e22-4353-8c7b-626adc215012",
"projectId": "1eb89ac0025a4c809523b93d2023c4f9",
"value": 1.5572815541472391,
"resourceName": "cloud-product-210927110110-3"
}]
显示资源详细信息
URI
GET /v1/resource/{resource_type}/{resource_id}
请求参数
名称 | 输入 | 类型 | 描述 |
---|---|---|---|
resource_id | path | string | 资源ID |
resource_type | path | string | 资源类型 |
resource_type 可选: generic(包含所有类型)、instance、volume、instance_network_interface
响应参数
名称 | 输入 | 类型 | 描述 |
---|---|---|---|
created_by_user_id | body | string | - |
user_id | body | string | 用户ID |
project_id | body | string | 项目ID |
ended_at | body | string | - |
revision_end | body | string | - |
creator | body | string | - |
created_by_project_id | body | string | - |
metrics | body | dict | 资源支持的监控项 |
original_resource_id | body | string | 资源ID |
revision_start | body | string | - |
started_at | body | string | - |
type | body | string | 资源类型 |
id | body | string | 资源UUID |
请求示例
curl -g -i -X 'GET' -H "X-Auth-Token: gAAAAABgf9rsK32RsEd32-xjinUnkr9Hyv_ZixiLLHNI8ipaimm7peKGnEvo62PA1PzwyPzjO9zDGHY41NRP6nz_r9jA_Cd57V7-MiorJBnCKVfDAqSBW9Gb77VwLioFtH05EsoBpgOtzirlHU3sqmjLlLeLTQNMlMtOAm-7C3Ij9G1Yc0Y6BfA" 'http://gnocchi.openstack.svc.cluster.local:80/v1/resource/generic/083f74e1-c81b-401d-9983-809f5ec5f240'
响应示例
{
"created_by_user_id": "d51c1f1b1d9d47c68155e3568d3b8751",
"user_id": "ed6ebe3477614b489ef282fa79600c7c",
"project_id": "6b5feb7256224373b61fa8b1181bb8bf",
"ended_at": null,
"revision_end": null,
"creator": "d51c1f1b1d9d47c68155e3568d3b8751:7bc2d9a54eed4e558778820742909930",
"created_by_project_id": "7bc2d9a54eed4e558778820742909930",
"metrics": {
"disk.write.requests.rate": "cf2f5d08-c903-45e0-a519-809d29bafee8",
"disk.read.bytes.rate": "1ce57c0a-31a2-4914-a39f-b924221bb299",
"cpu_util": "5733acdd-52ff-4dc2-86ed-72afb116c99a",
"disk.read.requests.rate": "cca0ee20-9e86-48e8-984c-c82b0847c0a9",
"cpu.delta": "e8b93a92-e14b-4482-bce4-2525c007e961",
"disk.write.bytes.rate": "00d8bf4c-65a9-40d6-8a0c-aab7354956f4",
"memory.util": "68eb074f-69d1-4d08-a169-3d721934d92f",
"memory.usage": "35557419-b3a7-4613-8813-2a550e49753b"
},
"original_resource_id": "083f74e1-c81b-401d-9983-809f5ec5f240",
"revision_start": "2021-04-21T06:16:10.561224+00:00",
"started_at": "2021-04-21T06:16:10.561199+00:00",
"type": "instance",
"id": "083f74e1-c81b-401d-9983-809f5ec5f240"
}
请求示例2
curl -g -i -X 'GET' -H "X-Auth-Token: gAAAAABiRW6lyiYYQ1cY_WHa7OINihNxhmY1i-DZnZO6t4IyqgI-l64o2zBvqFZcAtK7p-LFu5fXKMcMujCzDegeN9LVeGShgMn-k6B-fYn-KkJJ7VdxOOCo43uCyviXa0TLXnF1Xt9bh_2T7nhl3aunPjHzXCim8z1CqO9YhVBa9RhaGMIj9yc" 'http://gnocchi.openstack.svc.cluster.local:80/v1/resource/instance/66f7ad31-73ca-4440-a54c-705fe586386a'
响应示例2
{
"revision_start": "2022-03-31T06:44:29.457495+00:00",
"creator": "d6752c3ebf93462ab138f09036533786:ecbd21ff09e4440f9a1c1d32bccc862a",
"terminated_at": "",
"created_by_project_id": "ecbd21ff09e4440f9a1c1d32bccc862a",
"server_group": null,
"started_at": "2022-03-30T12:55:24.694728+00:00",
"id": "66f7ad31-73ca-4440-a54c-705fe586386a",
"created_by_user_id": "d6752c3ebf93462ab138f09036533786",
"user_id": "ae2f143fc78b4f0a9124695a0d62b861",
"display_description": null,
"project_id": "77f5b05bc2fb4d47aff5e5500ec933eb",
"type": "instance",
"resource_name": "instance-bo1",
"revision_end": null,
"metrics": {
"cpu.system.util": "0b7d87f8-0ab2-45ed-863f-4f2b4c621bb4",
"cpu.user.util": "fe09ff62-4b64-468b-9706-8d6780b2a273",
"disk.write.requests.rate": "8e58b135-4a33-4f9e-b9ef-5e53fa6213bf",
"cpu.util": "437a6df4-f51d-4f0b-a25d-b25464ed948e",
"cpu.interrupt.util": "83ad9562-4c5c-4511-b925-40df182b460a",
"disk.read.bytes.rate": "628e30b5-4d8b-49b7-8abd-38e81d5e5326",
"cpu_util": "2b57df21-9869-4788-914b-3a59e29599c9",
"memory.available": "6a6435aa-c7ab-4bd3-822b-1df16b5a81af",
"disk.read.requests.rate": "82ace4aa-c9bf-4aa6-845b-a12b4df43998",
"cpu.delta": "e1839982-d328-478b-b2cd-925353ec1147",
"disk.write.bytes.rate": "6d142da6-b056-4d2b-a374-1549e57c6c0b",
"memory.util": "077a4b1f-2d31-4937-9841-2571b2044081",
"memory.free": "f35dcce3-8670-41b3-83a3-2a52accf64ec",
"memory.usage": "7a4651b1-2c51-4b32-969a-a62416c6ec6b"
},
"host": "6cacf2c600b0a6a415fd1451230c7750fbd8a09b6a187302e2197e50",
"original_resource_id": "66f7ad31-73ca-4440-a54c-705fe586386a",
"display_name": "instance-bo1",
"ended_at": null,
"instance_id": "66f7ad31-73ca-4440-a54c-705fe586386a",
"image_ref": "",
"flavor_id": "2"
}
显示云主机关联网卡信息
URI
POST /v1/search/resource/instance_network_interface
请求参数
名称 | 输入 | 类型 | 描述 |
---|---|---|---|
instance_id | body | string | 虚拟机ID |
响应参数
名称 | 输入 | 类型 | 描述 |
---|---|---|---|
created_by_user_id | body | string | - |
user_id | body | string | 用户ID |
project_id | body | string | 项目ID |
ended_at | body | string | - |
revision_end | body | string | - |
creator | body | string | - |
created_by_project_id | body | string | - |
metrics | body | dict | 资源监控项 |
original_resource_id | body | string | 资源ID |
revision_start | body | string | - |
started_at | body | string | - |
type | body | string | 资源类型 |
id | body | string | 资源UUID |
terminated_at | body | string | - |
instance_id | body | string | 云主机ID |
mac | body | string | mac地址 |
name | body | string | 网卡tap名称 |
请求示例
curl -g -i -X 'POST' -H "Content-Type: application/json" -H "X-Auth-Token: gAAAAABgf9rsK32RsEd32-xjinUnkr9Hyv_ZixiLLHNI8ipaimm7peKGnEvo62PA1PzwyPzjO9zDGHY41NRP6nz_r9jA_Cd57V7-MiorJBnCKVfDAqSBW9Gb77VwLioFtH05EsoBpgOtzirlHU3sqmjLlLeLTQNMlMtOAm-7C3Ij9G1Yc0Y6BfA" 'http://gnocchi.openstack.svc.cluster.local:80/v1/search/resource/instance_network_interface?' -d '{"=": {"instance_id": "083f74e1-c81b-401d-9983-809f5ec5f240"}}'
响应示例
[{
"created_by_user_id": "d51c1f1b1d9d47c68155e3568d3b8751",
"metrics": {
"network.outgoing.packets.rate": "b863fbbc-e9aa-4872-95cf-82077e6eaa35",
"network.incoming.bytes.rate": "b4e12891-130c-4a97-9eb3-d51df03f86dd",
"network.outgoing.bytes.rate": "651b0594-f815-4672-8efd-cc0854bd4590",
"network.incoming.packets.rate": "c758cb66-57c7-4f1e-97ed-16ea9d342b66"
},
"started_at": "2021-04-21T06:21:10.257559+00:00",
"revision_start": "2021-04-21T06:21:10.257592+00:00",
"revision_end": null,
"creator": "d51c1f1b1d9d47c68155e3568d3b8751:7bc2d9a54eed4e558778820742909930",
"terminated_at": null,
"created_by_project_id": "7bc2d9a54eed4e558778820742909930",
"id": "0e7fd78f-b21a-55e4-b571-5dd19accd0b8",
"instance_id": "083f74e1-c81b-401d-9983-809f5ec5f240",
"mac": "fa:16:3e:02:6f:6a",
"original_resource_id": "instance-00000007-083f74e1-c81b-401d-9983-809f5ec5f240-tap51125486-11",
"user_id": "ed6ebe3477614b489ef282fa79600c7c",
"project_id": "6b5feb7256224373b61fa8b1181bb8bf",
"type": "instance_network_interface",
"ended_at": null,
"name": "tap51125486-11"
}]
显示资源监控指标数据
URI
GET /v1/metric/{metric_id}/measures
根据 metric_id 显示监控数据
请求参数
名称 | 输入 | 类型 | 描述 |
---|---|---|---|
metric_id | path | string | 指标ID |
start | path | Date | UTC |
stop | path | Date | UTC |
granularity | path | int | 采集间隔(可选[300, 900, 7200, 21600]) |
响应参数
列表数据三列,分别为:时间戳、采集间隔、值
请求示例
以获取 5733acdd-52ff-4dc2-86ed-72afb116c99a 指标数据为例
curl -g -i -X 'GET' -H "X-Auth-Token: gAAAAABgf9rsK32RsEd32-xjinUnkr9Hyv_ZixiLLHNI8ipaimm7peKGnEvo62PA1PzwyPzjO9zDGHY41NRP6nz_r9jA_Cd57V7-MiorJBnCKVfDAqSBW9Gb77VwLioFtH05EsoBpgOtzirlHU3sqmjLlLeLTQNMlMtOAm-7C3Ij9G1Yc0Y6BfA" 'http://gnocchi.openstack.svc.cluster.local:80/v1/metric/5733acdd-52ff-4dc2-86ed-72afb116c99a/measures?start=2019-07-11T06:10:00&granularity=900&stop=2022-07-12T06:10:00'
响应示例
[
["2021-04-21T06:45:00+00:00", 900.0, 4.548810094632968],
["2021-04-21T07:00:00+00:00", 900.0, 4.5558916459404735],
["2021-04-21T07:15:00+00:00", 900.0, 4.551879733345217],
["2021-04-21T07:30:00+00:00", 900.0, 4.5560091837236385],
["2021-04-21T07:45:00+00:00", 900.0, 4.490620082451442],
["2021-04-21T08:00:00+00:00", 900.0, 4.503440685156948],
["2021-04-21T08:15:00+00:00", 900.0, 4.587001765801356],
["2021-04-21T08:30:00+00:00", 900.0, 4.553931133661233],
["2021-04-21T08:45:00+00:00", 900.0, 4.512448046495793]
]
查询监控数据
URI
GET /v1/resource/generic/{resource_id}/metric/{metric_name}/measures
根据 resource_id 以及 metric_name 显示监控数据
请求参数
名称 | 输入 | 类型 | 描述 |
---|---|---|---|
metric_name | Path | String | 指标名称 |
start_time | Path | Date | UTC |
stop_time | Path | Date | UTC |
granularity | Path | integer | 采集间隔 |
resource_id | Path | String | 资源id |
其中 metric_name 的取值,可参考“显示资源详细信息”章节的响应示例结果。
响应参数
列表数据三列,分别为:时间戳、采集间隔、值
请求示例
以获取 cpu.util 指标为例:
curl -g -i -X GET "http://gnocchi.openstack.svc.cluster.local:80/v1/resource/generic/8384c6d5-c4af-4954-aea8-dc4012cacedf/metric/cpu.util/measures?start=2019-07-11T06:10:00&granularity=900&stop=2022-07-12T06:10:00" -H "Accept: application/json, */*" -H "X-Auth-Token: gAAAAABg1Tr-BR1MFD_xXzwDKOTGHKqJQS7FphGIbVR7oHya3DNM2cZKH7tGn2OuIs0aYd90uURj9bZI3kmxRRoH9xM-iQQUHOuLN3bdOwyPwkaVWbCI0Pm0TZ_lz9d4tO0anrxIIpSdfGnyIL702iwW2oGx0h5h5TC4ej0BWo-4jRcJDfci4p8"
响应示例
[
["2021-06-25T02:15:00+00:00", 900.0, 3.1178356118603023],
]