Ubuntu 18.04
Sponsored Link

OpenStack Rocky : How to use Ceilometer (Nova Compute)
2018/09/18
 
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                       
+--------------------------------------+----------------------------+----------------------------------
| e402a282-c5ae-4532-ad08-0a2f0d7803ac | instance                   | 5f54b0ad76274f06b13f29458cc1c036 
| 79195be1-3b66-4601-8401-489f4d7b4ee5 | instance                   | 5f54b0ad76274f06b13f29458cc1c036 
| eb34c91e-e69b-5bc5-b01b-97a0ee76832d | instance_network_interface | 5f54b0ad76274f06b13f29458cc1c036 
| 9887d1b9-c33e-5346-bc51-712db41a50f6 | instance_disk              | 5f54b0ad76274f06b13f29458cc1c036 
+--------------------------------------+----------------------------+----------------------------------
+----------------------------------+-----------------------------------------------------------------------
| user_id                          | original_resource_id                                                  
+----------------------------------+-----------------------------------------------------------------------
| 54951d6863024516a19ed9bda53be12f | e402a282-c5ae-4532-ad08-0a2f0d7803ac                                  
| 54951d6863024516a19ed9bda53be12f | 79195be1-3b66-4601-8401-489f4d7b4ee5                                  
| 54951d6863024516a19ed9bda53be12f | instance-00000001-e402a282-c5ae-4532-ad08-0a2f0d7803ac-tapb94c455a-34 
| 54951d6863024516a19ed9bda53be12f | e402a282-c5ae-4532-ad08-0a2f0d7803ac-vda                              
+----------------------------------+-----------------------------------------------------------------------
+----------------------------------+----------------------------------+----------------------------------
| started_at                       | ended_at                         | revision_start                   
+----------------------------------+----------------------------------+----------------------------------
| 2018-09-18T07:44:55.870887+00:00 | None                             | 2018-09-18T07:44:55.870929+00:00 
| 2018-09-18T07:44:57.187616+00:00 | 2018-09-18T07:45:55.014038+00:00 | 2018-09-18T07:45:57.411715+00:00 
| 2018-09-18T07:46:56.663147+00:00 | None                             | 2018-09-18T07:46:56.663162+00:00 
| 2018-09-18T07:46:56.727867+00:00 | None                             | 2018-09-18T07:46:56.727881+00:00 
+----------------------------------+----------------------------------+----------------------------------
+--------------+-------------------------------------------------------------------+
| revision_end | creator                                                           |
+--------------+-------------------------------------------------------------------+
| None         | 1473e02cb8754787a0a9e47dd7d8e0ce:aaeee626080841a491235fb06e77f10c |
| None         | 1473e02cb8754787a0a9e47dd7d8e0ce:aaeee626080841a491235fb06e77f10c |
| None         | 1473e02cb8754787a0a9e47dd7d8e0ce:aaeee626080841a491235fb06e77f10c |
| None         | 1473e02cb8754787a0a9e47dd7d8e0ce:aaeee626080841a491235fb06e77f10c |
+--------------+-------------------------------------------------------------------+

# details of the instance resource instance

ubuntu@dlp ~(keystone)$
openstack metric resource show e402a282-c5ae-4532-ad08-0a2f0d7803ac

+-----------------------+-------------------------------------------------------------------+
| Field                 | Value                                                             |
+-----------------------+-------------------------------------------------------------------+
| created_by_project_id | aaeee626080841a491235fb06e77f10c                                  |
| created_by_user_id    | 1473e02cb8754787a0a9e47dd7d8e0ce                                  |
| creator               | 1473e02cb8754787a0a9e47dd7d8e0ce:aaeee626080841a491235fb06e77f10c |
| ended_at              | None                                                              |
| id                    | e402a282-c5ae-4532-ad08-0a2f0d7803ac                              |
| metrics               | cpu: e51f14bc-ed02-4e9b-9467-0880c13ff908                         |
|                       | disk.ephemeral.size: 34559b72-748f-40d1-ad72-7205421f971f         |
|                       | disk.root.size: 3dd7e30c-8d43-4be8-90da-f64032a719f1              |
|                       | memory.usage: ccb1b9d5-59c5-4d45-be0a-1961b927d43f                |
|                       | memory: e5c55402-7aa2-46e6-84de-851a21959b52                      |
|                       | vcpus: 1fcbc8fe-fe6a-424b-b6a2-e3ae86f2a583                       |
| original_resource_id  | e402a282-c5ae-4532-ad08-0a2f0d7803ac                              |
| project_id            | 5f54b0ad76274f06b13f29458cc1c036                                  |
| revision_end          | None                                                              |
| revision_start        | 2018-09-18T07:44:55.870929+00:00                                  |
| started_at            | 2018-09-18T07:44:55.870887+00:00                                  |
| type                  | instance                                                          |
| user_id               | 54951d6863024516a19ed9bda53be12f                                  |
+-----------------------+-------------------------------------------------------------------+

