显示事件详细信息
URI
GET /v2/events/{message_id}
请求参数
名称 |
输入 |
类型 |
描述 |
message_id |
path |
string |
事件 UUID |
响应参数
名称 |
输入 |
类型 |
描述 |
traits |
body |
array |
对象列表,由key和value组成,描述了这个事件的信息 |
raw |
body |
object |
一个字典对象,用于存储事件消息以供将来评估 |
generated |
body |
string |
事件发生的时间 |
event_type |
body |
string |
事件类型 |
message_id |
body |
string |
message的UUID |
请求示例
curl -g -i -X 'GET' 'http://ceilometer-api.openstack.svc.cluster.local:8777/v2/events/64d25c27-ce5b-48d7-a98e-34fcbc51e273' -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAABgf9rsK32RsEd32-xjinUnkr9Hyv_ZixiLLHNI8ipaimm7peKGnEvo62PA1PzwyPzjO9zDGHY41NRP6nz_r9jA_Cd57V7-MiorJBnCKVfDAqSBW9Gb77VwLioFtH05EsoBpgOtzirlHU3sqmjLlLeLTQNMlMtOAm-7C3Ij9G1Yc0Y6BfA'
响应示例
{
"traits": [{
"type": "string",
"name": "user_id",
"value": "bd30d6ed0e1a4ea3ab7e315cec903fe0"
}, {
"type": "string",
"name": "service",
"value": "network.node-6"
}, {
"type": "string",
"name": "resource_id",
"value": "51125486-115b-499e-b9e8-c0e2d4875364"
}, {
"type": "string",
"name": "tenant_id",
"value": "7bc2d9a54eed4e558778820742909930"
}, {
"type": "string",
"name": "request_id",
"value": "req-d399656f-94fc-4bcd-8b13-d32a950d4731"
}, {
"type": "string",
"name": "project_id",
"value": "7bc2d9a54eed4e558778820742909930"
}, {
"type": "string",
"name": "resource_name",
"value": "None"
}],
"raw": {},
"generated": "2021-04-21T06:06:14.585000",
"event_type": "port.update.end",
"message_id": "64d25c27-ce5b-48d7-a98e-34fcbc51e273"
}
显示事件详细信息-多条件查询
URI
POST /v2/query/events
请求参数
名称 |
输入 |
类型 |
描述 |
resource_id(Optional) |
body |
string |
资源id |
timestamp(Optional) |
body |
Date |
时间戳 |
event_type(Optional) |
body |
string |
事件类型 |
project(Optional) |
body |
string |
项目id |
orderby(Optional) |
body |
string |
排序方式 |
响应参数
名称 |
输入 |
类型 |
描述 |
traits |
body |
array |
对象列表,由key和value组成,描述了这个事件的信息 |
raw |
body |
object |
一个字典对象,用于存储事件消息以供将来评估 |
generated |
body |
string |
事件发生的时间 |
event_type |
body |
string |
事件类型 |
message_id |
body |
string |
message的UUID |
请求示例
curl -g -i -X 'POST' 'http://ceilometer-api.openstack.svc.cluster.local:8777/v2/query/events' -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAABgf9rsK32RsEd32-xjinUnkr9Hyv_ZixiLLHNI8ipaimm7peKGnEvo62PA1PzwyPzjO9zDGHY41NRP6nz_r9jA_Cd57V7-MiorJBnCKVfDAqSBW9Gb77VwLioFtH05EsoBpgOtzirlHU3sqmjLlLeLTQNMlMtOAm-7C3Ij9G1Yc0Y6BfA' -d '{"filter": "{\"and\":[{\"=\": {\"resource_id\": \"083f74e1-c81b-401d-9983-809f5ec5f240\"}},{\">=\": {\"timestamp\": \"2019-07-25T14:30:00\"}},{\"<=\":{\"timestamp\": \"2022-12-26T14:30:00\"}},{\"=\": {\"event_type\": \"compute.instance.create.end\"}}]}", "orderby": "[{\"timestamp\": \"desc\"}]"}'
响应示例
[{
"traits": [{
"type": "integer",
"name": "memory_mb",
"value": "512"
}, {
"type": "string",
"name": "resource_id",
"value": "083f74e1-c81b-401d-9983-809f5ec5f240"
}, {
"type": "integer",
"name": "ephemeral_gb",
"value": "0"
}, {
"type": "integer",
"name": "instance_type_id",
"value": "634"
}, {
"type": "string",
"name": "user_id",
"value": "ed6ebe3477614b489ef282fa79600c7c"
}, {
"type": "string",
"name": "service",
"value": "compute"
}, {
"type": "string",
"name": "state",
"value": "active"
}, {
"type": "string",
"name": "project_id",
"value": "6b5feb7256224373b61fa8b1181bb8bf"
}, {
"type": "datetime",
"name": "launched_at",
"value": "2021-04-21T06:06:42.925000"
}, {
"type": "string",
"name": "resource_name",
"value": "instance-5W9zds-2"
}, {
"type": "integer",
"name": "disk_gb",
"value": "0"
}, {
"type": "string",
"name": "host",
"value": "node-5.domain.tld"
}, {
"type": "integer",
"name": "root_gb",
"value": "0"
}, {
"type": "string",
"name": "tenant_id",
"value": "6b5feb7256224373b61fa8b1181bb8bf"
}, {
"type": "datetime",
"name": "created_at",
"value": "2021-04-21T06:06:08"
}, {
"type": "string",
"name": "instance_id",
"value": "083f74e1-c81b-401d-9983-809f5ec5f240"
}, {
"type": "string",
"name": "instance_type",
"value": "1C-0.5G"
}, {
"type": "integer",
"name": "vcpus",
"value": "1"
}, {
"type": "string",
"name": "request_id",
"value": "req-e793aa87-4d87-40ad-8568-b18da6c261d1"
}, {
"type": "string",
"name": "instance_flavor_id",
"value": "212"
}],
"raw": {},
"generated": "2021-04-21T06:06:43.384000",
"event_type": "compute.instance.create.end",
"message_id": "f6a41fec-c75d-4516-8bac-2d52b4d2209d"
}]
显示全部事件信息
URI
GET /v2/events
请求参数
名称 |
输入 |
类型 |
描述 |
q(Optional) |
query |
array |
按一个或多个参数过滤响应。 例如:?q.field=message_id&q.value = my_text。 |
limit(Optional) |
query |
int |
限制响应返回的最大样本数。比如:GET /v2/events?limit=1000 |
响应参数
名称 |
输入 |
类型 |
描述 |
traits |
body |
array |
对象列表,由key和value组成,描述了这个事件的信息 |
raw |
body |
object |
一个字典对象,用于存储事件消息以供将来评估 |
generated |
body |
string |
事件发生的时间 |
event_type |
body |
string |
事件类型 |
message_id |
body |
string |
message的UUID |
请求示例
curl -g -i -X 'GET' 'http://ceilometer-api.openstack.svc.cluster.local:8777/v2/events' -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAABgf9rsK32RsEd32-xjinUnkr9Hyv_ZixiLLHNI8ipaimm7peKGnEvo62PA1PzwyPzjO9zDGHY41NRP6nz_r9jA_Cd57V7-MiorJBnCKVfDAqSBW9Gb77VwLioFtH05EsoBpgOtzirlHU3sqmjLlLeLTQNMlMtOAm-7C3Ij9G1Yc0Y6BfA'
响应示例
[{
"traits": [{
"type": "string",
"name": "status",
"value": "queued"
}, {
"type": "string",
"name": "resource_name",
"value": "TestVM"
}, {
"type": "string",
"name": "user_id",
"value": "7bc2d9a54eed4e558778820742909930"
}, {
"type": "string",
"name": "name",
"value": "TestVM"
}, {
"type": "string",
"name": "service",
"value": "image.localhost"
}, {
"type": "string",
"name": "resource_id",
"value": "59a63fc7-c1a4-44ff-9bc9-95c387fdba5c"
}, {
"type": "string",
"name": "created_at",
"value": "2021-04-21T00:21:17Z"
}, {
"type": "string",
"name": "project_id",
"value": "7bc2d9a54eed4e558778820742909930"
}],
"raw": {},
"generated": "2021-04-21T00:21:17.868000",
"event_type": "image.create",
"message_id": "621f9bdb-a482-401d-853a-20f0bb7bf621"
}, {
"traits": [{
"type": "string",
"name": "tenant_id",
"value": "7bc2d9a54eed4e558778820742909930"
}, {
"type": "string",
"name": "project_id",
"value": "7bc2d9a54eed4e558778820742909930"
}, {
"type": "string",
"name": "user_id",
"value": "b6779cf713dc4cac85001d20fa4e7283"
}, {
"type": "string",
"name": "service",
"value": "volumeType.cinder-volume-worker"
}, {
"type": "string",
"name": "request_id",
"value": "req-ec52a873-4339-49d4-89c1-025f880c9ab7"
}],
"raw": {},
"generated": "2021-04-21T00:21:17.996000",
"event_type": "volume_type.create",
"message_id": "19e9ae32-07b1-4204-a168-b30786e40b20"
}]