ceilometer和gnocchi中相对应的概念

ceilometer gnocchi
resource resource
meter metric
sample/event measure

ceilometer和gnocchi的关系
ceilometer用来获得数据,gnocchi用来存储数据;
在ceilometer中还有panko(用来存储event)和aodh(用来设置警报),这篇文章不会涉及。

https://docs.openstack.org/ceilometer/latest/contributor/architecture.html

gnocchi是什么

Gnocchi is an open-source time series database.

The problem that Gnocchi solves is the storage and indexing of time series data and resources at a large scale. This is useful in modern cloud platforms which are not only huge but also are dynamic and potentially multi-tenant. Gnocchi takes all of that into account.

Because Gnocchi computes all the aggregations at ingestion, getting the data back is extremely fast, as it just needs to read back the pre-computed results.

https://gnocchi.xyz/

gnocchi的架构
从下面可以看到它需要三个存储,分别是measure/aggregate/index.

# vi /etc/gnocchi/gnocchi.conf

measure和aggregate的配置如下:

[storage]
#coordination_url = redis://controller:6379
file_basepath = /var/lib/gnocchi
driver = file

index的配置如下:

[indexer]
#url = sqlite:var/lib/gnocchi/gnocchidb
url = mysql+pymysql://gnocchi:GNOCCHI_DBPASS@controller/gnocchi

archive policy
An archive policy defines which aggregations to compute and how many aggregates to keep. Gnocchi supports a variety of aggregation methods, such as minimum, maximum, average, Nth percentile, standard deviation, etc. Those aggregations are computed over a period of time (called granularity) and are kept for a defined timespan.

(gnocchi) archive-policy list #进入gnocchi之后,显示所有的归档策略
+----------------------+-------------+-----------------------------------------------------------------------+---------------------------------+
| name                 | back_window | definition                                                            | aggregation_methods             |
+----------------------+-------------+-----------------------------------------------------------------------+---------------------------------+
| bool                 |        3600 | - timespan: 365 days, 0:00:00, granularity: 0:00:01, points: 31536000 | last                            |
| ceilometer-high      |           0 | - timespan: 1:00:00, granularity: 0:00:01, points: 3600               | mean                            |
|                      |             | - timespan: 1 day, 0:00:00, granularity: 0:01:00, points: 1440        |                                 |
|                      |             | - timespan: 365 days, 0:00:00, granularity: 1:00:00, points: 8760     |                                 |
| ceilometer-high-rate |           0 | - timespan: 1:00:00, granularity: 0:00:01, points: 3600               | mean, rate:mean                 |
|                      |             | - timespan: 1 day, 0:00:00, granularity: 0:01:00, points: 1440        |                                 |
|                      |             | - timespan: 365 days, 0:00:00, granularity: 1:00:00, points: 8760     |                                 |
| ceilometer-low       |           0 | - timespan: 30 days, 0:00:00, granularity: 0:05:00, points: 8640      | mean                            |
| ceilometer-low-rate  |           0 | - timespan: 30 days, 0:00:00, granularity: 0:05:00, points: 8640      | mean, rate:mean                 |
| high                 |           0 | - timespan: 1:00:00, granularity: 0:00:01, points: 3600               | count, max, sum, min, mean, std |
|                      |             | - timespan: 7 days, 0:00:00, granularity: 0:01:00, points: 10080      |                                 |
|                      |             | - timespan: 365 days, 0:00:00, granularity: 1:00:00, points: 8760     |                                 |
| low                  |           0 | - timespan: 30 days, 0:00:00, granularity: 0:05:00, points: 8640      | count, max, sum, min, mean, std |
| medium               |           0 | - timespan: 7 days, 0:00:00, granularity: 0:01:00, points: 10080      | count, max, sum, min, mean, std |
|                      |             | - timespan: 365 days, 0:00:00, granularity: 1:00:00, points: 8760     |                                 |
+----------------------+-------------+-----------------------------------------------------------------------+---------------------------------+
(gnocchi) archive-policy show high #显示具体的high这个归档策略,它有三个timespan
+---------------------+-------------------------------------------------------------------+
| Field               | Value                                                             |
+---------------------+-------------------------------------------------------------------+
| aggregation_methods | sum, max, min, count, mean, std                                   |
| back_window         | 0                                                                 |
| definition          | - timespan: 1:00:00, granularity: 0:00:01, points: 3600           |
|                     | - timespan: 7 days, 0:00:00, granularity: 0:01:00, points: 10080  |
|                     | - timespan: 365 days, 0:00:00, granularity: 1:00:00, points: 8760 |
| name                | high                                                              |
+---------------------+-------------------------------------------------------------------+