# CPU

ubuntu@dlp ~(keystone)$
openstack metric measures show e51f14bc-ed02-4e9b-9467-0880c13ff908

+---------------------------+-------------+---------------+
| timestamp                 | granularity |         value |
+---------------------------+-------------+---------------+
| 2018-09-18T16:45:00+09:00 |       300.0 | 42440000000.0 |
| 2018-09-18T16:50:00+09:00 |       300.0 |    1.3615e+11 |
+---------------------------+-------------+---------------+

# memory usage

ubuntu@dlp ~(keystone)$
openstack metric measures show ccb1b9d5-59c5-4d45-be0a-1961b927d43f

+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2018-09-18T16:45:00+09:00 |       300.0 | 265.0 |
| 2018-09-18T16:50:00+09:00 |       300.0 | 240.0 |
+---------------------------+-------------+-------+

# details of instance_network_interface

ubuntu@dlp ~(keystone)$
openstack metric resource show eb34c91e-e69b-5bc5-b01b-97a0ee76832d

+-----------------------+-----------------------------------------------------------------------+
| Field                 | Value                                                                 |
+-----------------------+-----------------------------------------------------------------------+
| created_by_project_id | aaeee626080841a491235fb06e77f10c                                      |
| created_by_user_id    | 1473e02cb8754787a0a9e47dd7d8e0ce                                      |
| creator               | 1473e02cb8754787a0a9e47dd7d8e0ce:aaeee626080841a491235fb06e77f10c     |
| ended_at              | None                                                                  |
| id                    | eb34c91e-e69b-5bc5-b01b-97a0ee76832d                                  |
| metrics               | network.incoming.bytes.rate: 41947848-ff7b-41cd-ac56-f2b55e915af5     |
|                       | network.incoming.bytes: b949d037-b57b-4967-903e-42bbd299c432          |
|                       | network.incoming.packets.rate: 2ee70704-1d33-49d2-8679-a9d112756da3   |
|                       | network.incoming.packets: 358538b4-707b-4d39-af4d-abdfc65465e5        |
|                       | network.outgoing.bytes.rate: 7bb976cc-28a9-42ca-be1c-4c86e76e35ba     |
|                       | network.outgoing.bytes: 51343949-535a-48fa-9e02-008585de9b37          |
|                       | network.outgoing.packets.rate: 82efb30e-42a0-4c96-9523-3158eae845e0   |
|                       | network.outgoing.packets: bd04bcbf-dd23-41fc-8d1b-9e7f29561001        |
| original_resource_id  | instance-00000001-e402a282-c5ae-4532-ad08-0a2f0d7803ac-tapb94c455a-34 |
| project_id            | 5f54b0ad76274f06b13f29458cc1c036                                      |
| revision_end          | None                                                                  |
| revision_start        | 2018-09-18T07:46:56.663162+00:00                                      |
| started_at            | 2018-09-18T07:46:56.663147+00:00                                      |
| type                  | instance_network_interface                                            |
| user_id               | 54951d6863024516a19ed9bda53be12f                                      |
+-----------------------+-----------------------------------------------------------------------+

# display network incoming bytes

ubuntu@dlp ~(keystone)$
openstack metric measures show b949d037-b57b-4967-903e-42bbd299c432

+---------------------------+-------------+-----------+
| timestamp                 | granularity |     value |
+---------------------------+-------------+-----------+
| 2018-09-18T16:45:00+09:00 |       300.0 | 2569424.0 |
| 2018-09-18T16:50:00+09:00 |       300.0 | 3680551.0 |
+---------------------------+-------------+-----------+

# display network outgoing bytes

ubuntu@dlp ~(keystone)$
openstack metric measures show 51343949-535a-48fa-9e02-008585de9b37

+---------------------------+-------------+----------+
| timestamp                 | granularity |    value |
+---------------------------+-------------+----------+
| 2018-09-18T16:45:00+09:00 |       300.0 |  67781.0 |
| 2018-09-18T16:50:00+09:00 |       300.0 | 163332.0 |
+---------------------------+-------------+----------+
Matched Content
 
Tweet