Ubuntu 18.04
Sponsored Link

OpenStack Queens : How to use Ceilometer (Nova Compute)
2018/06/20
 
This is how to use OpenStack Telemetry Service (Ceilometer) for Nova Compute service.
This example is based on the emvironment like follows.
 ------------+---------------------------+---------------------------+------------
             |                           |                           |
         eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
 +-----------+-----------+   +-----------+-----------+   +-----------+-----------+
 |    [ Control Node ]   |   |    [ Network Node ]   |   |    [ Compute Node ]   |
 |                       |   |                       |   |                       |
 |  MariaDB    RabbitMQ  |   |      Linux Bridge     |   |        Libvirt        |
 |  Memcached  httpd     |   |        L2_Agent       |   |     Nova_Compute      |
 |  Keystone   Glance    |   |        L3_Agent       |   |      Linux Bridge     |
 |  Nova_API  Cinder_API |   |     Metadata_Agent    |   |        L2_Agent       |
 |  Neutron_Server       |   |     Cinder_Volume     |   |   Ceilometer_Compute  |
 |  Metadata_Agent       |   |        Heat_API       |   |                       |
 |                       |   |      Heat Engine      |   |                       |
 |                       |   |    Gnocchi  httpd     |   |                       |
 |                       |   |   Ceilometer_Central  |   |                       |
 +-----------------------+   +-----------------------+   +-----------------------+

[1] Change settings for Nova Compute service to enable Telemetry data collention like follows.
root@node01:~#
vi /etc/nova/nova.conf
# add follows into [DEFAULT] section

instance_usage_audit = True
instance_usage_audit_period = hour
notify_on_state_change = vm_and_task_state
# add to the end

[oslo_messaging_notifications]
driver = messagingv2
root@node01:~#
systemctl restart nova-compute

[2] It's some example to display metrics and meters.
# create and start an instance

ubuntu@dlp ~(keystone)$
Int_Net_ID=$(openstack network list | grep int_net | awk '{ print $2 }')

ubuntu@dlp ~(keystone)$
openstack server create --flavor m1.small --image Ubuntu1804 --security-group secgroup01 --nic net-id=$Int_Net_ID --key-name mykey Ubuntu_180401

# list resources

ubuntu@dlp ~(keystone)$
openstack metric resource list

+--------------------------------------+----------------------------+----------------------------------
| id                                   | type                       | project_id                       
+--------------------------------------+----------------------------+----------------------------------
| bbc2a8a6-7c81-4d4e-94c5-0632ff3aa86f | instance                   | 04a16d601dc940dd845f3092ce2712e8 
| 3aae02ab-b9b7-4edf-81e2-fea2df72fc8e | instance                   | 04a16d601dc940dd845f3092ce2712e8 
| 511490b6-a731-52fb-8a08-0b26b11b4cd5 | instance_disk              | 04a16d601dc940dd845f3092ce2712e8 
| bbb376d5-5e6b-581d-996d-73a018efa641 | instance_network_interface | 04a16d601dc940dd845f3092ce2712e8 
+--------------------------------------+----------------------------+----------------------------------
+----------------------------------+-----------------------------------------------------------------------
| user_id                          | original_resource_id                                                  
+----------------------------------+-----------------------------------------------------------------------
| 601473fae2c444a484860046ef2484e2 | bbc2a8a6-7c81-4d4e-94c5-0632ff3aa86f                                  
| 601473fae2c444a484860046ef2484e2 | 3aae02ab-b9b7-4edf-81e2-fea2df72fc8e                                  
| 601473fae2c444a484860046ef2484e2 | bbc2a8a6-7c81-4d4e-94c5-0632ff3aa86f-vda                              
| 601473fae2c444a484860046ef2484e2 | instance-00000004-bbc2a8a6-7c81-4d4e-94c5-0632ff3aa86f-tap5888b9b4-3b 
+----------------------------------+-----------------------------------------------------------------------
+----------------------------------+----------------------------------+----------------------------------
| started_at                       | ended_at                         | revision_start                   
+----------------------------------+----------------------------------+----------------------------------
| 2018-06-20T06:25:47.268833+00:00 | None                             | 2018-06-20T06:25:47.268855+00:00 
| 2018-06-20T06:25:54.642586+00:00 | 2018-06-20T06:28:37.937174+00:00 | 2018-06-20T06:28:39.211157+00:00 
| 2018-06-20T06:29:39.818178+00:00 | None                             | 2018-06-20T06:29:39.818194+00:00 
| 2018-06-20T06:29:39.842326+00:00 | None                             | 2018-06-20T06:29:39.842346+00:00 
+----------------------------------+----------------------------------+----------------------------------
+--------------+-------------------------------------------------------------------+
| revision_end | creator                                                           |
+--------------+-------------------------------------------------------------------+
| None         | 78ed5a8c14194fcba73206f1c0b0174f:fa8bf7aca73e44cb9bc2c9f42859857e |
| None         | 78ed5a8c14194fcba73206f1c0b0174f:fa8bf7aca73e44cb9bc2c9f42859857e |
| None         | 78ed5a8c14194fcba73206f1c0b0174f:fa8bf7aca73e44cb9bc2c9f42859857e |
| None         | 78ed5a8c14194fcba73206f1c0b0174f:fa8bf7aca73e44cb9bc2c9f42859857e |
+--------------+-------------------------------------------------------------------+