number of points = timespan ÷ granularity
例如:- timespan: 1:00:00, granularity: 0:00:01, points: 3600
timespan=1小时=1*3600s
granularity=1s
所以number of points=3600/1=3600

Resource
An entity representing anything in your infrastructure that you will associate metric(s) with. It is identified by a unique ID and can contain attributes.
ceilometer使用下面的配置文件把openstack中的resource和其中的metric

/usr/lib/python3/dist-packages/ceilometer/publisher/data/gnocchi_resources.yaml

使用下面的命令可以列出来gnocchi中的所有的resource type

# gnocchi resource-type list
# openstack volume list #先列出来openstack中的所有的volume,我们focus在第三个
+--------------------------------------+------+-----------+------+------------------------------+
| ID                                   | Name | Status    | Size | Attached to                  |
+--------------------------------------+------+-----------+------+------------------------------+
| 1f8a974d-ec4e-4a5c-8a4b-d836f6eb9aea |      | in-use    |    1 | Attached to i15 on /dev/vda  |
| 482d89e2-a118-42a3-a17c-adba82d9af79 |      | in-use    |    1 | Attached to i14 on /dev/vda  |
| d48526b7-03ae-4e68-befc-398530d19eac |      | available |    4 |     << this one              |
+--------------------------------------+------+-----------+------+------------------------------+# cinder-volume-usage-audit  --start_time='2021-01-01 00:00:00' --end_time='2021-06-16 00:00:00' --send_actions #通过这个命令让cinder发送相应的notification到gnocchi
2021-06-16 16:53:00.370 9402 INFO cinder [req-251fee86-283b-44a3-be77-5f6598529d11 - - - - -] Starting volume usage audit
2021-06-16 16:53:00.370 9402 INFO cinder [req-251fee86-283b-44a3-be77-5f6598529d11 - - - - -] Creating usages for 2021-01-01 00:00:00+00:00 until 2021-06-16 00:00:00+00:00
2021-06-16 16:53:00.776 9402 INFO cinder [req-251fee86-283b-44a3-be77-5f6598529d11 - - - - -] Found 12 volumes
2021-06-16 16:53:01.944 9402 INFO cinder [req-251fee86-283b-44a3-be77-5f6598529d11 - - - - -] Found 0 snapshots
2021-06-16 16:53:01.957 9402 INFO cinder [req-251fee86-283b-44a3-be77-5f6598529d11 - - - - -] Found 0 backups
2021-06-16 16:53:01.957 9402 INFO cinder [req-251fee86-283b-44a3-be77-5f6598529d11 - - - - -] Volume usage audit completed# gnocchi resource list #使用这个命令可以查看我们的volume对应的resource在gnocchi是是否已经创建成功
+--------------------------------------+----------------------------+----------------------------------+----------------------------------+-----------------------------------------------------------------------+----------------------------------+----------------------------------+----------------------------------+--------------+-------------------------------------------------------------------+
| id                                   | type                       | project_id                       | user_id                          | original_resource_id                                                  | started_at                       | ended_at                         | revision_start                   | revision_end | creator                                                           |
+--------------------------------------+----------------------------+----------------------------------+----------------------------------+-----------------------------------------------------------------------+----------------------------------+----------------------------------+----------------------------------+--------------+-------------------------------------------------------------------+
| d48526b7-03ae-4e68-befc-398530d19eac | volume                     | 0f364b66bfbc47cf8ef71a5cfa9d52c5 | 90f4cd87c649433aaee429adf969b6b3 | d48526b7-03ae-4e68-befc-398530d19eac                                  | 2021-06-16T03:27:10.965168+00:00 | None                             | 2021-06-16T03:27:10.965176+00:00 | None         | f03d11cb10864a79aba44cb28eebaa0b:d93cadf45bbd4d4f9733671cd7f9938f |

