Ubuntu 20.04
Sponsored Link

OpenStack Ussuri : How to use Ceilometer (Nova Compute)
2020/06/18
 
This is how to use OpenStack Telemetry Service (Ceilometer) for Nova Compute service.
This example is based on the environment 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 Ubuntu2004 --security-group secgroup01 --nic net-id=$Int_Net_ID --key-name mykey Ubuntu_200402

# list resources

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

+--------------------------------------+----------------------------+----------------------------------
| id                                   | type                       | project_id                       
+--------------------------------------+----------------------------+----------------------------------
| 2dde6728-0e9a-4bd1-b10a-196162ec5e2a | instance                   | eaa8de359ae0451d944a6401e688f730 
| f33a56c8-468d-5973-a515-a879a8ce8a64 | instance_disk              | eaa8de359ae0451d944a6401e688f730 
| 2b500dc3-e441-5ace-8600-15761d009452 | instance_network_interface | eaa8de359ae0451d944a6401e688f730 
+--------------------------------------+----------------------------+----------------------------------
+----------------------------------+-----------------------------------------------------------------------
| user_id                          | original_resource_id                                                  
+----------------------------------+-----------------------------------------------------------------------
| 2a1e722c971c45d384efe048155d89c7 | 2dde6728-0e9a-4bd1-b10a-196162ec5e2a                                  
| 2a1e722c971c45d384efe048155d89c7 | 2dde6728-0e9a-4bd1-b10a-196162ec5e2a-vda                              
| 2a1e722c971c45d384efe048155d89c7 | instance-00000003-2dde6728-0e9a-4bd1-b10a-196162ec5e2a-tapfe227716-40 
+----------------------------------+-----------------------------------------------------------------------
+----------------------------------+----------+----------------------------------+--------------
| started_at                       | ended_at | revision_start                   | revision_end 
+----------------------------------+----------+----------------------------------+--------------
| 2020-06-18T04:59:41.829485+00:00 | None     | 2020-06-18T04:59:41.829492+00:00 | None         
| 2020-06-18T05:01:46.301727+00:00 | None     | 2020-06-18T05:01:46.301735+00:00 | None         
| 2020-06-18T05:01:46.335571+00:00 | None     | 2020-06-18T05:01:46.335577+00:00 | None         
+----------------------------------+----------+----------------------------------+--------------
+-------------------------------------------------------------------+
| creator                                                           |
+-------------------------------------------------------------------+
| 3d1f14e0843940dfb5afaeee1ec45507:c0e098a54a4640caa9004fb8f500f554 |
| 3d1f14e0843940dfb5afaeee1ec45507:c0e098a54a4640caa9004fb8f500f554 |
| 3d1f14e0843940dfb5afaeee1ec45507:c0e098a54a4640caa9004fb8f500f554 |
+-------------------------------------------------------------------+

# details of the instance resource [instance]

ubuntu@dlp ~(keystone)$
openstack metric resource show 2dde6728-0e9a-4bd1-b10a-196162ec5e2a

+-----------------------+-------------------------------------------------------------------+
| Field                 | Value                                                             |
+-----------------------+-------------------------------------------------------------------+
| created_by_project_id | c0e098a54a4640caa9004fb8f500f554                                  |
| created_by_user_id    | 3d1f14e0843940dfb5afaeee1ec45507                                  |
| creator               | 3d1f14e0843940dfb5afaeee1ec45507:c0e098a54a4640caa9004fb8f500f554 |
| ended_at              | None                                                              |
| id                    | 2dde6728-0e9a-4bd1-b10a-196162ec5e2a                              |
| metrics               | cpu: 5d8884b8-5532-475a-896c-98948cff0826                         |
|                       | disk.ephemeral.size: fc55714c-eb6d-44e4-9b4a-19e9e12f5ba4         |
|                       | disk.root.size: dc7df07e-7f63-4f6a-82f5-38dae1bdb34e              |
|                       | memory.usage: df5423a7-301c-4c6e-ba8a-2660cbaa10d4                |
|                       | memory: d167b344-357d-4a9b-a474-9a513743b9e3                      |
|                       | vcpus: 4834358b-78d7-41c3-874c-3f3e9aa70e51                       |
| original_resource_id  | 2dde6728-0e9a-4bd1-b10a-196162ec5e2a                              |
| project_id            | eaa8de359ae0451d944a6401e688f730                                  |
| revision_end          | None                                                              |
| revision_start        | 2020-06-18T04:59:41.829492+00:00                                  |
| started_at            | 2020-06-18T04:59:41.829485+00:00                                  |
| type                  | instance                                                          |
| user_id               | 2a1e722c971c45d384efe048155d89c7                                  |
+-----------------------+-------------------------------------------------------------------+

