Loading
close

事件查询

time 更新时间:2022-04-27 17:40:06

显示某个事件的详细信息

URI

GET /v2/events/{message_id}

请求消息

名称 是否可选 类型 描述
message_id 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 body array 对象列表,由key和value组成,描述了这个事件的信息
raw body object 一个字典对象,用于存储事件消息以供将来评估
generated body String 事件发生的时间
event_type body String 事件类型
message_id body String message的UUID

响应示例

{
  "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 String 资源id
timestamp Date 时间戳
event_type Date 事件类型
desc String 排序方式

请求示例

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 body array 对象列表,由key和value组成,描述了这个事件的信息
raw body object 一个字典对象,用于存储事件消息以供将来评估
generated body String 事件发生的时间
event_type body String 事件类型
message_id body String message 的 UUID

响应示例

[{
  "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

POST /v2/events

请求参数

名称 是否可选 类型 描述
q array 按一个或多个参数过滤响应。 例如:?q.field = Foo和q.value = my_text。
limit integer 限制响应返回的最大样本数。比如:GET /v2/events?limit=1000

请求示例

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 body array 对象列表,由key和value组成,描述了这个事件的信息
raw body object 一个字典对象,用于存储事件消息以供将来评估
generated body String 事件发生的时间
event_type body String 事件类型
message_id body String message 的 UUID

响应示例

[{
  "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"
}]
此篇文章对你是否有帮助?
没帮助
locked-file

您暂无权限访问该产品