Metric
An entity storing aggregates identified by an UUID. It can be attached to a resource using a name. How a metric stores its aggregates is defined by the archive policy it is associated to.

# gnocchi resource show d48526b7-03ae-4e68-befc-398530d19eac #查看具体的resource
+-----------------------+-------------------------------------------------------------------+
| Field                 | Value                                                             |
+-----------------------+-------------------------------------------------------------------+
| created_by_project_id | d93cadf45bbd4d4f9733671cd7f9938f                                  |
| created_by_user_id    | f03d11cb10864a79aba44cb28eebaa0b                                  |
| creator               | f03d11cb10864a79aba44cb28eebaa0b:d93cadf45bbd4d4f9733671cd7f9938f |
| ended_at              | None                                                              |
| id                    | d48526b7-03ae-4e68-befc-398530d19eac                              |
| metrics               | volume.size: d88e0d63-443c-430b-8dd3-af8a65afeeaa   <关联的metric              |
| original_resource_id  | d48526b7-03ae-4e68-befc-398530d19eac                              |
| project_id            | 0f364b66bfbc47cf8ef71a5cfa9d52c5                                  |
| revision_end          | None                                                              |
| revision_start        | 2021-06-16T03:27:10.965176+00:00                                  |
| started_at            | 2021-06-16T03:27:10.965168+00:00                                  |
| type                  | volume                                                            |
| user_id               | 90f4cd87c649433aaee429adf969b6b3                                  |
+-----------------------+-------------------------------------------------------------------+
# gnocchi metric show d88e0d63-443c-430b-8dd3-af8a65afeeaa #查看resource相关的metric
+--------------------------------+-------------------------------------------------------------------+
| Field                          | Value                                                             |
+--------------------------------+-------------------------------------------------------------------+
| archive_policy/name            | low       << this one 使用到的归档策略                                                        |
| creator                        | f03d11cb10864a79aba44cb28eebaa0b:d93cadf45bbd4d4f9733671cd7f9938f |
| id                             | d88e0d63-443c-430b-8dd3-af8a65afeeaa                              |
| name                           | volume.size                                                       |
| resource/created_by_project_id | d93cadf45bbd4d4f9733671cd7f9938f                                  |
| resource/created_by_user_id    | f03d11cb10864a79aba44cb28eebaa0b                                  |
| resource/creator               | f03d11cb10864a79aba44cb28eebaa0b:d93cadf45bbd4d4f9733671cd7f9938f |
| resource/ended_at              | None                                                              |
| resource/id                    | d48526b7-03ae-4e68-befc-398530d19eac                              |
| resource/original_resource_id  | d48526b7-03ae-4e68-befc-398530d19eac                              |
| resource/project_id            | 0f364b66bfbc47cf8ef71a5cfa9d52c5                                  |
| resource/revision_end          | None                                                              |
| resource/revision_start        | 2021-06-16T03:27:10.965176+00:00                                  |
| resource/started_at            | 2021-06-16T03:27:10.965168+00:00                                  |
| resource/type                  | volume                                                            |
| resource/user_id               | 90f4cd87c649433aaee429adf969b6b3                                  |
| unit                           | GB                                                                |
+--------------------------------+-------------------------------------------------------------------+