# details of the instance resource instance

ubuntu@dlp ~(keystone)$
openstack metric resource show bbc2a8a6-7c81-4d4e-94c5-0632ff3aa86f

+-----------------------+---------------------------------------------------------------------+
| Field                 | Value                                                               |
+-----------------------+---------------------------------------------------------------------+
| created_by_project_id | fa8bf7aca73e44cb9bc2c9f42859857e                                    |
| created_by_user_id    | 78ed5a8c14194fcba73206f1c0b0174f                                    |
| creator               | 78ed5a8c14194fcba73206f1c0b0174f:fa8bf7aca73e44cb9bc2c9f42859857e   |
| ended_at              | None                                                                |
| id                    | bbc2a8a6-7c81-4d4e-94c5-0632ff3aa86f                                |
| metrics               | compute.instance.booting.time: 3b1c03e6-8880-409a-942c-78c15a873359 |
|                       | cpu.delta: 7151b3aa-2a9f-4c54-b505-5e01233abe32                     |
|                       | cpu: 1dfdf51b-f7fa-4f35-a20e-d0ec9338ad67                           |
|                       | cpu_l3_cache: 50d991bb-aff1-408c-b95f-1ec005b07e27                  |
|                       | cpu_util: eed623b1-9190-4cb2-81c3-03e833726c04                      |
|                       | disk.allocation: 245990b2-8f0d-4085-9214-8f80b2567e48               |
|                       | disk.capacity: 0f9058aa-a4c0-4d6e-b0ef-2ba68317f7bf                 |
|                       | disk.ephemeral.size: 1343d713-2f95-4a1d-8789-866b3d82ab7b           |
|                       | disk.iops: d8211cb4-1b27-4a88-a192-9ff768fd4fdc                     |
|                       | disk.latency: 0835ca5f-eef0-4a81-82d3-1776dea28156                  |
|                       | disk.read.bytes.rate: a5b02643-8cd1-4005-9a6b-18fc7e2f09cd          |
|                       | disk.read.bytes: 132d3da0-9b04-4b8b-b1c4-8a27a704f3ad               |
|                       | disk.read.requests.rate: c955b972-515d-43e1-9b9e-f0684b77024d       |
|                       | disk.read.requests: 2ca35874-e650-47df-9ef8-dcc276e9de86            |
|                       | disk.root.size: e1c8202f-8907-4cff-be31-e9aba9cef878                |
|                       | disk.usage: 51d1ccdb-0f5b-441a-b839-e459ae378bf6                    |
|                       | disk.write.bytes.rate: 04c5e667-3632-464b-9e42-a1e88bd23c8d         |
|                       | disk.write.bytes: be1bfc65-78d4-48f0-aa38-8afcb0998c4e              |
|                       | disk.write.requests.rate: 9128cea2-a3a4-4ab8-9866-213f3847c7a5      |
|                       | disk.write.requests: 67252cdd-462d-4903-876b-426ab7c6651a           |
|                       | memory.bandwidth.local: f48a0783-143b-4b3c-bd76-95dfbf2fa96d        |
|                       | memory.bandwidth.total: ede3b5d5-2ba8-4e2a-bc31-8b67671346e4        |
|                       | memory.resident: eb6bd63b-72bc-4606-9108-7959d1efa67c               |
|                       | memory.swap.in: c20bb4d5-bfd1-4ba3-b144-694bb2c0a79a                |
|                       | memory.swap.out: 693a4989-1ace-4251-a248-b287a8c37ab1               |
|                       | memory.usage: dfb63bbd-e19e-4aaa-ab9c-3fb43a94ad36                  |
|                       | memory: 14b223d3-ab47-4d57-b7d6-874362f4f8d7                        |
|                       | perf.cache.misses: d80b0da6-584f-49b2-914b-49fb58a0d07b             |
|                       | perf.cache.references: b1804afa-8862-4172-958c-5e21c4ff938d         |
|                       | perf.cpu.cycles: 70240691-c3fd-47c1-98f1-2af49c206e37               |
|                       | perf.instructions: f845de64-bd47-4e70-9b41-e6cfca84b89b             |
|                       | vcpus: 0f9ea4ee-2941-4df8-83f5-f22df6bae7c6                         |
| original_resource_id  | bbc2a8a6-7c81-4d4e-94c5-0632ff3aa86f                                |
| project_id            | 04a16d601dc940dd845f3092ce2712e8                                    |
| revision_end          | None                                                                |
| revision_start        | 2018-06-20T06:25:47.268855+00:00                                    |
| started_at            | 2018-06-20T06:25:47.268833+00:00                                    |
| type                  | instance                                                            |
| user_id               | 601473fae2c444a484860046ef2484e2                                    |
+-----------------------+---------------------------------------------------------------------+

