Ubuntu 18.04
Sponsored Link

OpenStack Stein : How to use Ceilometer (Nova Compute)
2019/04/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_180402

# list resources

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

+--------------------------------------+----------------------------+----------------------------------
| id                                   | type                       | project_id                       
+--------------------------------------+----------------------------+----------------------------------
| c714d070-f035-42b8-9660-999088da37b1 | instance                   | ff03eefa265b423aa3375acb46a8e4e0 
| f92025e7-33b7-4a63-bc25-8b7d206773d9 | instance                   | ff03eefa265b423aa3375acb46a8e4e0 
| 933faac4-688a-55a5-8f62-927898cc9297 | instance_network_interface | ff03eefa265b423aa3375acb46a8e4e0 
| 26de0c76-9999-5e9b-b3e3-758a1af1b5e3 | instance_disk              | ff03eefa265b423aa3375acb46a8e4e0 
+--------------------------------------+----------------------------+----------------------------------
+----------------------------------+-----------------------------------------------------------------------
| user_id                          | original_resource_id                                                  
+----------------------------------+-----------------------------------------------------------------------
| 5ed13a6b898b412383faf11ab2099a66 | c714d070-f035-42b8-9660-999088da37b1                                  
| 5ed13a6b898b412383faf11ab2099a66 | f92025e7-33b7-4a63-bc25-8b7d206773d9                                  
| 5ed13a6b898b412383faf11ab2099a66 | instance-0000000d-f92025e7-33b7-4a63-bc25-8b7d206773d9-tap6051d5e5-e9 
| 5ed13a6b898b412383faf11ab2099a66 | f92025e7-33b7-4a63-bc25-8b7d206773d9-vda                              
+----------------------------------+-----------------------------------------------------------------------
+----------------------------------+----------+----------------------------------+--------------+-------------------------------------------------------------------+
| started_at                       | ended_at | revision_start                   | revision_end | creator                                                           |
+----------------------------------+----------+----------------------------------+--------------+-------------------------------------------------------------------+
| 2019-04-18T03:37:43.313087+00:00 | None     | 2019-04-18T03:37:43.313112+00:00 | None         | ad726bcc13b9436d8fecb2336e9a5dae:efc5c6a05d444cae80c0a80f49ba87d4 |
| 2019-04-18T03:37:50.741212+00:00 | None     | 2019-04-18T03:37:50.741232+00:00 | None         | ad726bcc13b9436d8fecb2336e9a5dae:efc5c6a05d444cae80c0a80f49ba87d4 |
| 2019-04-18T03:39:25.624128+00:00 | None     | 2019-04-18T03:39:25.624151+00:00 | None         | ad726bcc13b9436d8fecb2336e9a5dae:efc5c6a05d444cae80c0a80f49ba87d4 |
| 2019-04-18T03:39:25.721172+00:00 | None     | 2019-04-18T03:39:25.721193+00:00 | None         | ad726bcc13b9436d8fecb2336e9a5dae:efc5c6a05d444cae80c0a80f49ba87d4 |
+----------------------------------+----------+----------------------------------+--------------+-------------------------------------------------------------------+

# details of the instance resource instance

ubuntu@dlp ~(keystone)$
openstack metric resource show f92025e7-33b7-4a63-bc25-8b7d206773d9

+-----------------------+---------------------------------------------------------------------+
| Field                 | Value                                                               |
+-----------------------+---------------------------------------------------------------------+
| created_by_project_id | efc5c6a05d444cae80c0a80f49ba87d4                                    |
| created_by_user_id    | ad726bcc13b9436d8fecb2336e9a5dae                                    |
| creator               | ad726bcc13b9436d8fecb2336e9a5dae:efc5c6a05d444cae80c0a80f49ba87d4   |
| ended_at              | None                                                                |
| id                    | f92025e7-33b7-4a63-bc25-8b7d206773d9                                |
| metrics               | compute.instance.booting.time: c46d75c0-8e16-4b07-a029-2334ba2dc12c |
|                       | cpu: b0ab00b4-a0f4-4cc1-a951-e7fbafea17b3                           |
|                       | disk.ephemeral.size: cdc76fa7-f905-4cb2-a107-ee820897dcc2           |
|                       | disk.root.size: 0789580e-59fd-44b1-8f8b-755039434d98                |
|                       | memory.usage: 62a5ec7f-c662-482a-8754-2aa2d934cc09                  |
|                       | memory: 5c284fdb-7205-407a-bff4-68937ab1b110                        |
|                       | vcpus: 149dbf36-6e97-4573-a26c-a0571c5a90b4                         |
| original_resource_id  | f92025e7-33b7-4a63-bc25-8b7d206773d9                                |
| project_id            | ff03eefa265b423aa3375acb46a8e4e0                                    |
| revision_end          | None                                                                |
| revision_start        | 2019-04-18T03:37:50.741232+00:00                                    |
| started_at            | 2019-04-18T03:37:50.741212+00:00                                    |
| type                  | instance                                                            |
| user_id               | 5ed13a6b898b412383faf11ab2099a66                                    |
+-----------------------+---------------------------------------------------------------------+