Measure
An incoming datapoint tuple sent to Gnocchi by the api. It is composed of a timestamp and a value.

(gnocchi) archive-policy show low #因为上面一个metric使用的是low的归档策略,它的归档函数有count, max等
+---------------------+------------------------------------------------------------------+
| Field               | Value                                                            |
+---------------------+------------------------------------------------------------------+
| aggregation_methods | count, max, sum, min, mean, std                                  |
| back_window         | 0                                                                |
| definition          | - timespan: 30 days, 0:00:00, granularity: 0:05:00, points: 8640 |
| name                | low                                                              |
+---------------------+------------------------------------------------------------------+使用下面的命令了查询gnocchi中存储的归档数据,发现mean和 measure show的结果一样
root@controller:/var/lib/gnocchi# gnocchi measure aggregation -m d88e0d63-443c-430b-8dd3-af8a65afeeaa --aggregation count
+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2021-06-16T11:35:00+08:00 |       300.0 |   3.0 |
| 2021-06-16T11:40:00+08:00 |       300.0 |  10.0 |
| 2021-06-16T14:00:00+08:00 |       300.0 |   3.0 |
| 2021-06-16T16:50:00+08:00 |       300.0 |   3.0 |
+---------------------------+-------------+-------+
root@controller:/var/lib/gnocchi# gnocchi measure aggregation -m d88e0d63-443c-430b-8dd3-af8a65afeeaa --aggregation max
+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2021-06-16T11:35:00+08:00 |       300.0 |   2.0 |
| 2021-06-16T11:40:00+08:00 |       300.0 |   4.0 |
| 2021-06-16T14:00:00+08:00 |       300.0 |   4.0 |
| 2021-06-16T16:50:00+08:00 |       300.0 |   4.0 |
+---------------------------+-------------+-------+
^Croot@controller:/var/lib/gnocchi# gnocchi measure aggregation -m d88e0d63-443c-430b-8dd3-af8a65afeeaa --aggregation sum
+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2021-06-16T11:35:00+08:00 |       300.0 |   6.0 |
| 2021-06-16T11:40:00+08:00 |       300.0 |  33.0 |
| 2021-06-16T14:00:00+08:00 |       300.0 |  12.0 |
| 2021-06-16T16:50:00+08:00 |       300.0 |  12.0 |
+---------------------------+-------------+-------+
root@controller:/var/lib/gnocchi# gnocchi measure aggregation -m d88e0d63-443c-430b-8dd3-af8a65afeeaa --aggregation min
+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2021-06-16T11:35:00+08:00 |       300.0 |   2.0 |
| 2021-06-16T11:40:00+08:00 |       300.0 |   2.0 |
| 2021-06-16T14:00:00+08:00 |       300.0 |   4.0 |
| 2021-06-16T16:50:00+08:00 |       300.0 |   4.0 |
+---------------------------+-------------+-------+
root@controller:/var/lib/gnocchi# gnocchi measure aggregation -m d88e0d63-443c-430b-8dd3-af8a65afeeaa --aggregation std
+---------------------------+-------------+--------------------+
| timestamp                 | granularity |              value |
+---------------------------+-------------+--------------------+
| 2021-06-16T11:35:00+08:00 |       300.0 |                0.0 |
| 2021-06-16T11:40:00+08:00 |       300.0 | 0.6749485577105528 |
| 2021-06-16T14:00:00+08:00 |       300.0 |                0.0 |
| 2021-06-16T16:50:00+08:00 |       300.0 |                0.0 |
+---------------------------+-------------+--------------------+root@controller:/var/lib/gnocchi# gnocchi measure aggregation -m d88e0d63-443c-430b-8dd3-af8a65afeeaa --aggregation mean
+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2021-06-16T11:35:00+08:00 |       300.0 |   2.0 |
| 2021-06-16T11:40:00+08:00 |       300.0 |   3.3 |
| 2021-06-16T14:00:00+08:00 |       300.0 |   4.0 |
| 2021-06-16T16:50:00+08:00 |       300.0 |   4.0 |
+---------------------------+-------------+-------+
root@controller:/var/lib/gnocchi# gnocchi measure show d88e0d63-443c-430b-8dd3-af8a65afeeaa
+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2021-06-16T11:35:00+08:00 |       300.0 |   2.0 |
| 2021-06-16T11:40:00+08:00 |       300.0 |   3.3 |
| 2021-06-16T14:00:00+08:00 |       300.0 |   4.0 |
| 2021-06-16T16:50:00+08:00 |       300.0 |   4.0 |
+---------------------------+-------------+-------+