# display instance boot time

ubuntu@dlp ~(keystone)$
openstack metric measures show 3b1c03e6-8880-409a-942c-78c15a873359

+---------------------------+-------------+-----------+
| timestamp                 | granularity |     value |
+---------------------------+-------------+-----------+
| 2018-06-20T15:25:00+09:00 |       300.0 | 10.197467 |
+---------------------------+-------------+-----------+

# CPU

ubuntu@dlp ~(keystone)$
openstack metric measures show 1dfdf51b-f7fa-4f35-a20e-d0ec9338ad67

+---------------------------+-------------+---------------+
| timestamp                 | granularity |         value |
+---------------------------+-------------+---------------+
| 2018-06-20T15:25:00+09:00 |       300.0 | 42880000000.0 |
| 2018-06-20T15:30:00+09:00 |       300.0 |    3.3642e+11 |
| 2018-06-20T15:35:00+09:00 |       300.0 |    3.8489e+11 |
| 2018-06-20T15:40:00+09:00 |       300.0 |    3.8872e+11 |
+---------------------------+-------------+---------------+

# memory usage

ubuntu@dlp ~(keystone)$
openstack metric measures show dfb63bbd-e19e-4aaa-ab9c-3fb43a94ad36

+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2018-06-20T15:25:00+09:00 |       300.0 | 543.0 |
| 2018-06-20T15:30:00+09:00 |       300.0 | 559.0 |
| 2018-06-20T15:35:00+09:00 |       300.0 | 594.0 |
| 2018-06-20T15:40:00+09:00 |       300.0 | 594.0 |
+---------------------------+-------------+-------+

# details of instance_network_interface

ubuntu@dlp ~(keystone)$
openstack metric resource show bbb376d5-5e6b-581d-996d-73a018efa641