# CPU

ubuntu@dlp ~(keystone)$
openstack metric measures show b0ab00b4-a0f4-4cc1-a951-e7fbafea17b3

+---------------------------+-------------+---------------+
| timestamp                 | granularity |         value |
+---------------------------+-------------+---------------+
| 2019-04-18T12:35:00+09:00 |       300.0 | 40330000000.0 |
+---------------------------+-------------+---------------+

# memory usage

ubuntu@dlp ~(keystone)$
openstack metric measures show 62a5ec7f-c662-482a-8754-2aa2d934cc09

+---------------------------+-------------+-------------+
| timestamp                 | granularity |       value |
+---------------------------+-------------+-------------+
| 2019-04-18T12:35:00+09:00 |       300.0 | 218.2421875 |
+---------------------------+-------------+-------------+

# details of instance_network_interface

ubuntu@dlp ~(keystone)$
openstack metric resource show 933faac4-688a-55a5-8f62-927898cc9297

+-----------------------+-----------------------------------------------------------------------+
| Field                 | Value                                                                 |
+-----------------------+-----------------------------------------------------------------------+
| created_by_project_id | efc5c6a05d444cae80c0a80f49ba87d4                                      |
| created_by_user_id    | ad726bcc13b9436d8fecb2336e9a5dae                                      |
| creator               | ad726bcc13b9436d8fecb2336e9a5dae:efc5c6a05d444cae80c0a80f49ba87d4     |
| ended_at              | None                                                                  |
| id                    | 933faac4-688a-55a5-8f62-927898cc9297                                  |
| metrics               | network.incoming.bytes: e8f96459-57b3-4867-8a8a-6798cbc596fa          |
|                       | network.incoming.packets: 9ae82af8-5edc-461c-9d17-1376ff5c0b57        |
|                       | network.outgoing.bytes: 3cbf96b9-98ad-4681-bceb-86a3de609d0a          |
|                       | network.outgoing.packets: f53eaeab-4d75-446d-925c-61e9468e0124        |
| original_resource_id  | instance-0000000d-f92025e7-33b7-4a63-bc25-8b7d206773d9-tap6051d5e5-e9 |
| project_id            | ff03eefa265b423aa3375acb46a8e4e0                                      |
| revision_end          | None                                                                  |
| revision_start        | 2019-04-18T03:39:25.624151+00:00                                      |
| started_at            | 2019-04-18T03:39:25.624128+00:00                                      |
| type                  | instance_network_interface                                            |
| user_id               | 5ed13a6b898b412383faf11ab2099a66                                      |
+-----------------------+-----------------------------------------------------------------------+

# display network incoming bytes

ubuntu@dlp ~(keystone)$
openstack metric measures show e8f96459-57b3-4867-8a8a-6798cbc596fa

+---------------------------+-------------+------------+
| timestamp                 | granularity |      value |
+---------------------------+-------------+------------+
| 2019-04-18T12:35:00+09:00 |       300.0 | 31260437.0 |
| 2019-04-18T12:40:00+09:00 |       300.0 | 52934653.0 |
+---------------------------+-------------+------------+

# display network outgoing bytes

ubuntu@dlp ~(keystone)$
openstack metric measures show 3cbf96b9-98ad-4681-bceb-86a3de609d0a

+---------------------------+-------------+----------+
| timestamp                 | granularity |    value |
+---------------------------+-------------+----------+
| 2019-04-18T12:35:00+09:00 |       300.0 | 275598.0 |
| 2019-04-18T12:40:00+09:00 |       300.0 | 459171.0 |
+---------------------------+-------------+----------+
Matched Content