OpenStack Gnocchi - 相当于 ceilometer /v2/meter/[meter]/statistics

发布于 2025-01-13 04:00:54 字数 3969 浏览 0 评论 0 原文

我正在寻找 Gnocchi 的 ceilometer Web api 的 /meter/[meterName]/statistics 端点的完全等效项,但我正在努力寻找等效项,看起来没有办法检索相同的信息。

ceilometer 端点提到,当调用简单的统计请求时(使用 GET /v2/meters//statistics),它将返回标准的统计数据集:avg、sum、min、max 和 count . 并提供了一个富有表现力的 API,允许应用进一步的过滤和高级搜索选项,如下所示:

GET /v2/meters/instance/statistics
q: [{"field": "user_id",
    "op": "eq",
    "value": "user-2"},
    {"field": "source",
     "op": "eq",
     "value": "source-1"}]
groupby: ["project_id", "resource_id"]

它将产生如下输出:(

[{"count": 4, "duration_start": "2013-09-18T19:08:33", "min": 1.0,
  "max": 1.0, "duration_end": "2013-09-18T19:27:30", "period": 0,
  "sum": 4.0, "period_end": "2013-09-18T19:27:30", "duration": 1137.0,
  "period_start": "2013-09-18T19:08:33", "avg": 1.0,
  "groupby": {"project_id": "c2334f175d8b4cb8b1db49d83cecde78",
              "resource_id": "551f495f-7f49-4624-a34c-c422f2c5f90b"},
  "unit": "image"},
 {"count": 4, "duration_start": "2013-09-18T19:08:36", "min": 1.0,
  "max": 1.0, "duration_end": "2013-09-18T19:27:30", "period": 0,
  "sum": 4.0, "period_end": "2013-09-18T19:27:30", "duration": 1134.0,
  "period_start": "2013-09-18T19:08:36", "avg": 1.0,
  "groupby": {"project_id": "c2334f175d8b4cb8b1db49d83cecde78",
              "resource_id": "7c1157ed-cf30-48af-a868-6c7c3ad7b531"},
  "unit": "image"},
 {"count": 4, "duration_start": "2013-09-18T19:08:34", "min": 1.0,
  "max": 1.0, "duration_end": "2013-09-18T19:27:30", "period": 0,
  "sum": 4.0, "period_end": "2013-09-18T19:27:30", "duration": 1136.0,
  "period_start": "2013-09-18T19:08:34", "avg": 1.0,
  "groupby": {"project_id": "c2334f175d8b4cb8b1db49d83cecde78",
              "resource_id": "eaed9cf4-fc99-4115-93ae-4a5c37a1a7d7"},
  "unit": "image"}]

有关该内容的文档可以在 此处)。

相反,在 Gnocchi 中(可以在此处找到有关 Web api 的文档),我没有找到任何生成相同信息的方法,我能匹配的最接近的是使用动态聚合 api,尽管似乎没有任何方法可以过滤元数据: https://gnocchi.osci.io/rest.html#groupby

POST /v1/aggregates?start=2014-10-06T14:34&groupby=host&groupby=flavor_id HTTP/1.1
Content-Type: application/json
Content-Length: 149

{
  "operations": "(* (aggregate mean (metric cpu.util mean)) 4)",
  "resource_type": "instance",
  "search": "server_group='my_autoscaling_group'"
}

将产生如下内容:

HTTP/1.1 200 OK
Content-Length: 550
Content-Type: application/json

[
  {
    "group": {
      "flavor_id": "2",
      "host": "compute1"
    },
    "measures": {
      "measures": {
        "aggregated": [
          [
            "2014-10-06T14:00:00+00:00",
            3600.0,
            43.333333333333336
          ],
          [
            "2014-10-06T14:34:00+00:00",
            60.0,
            58.0
          ],
          [
            "2014-10-06T14:34:12+00:00",
            1.0,
            80.0
          ],
          [
            "2014-10-06T14:34:20+00:00",
            1.0,
            36.0
          ]
        ]
      }
    }
  },
  {
    "group": {
      "flavor_id": "2",
      "host": "compute2"
    },
    "measures": {
      "measures": {
        "aggregated": [
          [
            "2014-10-06T14:00:00+00:00",
            3600.0,
            58.4
          ],
          [
            "2014-10-06T14:30:00+00:00",
            1800.0,
            58.4
          ],
          [
            "2014-10-06T14:34:12+00:00",
            1.0,
            18.0
          ],
          [
            "2014-10-06T14:34:20+00:00",
            1.0,
            56.8
          ]
        ]
      }
    }
  }
]

但是,除了不允许过滤元数据之外,端点仍然会产生测量值(聚合度量)而不是聚合数据。

尽管 OpenStack 文档中提到 Gnocchi 作为 Ceilometer 的更新替代品,但似乎没有任何方法可以生成相同的数据。

有人设法找到一种方法来替换云高计端点吗?

I'm looking for the exact equivalent of the /meter/[meterName]/statistics endpoint of the ceilometer web api for Gnocchi, but I'm struggling finding the equivalent, it looks like there is no way to retrieve the same informations.

The ceilometer endpoint mentions that When a simple statistics request is invoked (using GET /v2/meters/<meter_name>/statistics), it will return the standard set of Statistics: avg, sum, min, max, and count. and provides an expressive API allowing to apply further filtering and advanced search options, like this:

GET /v2/meters/instance/statistics
q: [{"field": "user_id",
    "op": "eq",
    "value": "user-2"},
    {"field": "source",
     "op": "eq",
     "value": "source-1"}]
groupby: ["project_id", "resource_id"]

which will produce an output like this:

[{"count": 4, "duration_start": "2013-09-18T19:08:33", "min": 1.0,
  "max": 1.0, "duration_end": "2013-09-18T19:27:30", "period": 0,
  "sum": 4.0, "period_end": "2013-09-18T19:27:30", "duration": 1137.0,
  "period_start": "2013-09-18T19:08:33", "avg": 1.0,
  "groupby": {"project_id": "c2334f175d8b4cb8b1db49d83cecde78",
              "resource_id": "551f495f-7f49-4624-a34c-c422f2c5f90b"},
  "unit": "image"},
 {"count": 4, "duration_start": "2013-09-18T19:08:36", "min": 1.0,
  "max": 1.0, "duration_end": "2013-09-18T19:27:30", "period": 0,
  "sum": 4.0, "period_end": "2013-09-18T19:27:30", "duration": 1134.0,
  "period_start": "2013-09-18T19:08:36", "avg": 1.0,
  "groupby": {"project_id": "c2334f175d8b4cb8b1db49d83cecde78",
              "resource_id": "7c1157ed-cf30-48af-a868-6c7c3ad7b531"},
  "unit": "image"},
 {"count": 4, "duration_start": "2013-09-18T19:08:34", "min": 1.0,
  "max": 1.0, "duration_end": "2013-09-18T19:27:30", "period": 0,
  "sum": 4.0, "period_end": "2013-09-18T19:27:30", "duration": 1136.0,
  "period_start": "2013-09-18T19:08:34", "avg": 1.0,
  "groupby": {"project_id": "c2334f175d8b4cb8b1db49d83cecde78",
              "resource_id": "eaed9cf4-fc99-4115-93ae-4a5c37a1a7d7"},
  "unit": "image"}]

(documentation about that can be found here).

In Gnocchi, instead (documentation about web apis can be found here) I didn't find any way to produce the same info, the closest I could match was using the dynamic aggregates api, although there does not seem any way to filter on the metadata: https://gnocchi.osci.io/rest.html#groupby

POST /v1/aggregates?start=2014-10-06T14:34&groupby=host&groupby=flavor_id HTTP/1.1
Content-Type: application/json
Content-Length: 149

{
  "operations": "(* (aggregate mean (metric cpu.util mean)) 4)",
  "resource_type": "instance",
  "search": "server_group='my_autoscaling_group'"
}

which will produce something like this:

HTTP/1.1 200 OK
Content-Length: 550
Content-Type: application/json

[
  {
    "group": {
      "flavor_id": "2",
      "host": "compute1"
    },
    "measures": {
      "measures": {
        "aggregated": [
          [
            "2014-10-06T14:00:00+00:00",
            3600.0,
            43.333333333333336
          ],
          [
            "2014-10-06T14:34:00+00:00",
            60.0,
            58.0
          ],
          [
            "2014-10-06T14:34:12+00:00",
            1.0,
            80.0
          ],
          [
            "2014-10-06T14:34:20+00:00",
            1.0,
            36.0
          ]
        ]
      }
    }
  },
  {
    "group": {
      "flavor_id": "2",
      "host": "compute2"
    },
    "measures": {
      "measures": {
        "aggregated": [
          [
            "2014-10-06T14:00:00+00:00",
            3600.0,
            58.4
          ],
          [
            "2014-10-06T14:30:00+00:00",
            1800.0,
            58.4
          ],
          [
            "2014-10-06T14:34:12+00:00",
            1.0,
            18.0
          ],
          [
            "2014-10-06T14:34:20+00:00",
            1.0,
            56.8
          ]
        ]
      }
    }
  }
]

However, apart from not allowing to filter for metadata, the endpoint still produces measures (aggregated measures) instead of aggregated data.

There does not seem to be any way to produce the same data, although Gnocchi is mentioned as the updated substitute of Ceilometer in the OpenStack documentation.

Did anyone manage to find a way to replace the ceilometer endpoint?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

守不住的情 2025-01-20 04:00:54

我通过官方 Gnocchi 存储库通过 github 得到了答案。

看起来您无法直接获得相同的输出,尽管有两种可能的策略可以接近它:

  1. 定义与所需聚合相匹配的存档策略。
  2. 稍后对每个统计数据执行 http 请求并手动聚合数据。

有关更多信息,请直接在此处找到

I've got an answer through github through the official Gnocchi repository.

It looks like you cannot directly get the same output, although there are two possible strategies to get close to it:

  1. Define an archive policy that matches the desired aggregation.
  2. Perform the http requests for each stat and aggregate data manually later.

More about that can be directly found here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文