Ubuntu 16.04
Sponsored Link

OpenStack Newton : Ceilometer 利用方法2016/12/22

 
OpenStack Metering Service(Ceilometer)の利用方法です。
ここでは例として以下のような環境を構築しています。
                                |
+------------------+            |            +------------------------+
| [ Control Node ] |            |            |    [ Network Node ]    |
|     Keystone     |10.0.0.30   |   10.0.0.50|    DHCP,L3,L2 Agent    |
|      Glance      |------------+------------|     Metadata Agent     |
|     Nova API     |eth0        |        eth0|   Ceilometer Services  |
|  Neutron Server  |            |            |                        |
+------------------+            |            +------------------------+
                            eth0|10.0.0.51
                      +--------------------+
                      |  [ Compute Node ]  |
                      |    Nova Compute    |
                      |      L2 Agent      |
                      | Ceilometer-Compute |
                      +--------------------+

[1] Ceilometer の設定#1, Ceilometer の設定#2, Ceilometer の設定#3 の各ノードの設定が完了した状態で以下のコマンドを入力すると、設定に問題なければ以下のように結果が返ってきます。(データは未取得の状態)
root@dlp ~(keystone)#
ceilometer meter-list

+------+------+------+-------------+---------+------------+
| Name | Type | Unit | Resource ID | User ID | Project ID |
+------+------+------+-------------+---------+------------+
+------+------+------+-------------+---------+------------+
[2] Compute Service(Nova)の監視を有効にするには以下のように設定します。
# Compute Service 稼働ノードで設定

root@node01:~#
vi /etc/nova/nova.conf
# [DEFAULT] セクション内に追記

instance_usage_audit = True
instance_usage_audit_period = hour
notify_on_state_change = vm_and_task_state
# 最終行に追記

[oslo_messaging_notifications]
driver = messagingv2
root@node01:~#
systemctl restart nova-compute
# 以上の設定でインスタンス作成等をするとデータが取得される

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+------+-------------------------+-------------------------+---------------------------+
| Name                | Type  | Unit | Resource ID             | User ID                 | Project ID                |
+---------------------+-------+------+-------------------------+-------------------------+---------------------------+
| disk.ephemeral.size | gauge | GB   | 94afe31b-659b-4f61-.... | b48cbdf1975f4fd3987.... | 1b8227c2c89e4f1cbcbbb.... |
| disk.root.size      | gauge | GB   | 94afe31b-659b-4f61-.... | b48cbdf1975f4fd3987.... | 1b8227c2c89e4f1cbcbbb.... |
| memory              | gauge | MB   | 94afe31b-659b-4f61-.... | b48cbdf1975f4fd3987.... | 1b8227c2c89e4f1cbcbbb.... |
| vcpus               | gauge | vcpu | 94afe31b-659b-4f61-.... | b48cbdf1975f4fd3987.... | 1b8227c2c89e4f1cbcbbb.... |
+---------------------+-------+------+-------------------------+-------------------------+---------------------------+
[3] Image Service(Glance)の監視を有効にするには以下のように設定します。
# Image Service 稼働ノードで設定

root@dlp ~(keystone)#
vi /etc/glance/glance-api.conf
# [DEFAULT] セクションの中へ追記

rpc_backend = rabbit
# 最終行に追記

[oslo_messaging_notifications]
driver = messagingv2

[oslo_messaging_rabbit]
rabbit_host = 10.0.0.30
rabbit_port = 5672
rabbit_userid = openstack
rabbit_password = password 

root@dlp ~(keystone)#
vi /etc/glance/glance-registry.conf
# [DEFAULT] セクションの中へ追記

rpc_backend = rabbit
# 最終行に追記

[oslo_messaging_notifications]
driver = messagingv2

[oslo_messaging_rabbit]
rabbit_host = 10.0.0.30
rabbit_port = 5672
rabbit_userid = openstack
rabbit_password = password 

root@dlp ~(keystone)#
systemctl restart glance-api glance-registry

# 監視が有効になっているか確認

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| Name                | Type  | Unit     | Resource ID                  | User ID                          | Project ID     |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| disk.ephemeral.size | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| disk.root.size      | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| image               | gauge | image    | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| instance            | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| ip.floating         | gauge | ip       | fe1782ca-7e4e-4dee-873a-7... | None                             | c615465cefc... |
| memory              | gauge | MB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| vcpus               | gauge | vcpu     | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+

# 試しにイメージを追加

root@dlp ~(keystone)#
glance image-create --name "Ubuntu1604_1" --file /var/kvm/images/ubuntu1604.img --disk-format qcow2 --container-format bare --visibility public

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| disk.ephemeral.size | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| disk.root.size      | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| image               | gauge | image    | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | e6e04a4d-f13f-419a-8d99-0... | None                             | c615465cefc... |
| instance            | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| ip.floating         | gauge | ip       | fe1782ca-7e4e-4dee-873a-7... | None                             | c615465cefc... |
| memory              | gauge | MB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| vcpus               | gauge | vcpu     | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
# データが取得された

[4] Block Storage(Cinder)の監視を有効にするには以下のように設定します。
# Control Node, Network Node で設定変更

root@dlp ~(keystone)#
vi /etc/cinder/cinder.conf
# 最終行に追記

[oslo_messaging_notifications]
driver = messagingv2

# Control Node

root@dlp ~(keystone)#
systemctl restart cinder-api cinder-scheduler

# Network Node

root@network:~#
systemctl restart cinder-volume

# 以上の設定でボリューム作成等をするとデータが取得される

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| disk.ephemeral.size | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| disk.root.size      | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| image               | gauge | image    | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | e6e04a4d-f13f-419a-8d99-0... | None                             | c615465cefc... |
| instance            | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| ip.floating         | gauge | ip       | fe1782ca-7e4e-4dee-873a-7... | None                             | c615465cefc... |
| memory              | gauge | MB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| vcpus               | gauge | vcpu     | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
# ボリューム作成

root@dlp ~(keystone)#
openstack volume create --size 2 disk02

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| Name                | Type  | Unit     | Resource ID                  | User ID                          | Project ID     |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| disk.ephemeral.size | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| disk.root.size      | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| image               | gauge | image    | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image               | gauge | image    | e6e04a4d-f13f-419a-8d99-0... | None                             | c615465cefc... |
| image.size          | gauge | B        | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | e6e04a4d-f13f-419a-8d99-0... | None                             | c615465cefc... |
| instance            | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| ip.floating         | gauge | ip       | fe1782ca-7e4e-4dee-873a-7... | None                             | c615465cefc... |
| memory              | gauge | MB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| vcpus               | gauge | vcpu     | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| volume.size         | gauge | GB       | f1a0e500-33a7-4afb-afec-1... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
関連コンテンツ