验证操作

验证遥测服务的操作。这些步骤仅包含镜像服务的计量器,以减少混乱。与 Ceilometer 集成的其他服务的环境包含更多的计量器。

注意

在控制器节点上执行以下步骤。

注意

以下使用 Gnocchi 验证数据。或者,可以使用 file:// 发布者将数据临时发布到文件后端。

  1. 激活 admin 凭证以访问仅管理员可用的 CLI 命令

    $ . admin-openrc
    
  2. 列出可用的资源及其计量器

    $ gnocchi resource list  --type image
    +--------------------------------------+-------+----------------------------------+---------+--------------------------------------+----------------------------------+----------+----------------------------------+--------------+
    | id                                   | type  | project_id                       | user_id | original_resource_id                 | started_at                       | ended_at | revision_start                   | revision_end |
    +--------------------------------------+-------+----------------------------------+---------+--------------------------------------+----------------------------------+----------+----------------------------------+--------------+
    | a6b387e1-4276-43db-b17a-e10f649d85a3 | image | 6fd9631226e34531b53814a0f39830a9 | None    | a6b387e1-4276-43db-b17a-e10f649d85a3 | 2017-01-25T23:50:14.423584+00:00 | None     | 2017-01-25T23:50:14.423601+00:00 | None         |
    +--------------------------------------+-------+----------------------------------+---------+--------------------------------------+----------------------------------+----------+----------------------------------+--------------+
    
    $ gnocchi resource show a6b387e1-4276-43db-b17a-e10f649d85a3
    +-----------------------+-------------------------------------------------------------------+
    | Field                 | Value                                                             |
    +-----------------------+-------------------------------------------------------------------+
    | created_by_project_id | aca4db3db9904ecc9c1c9bb1763da6a8                                  |
    | created_by_user_id    | 07b0945689a4407dbd1ea72c3c5b8d2f                                  |
    | creator               | 07b0945689a4407dbd1ea72c3c5b8d2f:aca4db3db9904ecc9c1c9bb1763da6a8 |
    | ended_at              | None                                                              |
    | id                    | a6b387e1-4276-43db-b17a-e10f649d85a3                              |
    | metrics               | image.download: 839afa02-1668-4922-a33e-6b6ea7780715              |
    |                       | image.serve: 1132e4a0-9e35-4542-a6ad-d6dc5fb4b835                 |
    |                       | image.size: 8ecf6c17-98fd-446c-8018-b741dc089a76                  |
    | original_resource_id  | a6b387e1-4276-43db-b17a-e10f649d85a3                              |
    | project_id            | 6fd9631226e34531b53814a0f39830a9                                  |
    | revision_end          | None                                                              |
    | revision_start        | 2017-01-25T23:50:14.423601+00:00                                  |
    | started_at            | 2017-01-25T23:50:14.423584+00:00                                  |
    | type                  | image                                                             |
    | user_id               | None                                                              |
    +-----------------------+-------------------------------------------------------------------+
    
  3. 从镜像服务下载 CirrOS 镜像

    $ IMAGE_ID=$(glance image-list | grep 'cirros' | awk '{ print $2 }')
    $ glance image-download $IMAGE_ID > /tmp/cirros.img
    
  4. 再次列出可用的计量器,以验证镜像下载的检测

    $ gnocchi measures show 839afa02-1668-4922-a33e-6b6ea7780715
    +---------------------------+-------------+-----------+
    | timestamp                 | granularity |     value |
    +---------------------------+-------------+-----------+
    | 2017-01-26T15:35:00+00:00 |       300.0 | 3740163.0 |
    +---------------------------+-------------+-----------+
    
  5. 删除先前下载的镜像文件 /tmp/cirros.img

    $ rm /tmp/cirros.img