# CPU

ubuntu@dlp ~(keystone)$
openstack metric measures show 5d8884b8-5532-475a-896c-98948cff0826

+---------------------------+-------------+---------------+
| timestamp                 | granularity |         value |
+---------------------------+-------------+---------------+
| 2020-06-18T14:00:00+09:00 |       300.0 | 85740000000.0 |
+---------------------------+-------------+---------------+

# memory usage

ubuntu@dlp ~(keystone)$
openstack metric measures show df5423a7-301c-4c6e-ba8a-2660cbaa10d4

+---------------------------+-------------+--------------+
| timestamp                 | granularity |        value |
+---------------------------+-------------+--------------+
| 2020-06-18T14:00:00+09:00 |       300.0 | 258.44140625 |
+---------------------------+-------------+--------------+

# details of [instance_network_interface]

ubuntu@dlp ~(keystone)$
openstack metric resource show 2b500dc3-e441-5ace-8600-15761d009452

+-----------------------+-----------------------------------------------------------------------+
| Field                 | Value                                                                 |
+-----------------------+-----------------------------------------------------------------------+
| created_by_project_id | c0e098a54a4640caa9004fb8f500f554                                      |
| created_by_user_id    | 3d1f14e0843940dfb5afaeee1ec45507                                      |
| creator               | 3d1f14e0843940dfb5afaeee1ec45507:c0e098a54a4640caa9004fb8f500f554     |
| ended_at              | None                                                                  |
| id                    | 2b500dc3-e441-5ace-8600-15761d009452                                  |
| metrics               | network.incoming.bytes: c3cb85f6-86f9-4068-bd49-ae457a5483c1          |
|                       | network.incoming.packets: 8af6b757-01ae-4e37-a56d-7f261925c21b        |
|                       | network.outgoing.bytes: 22b6ecb4-d58f-4226-999d-365ab0ad7a4f          |
|                       | network.outgoing.packets: 67ea1a4d-fc09-4eaf-90d8-88f88cc8450d        |
| original_resource_id  | instance-00000003-2dde6728-0e9a-4bd1-b10a-196162ec5e2a-tapfe227716-40 |
| project_id            | eaa8de359ae0451d944a6401e688f730                                      |
| revision_end          | None                                                                  |
| revision_start        | 2020-06-18T05:01:46.335577+00:00                                      |
| started_at            | 2020-06-18T05:01:46.335571+00:00                                      |
| type                  | instance_network_interface                                            |
| user_id               | 2a1e722c971c45d384efe048155d89c7                                      |
+-----------------------+-----------------------------------------------------------------------+

# display network incoming bytes

ubuntu@dlp ~(keystone)$
openstack metric measures show c3cb85f6-86f9-4068-bd49-ae457a5483c1

+---------------------------+-------------+-----------+
| timestamp                 | granularity |     value |
+---------------------------+-------------+-----------+
| 2020-06-18T14:00:00+09:00 |       300.0 | 1040490.0 |
+---------------------------+-------------+-----------+

# display network outgoing bytes

ubuntu@dlp ~(keystone)$
openstack metric measures show 22b6ecb4-d58f-4226-999d-365ab0ad7a4f

+---------------------------+-------------+---------+
| timestamp                 | granularity |   value |
+---------------------------+-------------+---------+
| 2020-06-18T14:00:00+09:00 |       300.0 | 73811.0 |
+---------------------------+-------------+---------+
Matched Content