OpenStack Rocky : Aodh 利用方法2018/09/19 |
OpenStack Alarming Service (Aodh) の利用方法です。
当例では以下のような環境を例に Aodh サービスをインストールしています。
------------+---------------------------+---------------------------+------------ | | | 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 | | | | Aodh API,Evaluator | | Heat Engine | | | | | | Gnocchi httpd | | | | | | Ceilometer Central | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | アラームを利用したい任意のユーザーで認証し、アラームを作成します。 作業は、どこでもよいですが、当例ではコントロールノード上で行います。 例として、自身が所有するインスタンスの cpu_util が 70% を超えた場合にアラームとなるよう設定します。 |
ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+---------+------------------------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+---------+------------------------------------+------------+----------+ | e402a282-c5ae-4532-ad08-0a2f0d7803ac | Ubuntu_1804 | SHUTOFF | int_net=192.168.100.10, 10.0.0.214 | Ubuntu1804 | m1.small | +--------------------------------------+-------------+---------+------------------------------------+------------+----------+ubuntu@dlp ~(keystone)$ INSTANS_ID=$(openstack server list | grep Ubuntu_1804 | awk '{print $2}') ubuntu@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 | 45a5e5d1-d8e5-4689-b5a5-0496f1b210db | | 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 | 5f54b0ad76274f06b13f29458cc1c036 | | repeat_actions | False | | resource_id | e402a282-c5ae-4532-ad08-0a2f0d7803ac | | resource_type | instance | | severity | low | | state | insufficient data | | state_reason | Not evaluated yet | | state_timestamp | 2018-09-19T00:38:38.273473 | | threshold | 70.0 | | time_constraints | [] | | timestamp | 2018-09-19T00:38:38.273473 | | type | gnocchi_resources_threshold | | user_id | 54951d6863024516a19ed9bda53be12f | +---------------------------+--------------------------------------+ # 作成直後はデータが未評価のため [state] は [insufficient data] の状態 ubuntu@dlp ~(keystone)$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ | 45a5e5d1-d8e5-4689-b5a5-0496f1b210db | gnocchi_resources_threshold | cpu_hi | insufficient data | low | True | +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ # インスタンスでアラームを設定したカテゴリのデータが評価されると [ok] state となる ubuntu@dlp ~(keystone)$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | 45a5e5d1-d8e5-4689-b5a5-0496f1b210db | gnocchi_resources_threshold | cpu_hi | ok | low | True | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ # 対象のインスタンスを起動し CPU 負荷が設定したしきい値を超えると [alarm] となる ubuntu@dlp ~(keystone)$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | 45a5e5d1-d8e5-4689-b5a5-0496f1b210db | gnocchi_resources_threshold | cpu_hi | alarm | low | True | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ # CPU 負荷が設定したしきい値を下まわると再び [ok] state となる ubuntu@dlp ~(keystone)$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | 45a5e5d1-d8e5-4689-b5a5-0496f1b210db | gnocchi_resources_threshold | cpu_hi | ok | low | True | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ # 作成したアラームのヒストリーを表示する ubuntu@dlp ~(keystone)$ openstack alarm-history show 45a5e5d1-d8e5-4689-b5a5-0496f1b210db +----------------------------+------------------+------------------------------------------------------------------------------- | timestamp | type | detail +----------------------------+------------------+------------------------------------------------------------------------------- | 2018-09-19T00:52:46.042068 | state transition | {"transition_reason": "Transition to ok due to 1 samples inside threshold, ... | 2018-09-19T00:47:46.071054 | state transition | {"transition_reason": "Transition to alarm due to 1 samples outside thresho... | 2018-09-19T00:38:38.273473 | creation | {"state_reason": "Not evaluated yet", "user_id": "54951d6863024516a19ed9bda... +----------------------------+------------------+------------------------------------------------------------------------------- |
Sponsored Link |