-
Liberty版本的Ceilometer表结构分析
-
1 概览
-
数据库:mongodb
包含的表:
alarm :报警表
alarm_history:报警历史表
dummyData:?
event:事件表
meter:计量项表
project:项目表
resource:资源表
statistics21600:21600秒(6小时)的聚合结果表
statistics300:300秒(5分钟)的聚合结果表
statistics3600:3600秒(1小时)的聚合结果表
statistics60:60秒的聚合结果表
statistics7200:7200秒(2小时)的聚合结果表
statistics86400:86400秒(1天)的聚合结果表
statistics900:900秒(15分钟)的聚合结果表
statsinfo:统计信息表
user:用户表
-
-
2 resource表
-
表名 | resource |
|
字段名称 | 类型 | 描述 |
_id | 字符串 | 资源id? |
resource_name | 字符串 | 资源名称 |
user_id | 字符串 | 用户id |
source | 字符串 | 来源? |
last_sample_timestamp | ISODate | 上一次采样的时间戳 |
first_sample_timestamp | ISODate | 最后一次采样的时间戳 |
project_id | 字符串 | 对象id号 |
metadata | 映射(可能内嵌数组类型的元素) | 资源的元数据映射。 status:资源状态 cpu_number:cpu的个数 ramdisk_id: ? display_name:展示的名称 name:实例名称 disk_gb:磁盘空间大小 kernel_id:内核id image:镜像映射,包含:id:镜像id,links[{href,rel}],name:镜像名称 ephemeral_gb:临时大小 state:状态? instance_id:实例id instance_type:实例类型 vcpus:cpu个数 memory_mb:内存大小,单位为mb image_ref:? root_gb:根目录大小,单位gb? host:主机名称 flavor:硬件模板映射,包含: name:模板名称 links:数组,每个元素是映射,包含href,rel ram:内存大小,单位mb ephemeral:临时大小 vcpus:cpu个数 disk:磁盘大小,单位gb id:模板id OS-EXT-AZ:availability_zone: ?在region范围内的再次切分 image_ref_url:镜像指向的url |
meter | 数组(每个元素是映射) | 该资源对应的计量项列表 每个元素是一个映射包含: counter_name:计量项的名称 counter_unit:计量项的单位 counter_type:计量项的类型
|
具体的例子:
>db.resource.findOne({"metadata.instance_id":"972e1432-4919-416b-9106-3d59a091e5f1"});
{
"_id" :"972e1432-4919-416b-9106-3d59a091e5f1",
"resource_name" : "test3",
"user_id" :"8ceca41e49d94ea69790a1250698d6f1",
"source" : "openstack",
"last_sample_timestamp" :ISODate("2017-04-14T07:50:10.982Z"),
"first_sample_timestamp" :ISODate("2017-04-13T14:12:13.919Z"),
"project_id" :"242b86b0d1bb4f078596364cbc4560cf",
"metadata" : {
"status" : "active",
"cpu_number" : 1,
"ramdisk_id" : null,
"display_name" : "test3",
"name" : "instance-00000003",
"disk_gb" : 5,
"kernel_id" : null,
"image" : {
"id" :"6c67c333-b658-47c8-9637-8a7ac36234ae",
"links" : [
{
"href" :"http://192.168.10.2:8774/183cde3dd1cd4fffa2ceb58a18b69adc/images/6c67c333-b658-47c8-9637-8a7ac36234ae",
"rel" : "bookmark"
}
],
"name" : "TestVM"
},
"ephemeral_gb" : 0,
"state" : "active",
"instance_id" :"972e1432-4919-416b-9106-3d59a091e5f1",
"instance_type" : "min",
"vcpus" : 1,
"memory_mb" : 512,
"image_ref" :"6c67c333-b658-47c8-9637-8a7ac36234ae",
"root_gb" : 5,
"host" :"124cbcae25b1665fc52bb9f4b1f91fdc78b088563882b2c160f3e5ec",
"flavor" : {
"name" : "min",
"links" : [
{
"href" :"http://192.168.10.2:8774/183cde3dd1cd4fffa2ceb58a18b69adc/flavors/d368e1c9-674f-4b67-899e-c86696b73fbb",
"rel" : "bookmark"
}
],
"ram" : 512,
"ephemeral" : 0,
"vcpus" : 1,
"disk" : 5,
"id" :"d368e1c9-674f-4b67-899e-c86696b73fbb"
},
"OS-EXT-AZ:availability_zone" :"nova",
"image_ref_url" :"http://192.168.10.2:8774/183cde3dd1cd4fffa2ceb58a18b69adc/images/6c67c333-b658-47c8-9637-8a7ac36234ae"
},
"meter" : [
{
"counter_name" :"compute.instance.create.start",
"counter_unit" : "event",
"counter_type" : "gauge"
},
{
"counter_name" :"compute.instance.create.end",
"counter_unit" : "event",
"counter_type" : "gauge"
},
{
"counter_name" : "memory.usage",
"counter_unit" : "MB",
"counter_type" : "gauge"
},
{
"counter_name" :"disk.read.requests.rate",
"counter_unit" : "request/s",
"counter_type" : "gauge"
},
{
"counter_name" :"disk.read.bytes.rate",
"counter_unit" : "B/s",
"counter_type" : "gauge"
},
{
"counter_name" :"disk.write.requests.rate",
"counter_unit" : "request/s",
"counter_type" : "gauge"
},
{
"counter_name" :"disk.write.bytes.rate",
"counter_unit" : "B/s",
"counter_type" : "gauge"
},
{
"counter_name" : "cpu_util",
"counter_unit" : "%",
"counter_type" : "gauge"
},
{
"counter_name" : "cpu.delta",
"counter_unit" : "ns",
"counter_type" : "delta"
},
{
"counter_name" : "instance",
"counter_unit" : "instance",
"counter_type" : "gauge"
}
]
}
-
-
2 meter表
-
3 event表
-
表名 | event |
|
字段 | 属性 | 描述 |
_id | string | 事件id? |
raw | 映射 | 可选的,审核目的,全部的通知消息可以被存储,用于未来验证。 |
timestamp | ISODDate | 事件生成的时间戳 |
event_type | string | 事件类型 |
traits | 数组(每个元素是一个映射) | 事件特征,每个元素是一个键值对。包含事件的主要细节。 每个元素包含: trait_type:可选的,数据类型,例如string,int trait_name:事件的名称 trait_value:事件的值 |
具体例子:
> db.event.findOne()
{
"_id" :"7607d859-3a37-4404-8ce0-21106db69697",
"raw" : {
},
"timestamp" :ISODate("2017-04-13T13:22:48.138Z"),
"event_type" :"network.create.start",
"traits" : [
{
"trait_type" : 1,
"trait_name" :"resource_name",
"trait_value" :"public_net"
},
{
"trait_type" : 1,
"trait_name" :"user_id",
"trait_value" :"75dcd63624ca438da9ea9817311ee809"
},
{
"trait_type" : 1,
"trait_name" :"service",
"trait_value" :"network.node-1.domain.tld"
},
{
"trait_type" : 1,
"trait_name" :"tenant_id",
"trait_value" :"183cde3dd1cd4fffa2ceb58a18b69adc"
},
{
"trait_type" : 1,
"trait_name" :"request_id",
"trait_value" :"req-69c40d45-ed0b-476c-b0ea-3e354d657112"
},
{
"trait_type" : 1,
"trait_name" :"project_id",
"trait_value" :"183cde3dd1cd4fffa2ceb58a18b69adc"
}
]
}
-
-
4statistics表
-
包含:statistics21600,statistics300,statistics3600,statistics60,statistics7200
statistics86400,statistics900
表名 | statistics300 |
|
字段 | 属性 | 描述 |
_id | ObjectId | mongo数据库分配的对象id |
counter_name | string | 统计的计量项 |
resource_id | string | 资源id |
timestamp | ISODate | 时间戳(应该是写入该记录的时间,可能会和period_end相等)? |
T | int | 统计持续的时间,单位为秒 |
period_start | ISODate | 时间段的起始时间 |
avg | float | 统计的平均值 |
unit | string | 计量单位 |
count | int | 计数 |
max | float | 最大值 |
user_id | string | 用户id |
val | float | 当前值? |
min | float | 最小值 |
sum | float | 求和值 |
message_id | string | 消息id |
period_end | ISODate | 时间段的结束时间 |
project_id | string | 项目id |
resource_metadata | 映射 | 资源的元数据,包含多个键值队 status:资源状态 cpu_number:cpu个数 ramdisk_id:磁盘的ram的id? display_name:展示的名称 name:资源名称 disk_gb:磁盘大小,单位gb kernel_id:内核id? image:镜像信息的映射,包含 id:镜像id links:数组,包含href,rel键值对的数组 name:镜像名称 ephemeral_gb:临时磁盘大小? state:资源状态 instance_id:实例id instance_type:实例类型 vcpus:cpu的个数 memory_mb:内存大小,单位mb image_ref:? root_gb:root目录大小,单位gb? host:主机 flavor:硬件配置模板,是一个映射,包含: name:模板名称 links:包含href和rel映射作为元素的数组 ram:内存大小 ephemeral:临时大小? vcpus:cpu个数 disk:磁盘容量,单位gb id:模板id OS-EXT-AZ:availability_zone:? image_ref_url:? |
具体例子:
>db.statistics300.findOne({"counter_name":"cpu_util"})
{
"_id" :ObjectId("58ef817aeecec5ca39a35e6d"),
"counter_name" : "cpu_util",
"resource_id" :"307bb736-4a3a-4086-9e95-3949ce068a4f",
"timestamp" :ISODate("2017-04-13T13:47:37.758Z"),
"T" : 300,
"period_start" :ISODate("2017-04-13T13:42:37.758Z"),
"avg" : 9.095134839938474,
"unit" : "%",
"count" : 1,
"max" : 9.095134839938474,
"user_id" :"8ceca41e49d94ea69790a1250698d6f1",
"val" : 9.095134839938474,
"min" : 9.095134839938474,
"sum" : 9.095134839938474,
"message_id" :"c18d4a22-204f-11e7-bc03-e66ba4aca743",
"period_end" :ISODate("2017-04-13T13:47:37.758Z"),
"project_id" :"242b86b0d1bb4f078596364cbc4560cf",
"resource_metadata" : {
"status" : "active",
"cpu_number" : 1,
"ramdisk_id" : null,
"display_name" : "test",
"name" : "instance-00000001",
"disk_gb" : 5,
"kernel_id" : null,
"image" : {
"id" :"6c67c333-b658-47c8-9637-8a7ac36234ae",
"links" : [
{
"href" :"http://192.168.10.2:8774/183cde3dd1cd4fffa2ceb58a18b69adc/images/6c67c333-b658-47c8-9637-8a7ac36234ae",
"rel" : "bookmark"
}
],
"name" : "TestVM"
},
"ephemeral_gb" : 0,
"state" : "active",
"instance_id" :"307bb736-4a3a-4086-9e95-3949ce068a4f",
"instance_type" : "min",
"vcpus" : 1,
"memory_mb" : 512,
"image_ref" :"6c67c333-b658-47c8-9637-8a7ac36234ae",
"root_gb" : 5,
"host" :"124cbcae25b1665fc52bb9f4b1f91fdc78b088563882b2c160f3e5ec",
"flavor" : {
"name" : "min",
"links" : [
{
"href" :"http://192.168.10.2:8774/183cde3dd1cd4fffa2ceb58a18b69adc/flavors/d368e1c9-674f-4b67-899e-c86696b73fbb",
"rel" : "bookmark"
}
],
"ram" : 512,
"ephemeral" : 0,
"vcpus" : 1,
"disk" : 5,
"id" :"d368e1c9-674f-4b67-899e-c86696b73fbb"
},
"OS-EXT-AZ:availability_zone" :"nova",
"image_ref_url" :"http://192.168.10.2:8774/183cde3dd1cd4fffa2ceb58a18b69adc/images/6c67c333-b658-47c8-9637-8a7ac36234ae"
}
}
-
-
5 statsinfo表
-
表名 | statsinfo |
|
字段 | 属性 | 描述 |
_id | ObjectId | mongodb分配的对象id |
rsc_id | string | 资源id |
ref_ts | ISODate | ? |
name | string | 计量项的名称 |
具体的例子:
>db.statsinfo.findOne({"rsc_id":"972e1432-4919-416b-9106-3d59a091e5f1","name":"cpu_util"})
{
"_id" :ObjectId("58ef87a6eecec5ca39a3601b"),
"rsc_id" :"972e1432-4919-416b-9106-3d59a091e5f1",
"ref_ts" :ISODate("2017-04-13T14:14:37.849Z"),
"name" : "cpu_util"
}
-
-
6 user表
-
表明 | user |
|
字段 | 属性 | 描述 |
_id | string | 用户id |
source | 字符串数组 | ? |
|
|
|
具体的例子:
> db.user.find()
{ "_id" :"8ceca41e49d94ea69790a1250698d6f1", "source" : ["openstack" ] }
{ "_id" : null, "source" : ["openstack" ] }
-
-
7 project表
-
表名 | project |
|
字段 | 属性 | 描述 |
_id | string | 租户(项目)的id |
source | 字符串数组 | ? |
|
|
|
具体的例子:
> db.project.findOne()
{ "_id" :"242b86b0d1bb4f078596364cbc4560cf", "source" : ["openstack" ] }
-
-
8 alarm表
-
9 alarm_history表
-
10 dummyData表
-
表名 | dummyData(虚拟数据) |
|
字段 | 属性 | 描述 |
_id | ObjectId | mongo数据库分配的对象id |
created_by_puppet | string | Puppet:是linux的集中配置管理系统 |
|
|
|
具体的例子:
> db.dummyData.find()
{ "_id" :ObjectId("58ef78a27db65284eb42b452"), "created_by_puppet": 1 }