Viewing resources, metrics, and measures

After connecting to the OpenStack command-line interface, you can get access to your compute resource metrics by using the Gnocchi command-line tool. You can see the full list of gnocchi commands in the Gnocchi documentation.

Prerequisites

To view existing resources

Use the gnocchi resource list command. For example:

# gnocchi --insecure resource list -c id -c type -c project_id
+---------------+----------------------------+------------+
| id            | type                       | project_id |
+---------------+----------------------------+------------+
| 238597c7<...> | volume                     | c1bf1<...> |
| 3c78558f<...> | instance                   | c1bf1<...> |
| 44f1896f<...> | instance_network_interface | c1bf1<...> |
| 880e9efc<...> | instance_disk              | c1bf1<...> |
+---------------+----------------------------+------------+

The output shows that the compute cluster hosts one virtual machine with one NIC and one disk that is also present as a volume.

To view available metrics for resources

Use the gnocchi metric list command. For example:

# gnocchi --insecure metric list
+-------------+-------+-------------------------------+---------+-------------+
| id          | <...> | name                          | unit    | resource_id |
+-------------+-------+-------------------------------+---------+-------------+
| 243c7a<...> | <...> | disk.root.size                | GB      | 3c7855<...> |
| 365e45<...> | <...> | network.outgoing.packets      | packet  | 44f189<...> |
| 4fbd3e<...> | <...> | disk.device.read.requests     | request | 880e9e<...> |
| 54519f<...> | <...> | compute.instance.booting.time | sec     | 3c7855<...> |
| 5e1406<...> | <...> | disk.device.write.bytes       | B       | 880e9e<...> |
| 66a96c<...> | <...> | vcpus                         | vcpu    | 3c7855<...> |
| 722ea9<...> | <...> | memory                        | MB      | 3c7855<...> |
| 7c961a<...> | <...> | disk.device.write.requests    | request | 880e9e<...> |
| 87e9fb<...> | <...> | network.incoming.packets      | packet  | 44f189<...> |
| 9d5632<...> | <...> | disk.device.read.bytes        | B       | 880e9e<...> |
| b8be8f<...> | <...> | cpu                           | ns      | 3c7855<...> |
| c1961b<...> | <...> | disk.ephemeral.size           | GB      | 3c7855<...> |
| c9b61e<...> | <...> | volume.size                   | GB      | 238597<...> |
| d06a58<...> | <...> | network.outgoing.bytes        | B       | 44f189<...> |
| e2d998<...> | <...> | network.incoming.bytes        | B       | 44f189<...> |
| eaac2b<...> | <...> | memory.usage                  | MB      | 3c7855<...> |
+-------------+-------+-------------------------------+---------+-------------+

To view measures for a metric

Use the gnocchi measures show command. For example:

# gnocchi --insecure measures show cpu --resource-id 3c78558f-08bf-47e2-ba3e-bdb13e7b25bb
+---------------------------+-------------+-------------+
| timestamp                 | granularity |       value |
+---------------------------+-------------+-------------+
| 2019-12-11T17:05:00+03:00 |       300.0 |  2.2756e+11 |
| 2019-12-11T17:10:00+03:00 |       300.0 |  2.8897e+11 |
| 2019-12-11T17:15:00+03:00 |       300.0 |  3.7367e+11 |
| 2019-12-11T17:20:00+03:00 |       300.0 |    4.64e+11 |
| 2019-12-11T17:25:00+03:00 |       300.0 |  7.6104e+11 |
+---------------------------+-------------+-------------+

By default, the mean aggregation method is used. To obtain how much CPU time is consumed per interval, use the --aggregation rate:mean option:

# gnocchi --insecure measures show cpu --aggregation rate:mean \
--resource-id 3c78558f-08bf-47e2-ba3e-bdb13e7b25bb
+---------------------------+-------------+---------------+
| timestamp                 | granularity |         value |
+---------------------------+-------------+---------------+
| 2019-12-11T17:10:00+03:00 |       300.0 | 61410000000.0 |
| 2019-12-11T17:15:00+03:00 |       300.0 | 84700000000.0 |
| 2019-12-11T17:20:00+03:00 |       300.0 | 90330000000.0 |
| 2019-12-11T17:25:00+03:00 |       300.0 |    2.9704e+11 |
| 2019-12-11T17:30:00+03:00 |       300.0 |      3.64e+11 |
+---------------------------+-------------+---------------+