+-----------------------+-----------------------------------------------------------------------+
| Field                 | Value                                                                 |
+-----------------------+-----------------------------------------------------------------------+
| created_by_project_id | fa8bf7aca73e44cb9bc2c9f42859857e                                      |
| created_by_user_id    | 78ed5a8c14194fcba73206f1c0b0174f                                      |
| creator               | 78ed5a8c14194fcba73206f1c0b0174f:fa8bf7aca73e44cb9bc2c9f42859857e     |
| ended_at              | None                                                                  |
| id                    | bbb376d5-5e6b-581d-996d-73a018efa641                                  |
| metrics               | network.incoming.bytes.rate: 97a07c38-f9ba-4a13-93c6-6ef4b62e06ce     |
|                       | network.incoming.bytes: 7ec619a6-60a5-4f93-87cf-89733828ce06          |
|                       | network.incoming.packets.drop: cc1f13e4-3598-4e09-8ce9-fdb20edd365b   |
|                       | network.incoming.packets.error: a7ab04a4-25d5-47c6-a772-36abb2229a12  |
|                       | network.incoming.packets.rate: b1755cac-69fc-4e37-b738-db08bfa9b3c1   |
|                       | network.incoming.packets: 98bf231f-0d44-410e-8279-98276bc1c6b9        |
|                       | network.outgoing.bytes.rate: 40ba1732-fbb2-4706-a5d2-14a1e607c44a     |
|                       | network.outgoing.bytes: e9260534-6d1c-40c3-abcb-1508ef0f57ea          |
|                       | network.outgoing.packets.drop: 0b04ff4c-87ed-4cb2-928b-5efcc8442388   |
|                       | network.outgoing.packets.error: f0ef45cf-9d96-4bb5-a393-4efb3f5d067e  |
|                       | network.outgoing.packets.rate: 6b1f7467-7ace-43a2-85e4-f260f3357c55   |
|                       | network.outgoing.packets: 2035e428-58eb-4f7d-97fe-b4ac89dbc163        |
| original_resource_id  | instance-00000004-bbc2a8a6-7c81-4d4e-94c5-0632ff3aa86f-tap5888b9b4-3b |
| project_id            | 04a16d601dc940dd845f3092ce2712e8                                      |
| revision_end          | None                                                                  |
| revision_start        | 2018-06-20T06:29:39.842346+00:00                                      |
| started_at            | 2018-06-20T06:29:39.842326+00:00                                      |
| type                  | instance_network_interface                                            |
| user_id               | 601473fae2c444a484860046ef2484e2                                      |
+-----------------------+-----------------------------------------------------------------------+

# display network incoming bytes

ubuntu@dlp ~(keystone)$
openstack metric measures show 7ec619a6-60a5-4f93-87cf-89733828ce06

+---------------------------+-------------+------------+
| timestamp                 | granularity |      value |
+---------------------------+-------------+------------+
| 2018-06-20T15:25:00+09:00 |       300.0 | 37305754.0 |
| 2018-06-20T15:30:00+09:00 |       300.0 | 37312856.0 |
| 2018-06-20T15:35:00+09:00 |       300.0 | 39372521.0 |
| 2018-06-20T15:40:00+09:00 |       300.0 | 39372765.0 |
+---------------------------+-------------+------------+

# display network outgoing bytes

ubuntu@dlp ~(keystone)$
openstack metric measures show e9260534-6d1c-40c3-abcb-1508ef0f57ea

+---------------------------+-------------+----------+
| timestamp                 | granularity |    value |
+---------------------------+-------------+----------+
| 2018-06-20T15:25:00+09:00 |       300.0 | 231177.0 |
| 2018-06-20T15:30:00+09:00 |       300.0 | 234024.0 |
| 2018-06-20T15:35:00+09:00 |       300.0 | 340211.0 |
| 2018-06-20T15:40:00+09:00 |       300.0 | 340455.0 |
+---------------------------+-------------+----------+
Matched Content