https://gnocchi.xyz/glossary.html#term-Measure

如果选择mysql作为gnocchi的index存储的话,gnocchi刚刚安装完成后,数据库中是没有任何的resource-type定义的。
只有通过执行下面两个命令后,gnocchi的存储目录和mysql中才会有数据。

# gnocchi-upgrade
# ceilometer-upgrade
/var/lib/gnocchi# find . -type f |grep d88e0d63-443c-430b-8dd3-af8a65afeeaa <--这是一个metric
./d8/8e/0d/63/44/3c/43/0b/8d/d3/af/8a/65/af/ee/aa/d88e0d63-443c-430b-8dd3-af8a65afeeaa/agg_max/1623240000.0_300.0_v3
./d8/8e/0d/63/44/3c/43/0b/8d/d3/af/8a/65/af/ee/aa/d88e0d63-443c-430b-8dd3-af8a65afeeaa/agg_std/1623240000.0_300.0_v3
./d8/8e/0d/63/44/3c/43/0b/8d/d3/af/8a/65/af/ee/aa/d88e0d63-443c-430b-8dd3-af8a65afeeaa/agg_sum/1623240000.0_300.0_v3
./d8/8e/0d/63/44/3c/43/0b/8d/d3/af/8a/65/af/ee/aa/d88e0d63-443c-430b-8dd3-af8a65afeeaa/none_v3
./d8/8e/0d/63/44/3c/43/0b/8d/d3/af/8a/65/af/ee/aa/d88e0d63-443c-430b-8dd3-af8a65afeeaa/agg_min/1623240000.0_300.0_v3
./d8/8e/0d/63/44/3c/43/0b/8d/d3/af/8a/65/af/ee/aa/d88e0d63-443c-430b-8dd3-af8a65afeeaa/agg_mean/1623240000.0_300.0_v3
./d8/8e/0d/63/44/3c/43/0b/8d/d3/af/8a/65/af/ee/aa/d88e0d63-443c-430b-8dd3-af8a65afeeaa/agg_count/1623240000.0_300.0_v3

https://blog.csdn.net/zhujisoft/article/details/104414575
https://aalvarez.me/posts/understanding-gnocchi-measures/
https://gnocchi.xyz/operating.html

