CentOS 7
Sponsored Link

OpenStack Queens : Aodh 利用方法2018/03/17

 
OpenStack Alarming Service (Aodh) の利用方法です。
当例では以下のような環境を例に Aodh サービスをインストールしています。
------------+---------------------------+---------------------------+------------
            |                           |                           |
        eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
+-----------+-----------+   +-----------+-----------+   +-----------+-----------+
|    [ Control Node ]   |   |    [ Storage Node ]   |   |    [ Compute Node ]   |
|                       |   |                       |   |                       |
|  MariaDB    RabbitMQ  |   |      Open_vSwitch     |   |        Libvirt        |
|  Memcached  httpd     |   |        L2_Agent       |   |     Nova_Compute      |
|  Keystone   Glance    |   |        L3_Agent       |   |      Open_vSwitch     |
|  Nova_API  Cinder_API |   |     Metadata_Agent    |   |        L2_Agent       |
|  Neutron_Server       |   |     Cinder_Volume     |   |  Ceilometer_Compute   |
|  Metadata_Agent       |   |        Heat_API       |   |                       |
|  Gnocchi              |   |      Heat Engine      |   |                       |
|  Ceilometer_Central   |   |                       |   |                       |
|  Aodh_Evaluator       |   |                       |   |                       |
+-----------------------+   +-----------------------+   +-----------------------+

[1] アラームを利用したい任意のユーザーで認証し、アラームを作成します。
作業は、どこでもよいですが、当例ではコントロールノード上で行います。
例として、自身が所有するインスタンスの cpu_util が 70% を超えた場合にアラームとなるよう設定します。
[cent@dlp ~(keystone)]$
openstack server list

+-----------+----------+---------+-----------------------------------+---------+----------+
| ID        | Name     | Status  | Networks                          | Image   | Flavor   |
+-----------+----------+---------+-----------------------------------+---------+----------+
| 636608e8- | CentOS_7 | SHUTOFF | int_net=192.168.100.7, 10.0.0.202 | CentOS7 | m1.small |
+-----------+----------+---------+-----------------------------------+---------+----------+

[cent@dlp ~(keystone)]$
INSTANS_ID=$(openstack server list | grep CentOS_7 | awk '{print $2}')

[cent@dlp ~(keystone)]$
openstack alarm create \
--name cpu_hi \
--type gnocchi_resources_threshold \
--description 'CPU High Average' \
--metric cpu_util \
--threshold 70.0 \
--comparison-operator gt \
--aggregation-method mean \
--granularity 300 \
--evaluation-periods 1 \
--resource-type instance \
--resource-id $INSTANS_ID
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| aggregation_method        | mean                                 |
| alarm_actions             | []                                   |
| alarm_id                  | 04f4bf40-1caf-4b6c-a5f7-9aff0e3584fa |
| comparison_operator       | gt                                   |
| description               | CPU High Average                     |
| enabled                   | True                                 |
| evaluation_periods        | 1                                    |
| granularity               | 300                                  |
| insufficient_data_actions | []                                   |
| metric                    | cpu_util                             |
| name                      | cpu_hi                               |
| ok_actions                | []                                   |
| project_id                | 52e02649325e4cf1b903d00cadb8fad2     |
| repeat_actions            | False                                |
| resource_id               | 636608e8-381f-4adc-84c9-35d6f5eabe60 |
| resource_type             | instance                             |
| severity                  | low                                  |
| state                     | insufficient data                    |
| state_reason              | Not evaluated yet                    |
| state_timestamp           | 2018-03-19T06:25:37.972478           |
| threshold                 | 70.0                                 |
| time_constraints          | []                                   |
| timestamp                 | 2018-03-19T06:25:37.972478           |
| type                      | gnocchi_resources_threshold          |
| user_id                   | 3fc6c62eb5aa440aaa1eaf745faa35d6     |
+---------------------------+--------------------------------------+

# 作成直後はデータが未評価のため [state] は [insufficient data] の状態

[cent@dlp ~(keystone)]$
openstack alarm list

+--------------+-----------------------------+--------+-------------------+----------+---------+
| alarm_id     | type                        | name   | state             | severity | enabled |
+--------------+-----------------------------+--------+-------------------+----------+---------+
| 04f4bf40-... | gnocchi_resources_threshold | cpu_hi | insufficient data | low      | True    |
+--------------+-----------------------------+--------+-------------------+----------+---------+

# データが評価されると [ok] state となる

[cent@dlp ~(keystone)]$
openstack alarm list

+--------------------------------------+-----------------------------+--------+-------+----------+---------+
| alarm_id                             | type                        | name   | state | severity | enabled |
+--------------------------------------+-----------------------------+--------+-------+----------+---------+
| 04f4bf40-1caf-4b6c-a5f7-9aff0e3584fa | gnocchi_resources_threshold | cpu_hi | ok    | low      | True    |
+--------------------------------------+-----------------------------+--------+-------+----------+---------+

# 対象のインスタンスを起動し CPU 負荷が設定したしきい値を超えると [alarm] となる

[cent@dlp ~(keystone)]$
openstack alarm list

+--------------------------------------+-----------------------------+--------+-------+----------+---------+
| alarm_id                             | type                        | name   | state | severity | enabled |
+--------------------------------------+-----------------------------+--------+-------+----------+---------+
| 04f4bf40-1caf-4b6c-a5f7-9aff0e3584fa | gnocchi_resources_threshold | cpu_hi | alarm | low      | True    |
+--------------------------------------+-----------------------------+--------+-------+----------+---------+

# CPU 負荷が設定したしきい値を下まわると再び [ok] state となる

[cent@dlp ~(keystone)]$
openstack alarm list

+--------------------------------------+-----------------------------+--------+-------+----------+---------+
| alarm_id                             | type                        | name   | state | severity | enabled |
+--------------------------------------+-----------------------------+--------+-------+----------+---------+
| 04f4bf40-1caf-4b6c-a5f7-9aff0e3584fa | gnocchi_resources_threshold | cpu_hi | ok    | low      | True    |
+--------------------------------------+-----------------------------+--------+-------+----------+---------+

# 作成したアラームのヒストリーを表示する

[cent@dlp ~(keystone)]$
openstack alarm-history show 04f4bf40-1caf-4b6c-a5f7-9aff0e3584fa

+----------------------------+------------------+--------------------------------------------------------
| timestamp                  | type             | detail                                                 
+----------------------------+------------------+--------------------------------------------------------
| 2018-03-19T06:38:45.332362 | state transition | {"transition_reason": "Transition to ok due to 1 sam...
| 2018-03-19T06:33:33.197786 | state transition | {"transition_reason": "Transition to alarm due to 1 ...
| 2018-03-19T06:25:37.972478 | creation         | {"state_reason": "Not evaluated yet", "user_id": "3f...
+----------------------------+------------------+--------------------------------------------------------
関連コンテンツ