gnocchi中的resource/metric/measure等的关系相关推荐

  1. 驱动中platform resource 和 porbe 之间的关系

    1. platform_device 会包含platform_data 和 resource定义: 一般platform device信息,会定义在 arch/arm/mach-xxx/board-x ...

  2. Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题

    Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题 这是API ...

  3. VS2005、VS2010等VS系列IDE在MFC开发过程中,Resource View标签打不开,问题为“opened in other editor”

    问题描述: VS2005.VS2010等VS系列IDE在MFC开发过程中,Resource View标签打不开,问题为"opened in other editor" 可能原因: ...

  4. AngularJS中的$resource使用与Restful资源交互

    1.AngularJS中的 $resource 这个服务可以创建一个资源对象,我们可以用它非常方便地同支持RESTful的服务端数据源进行交互,当同支持RESTful的数据模型一起工作时,它就派上用场 ...

  5. 路由表中preference 和metric的含义

    路由表中preference 和metric的含义 这里提到与其他路由协议的配合是因为在路由器上往往支持多路由协议,多路由协议的支持就有一个多种路由的选择和配合问题.为了解决这个问题,在路由的参数中引 ...

  6. Gnocchi 7、Gnocchi中的水平扩展

    1 聚合层 在聚合层中的数据处理是分发的: 一个metricd 服务可以对至少一个sack(并行处理单元)负责.而职责不是独占的. 例如不同的服务因为副本的原因可以对相同的sack负责.它自动带来了锁 ...

  7. mysql里面的选择运算_在MySQL关系模型中,选择运算是在一个关系的所有元组中选择指定属性列,组成新关系。...

    [单选题]下列关于元素第一电离能的说法不正确的是( ) [填空题]We had already ____ contact with the museum. [判断题]DELETE语句功能是对表中所有记 ...

  8. Linux 编程中的API函数和系统调用的关系【转】

    转自:http://blog.chinaunix.net/uid-25968088-id-3426027.html 原文地址:Linux 编程中的API函数和系统调用的关系 作者:up哥小号 API: ...

  9. 【Groovy】自定义 Xml 生成器 BuilderSupport ( setParent 方法中设置父节点与子节点关系 )

    文章目录 一.setParent 方法中设置父节点与子节点关系 二.完整代码示例 1.MyBuilderSupport 生成器代码 2.使用 MyBuilderSupport 生成器创建 Xml 代码 ...

最新文章

  1. linux系统分析命令,Linux操作系统基础解析之(四)——Linux基本命令剖析(2)
  2. ASP.NET AJAX 1.0 发布
  3. ios 底部用定位 fixed。在软件盘出来后,页面元素被顶上去一部分,fixed定位的footer也跑到了上面去。解决方法...
  4. [React Router v4] Conditionally Render a Route with the Switch Component
  5. 证件照排版软件_证件照小程序换背景(制作免费版)
  6. Mybatis实体类属性名与数据库类名不对应的两种解决方法
  7. Terrafugia希望在今年夏天带来真正可飞的Airplane
  8. android gridview拖动排序,Asp.net GridView 拖拽排序    原创(欢迎拍砖,敬请嘴下留情!)...
  9. Android查看wakeLock调用情况
  10. java文件复制方法_Java复制文件–用Java复制文件的4种方法
  11. 特异度(specificity)与灵敏度(sensitivity)
  12. 2019年DNS服务器速度测评【DNS速度排名】
  13. Linux下限制带宽的方法
  14. 【信息流推荐论文大赏】Predicting Clicks: Estimating the Click-Through Rate for New Ads
  15. vue 开发的微信公众号网页 添加背景音乐,以及音乐图标旋转动画
  16. pvt检查是什么意思_EVT、DVT、PVT是什么意思
  17. JavaWeb新闻发布系统案例08——完结篇
  18. android 闹钟取消,Android,如何取消闹钟? alarmManager.cancel无效
  19. Provisioning profile iOS Team Provisioning Profile:XXXXdoesn't include the currently selected devi
  20. 记Windows系统里MD5、SHA1、CRC32编码值的查看

热门文章

  1. Speeding-up algorithms with SSE
  2. 关于Node.js的httpClieint请求报错ECONNRESET的原因和解决措施
  3. 命令模式(Command pattern)及代码实现
  4. blueMoon (哗--)论坛自动点广告完成星成就自动道具工具
  5. ANSI, UTF-8, Unicode, GBK, GB2312 字符编码小结
  6. app爬虫(1)谷歌Nexus6P获取root
  7. UAV012_V2(二):无人机姿态解算(深入篇)
  8. 软件测试这个职业可以做到多大年纪,软件测试能干到多少岁
  9. JavaScript实现ZLOGO子集: 前进+转向
  10. 计算机黑屏如何重启,电脑黑屏怎么重启 电脑黑屏怎么办