OpenStack Rocky : How to use Aodh2018/09/06 |
This is how to use OpenStack Alarming Service (Aodh).
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 ] | | [ 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] | Login as a user you'd like to set Alarm for your own Instances. For example, create an Alarm which alarms the cpu_util of an instance is over 70%. |
[cent@dlp ~(keystone)]$ openstack server list +--------------------------------------+----------+---------+-----------------------------------+---------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+----------+---------+-----------------------------------+---------+----------+ | 5b30f928-8834-4ab5-a5ce-760c48d4c9b7 | CentOS_7 | SHUTOFF | int_net=192.168.100.3, 10.0.0.220 | 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 | 20bd2539-933e-4dd7-950f-7bb14db0ea08 | | 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 | 3c9dc9d8d71149a7b835e1f5813d2eb8 | | repeat_actions | False | | resource_id | 5b30f928-8834-4ab5-a5ce-760c48d4c9b7 | | resource_type | instance | | severity | low | | state | insufficient data | | state_reason | Not evaluated yet | | state_timestamp | 2018-09-06T06:17:09.870004 | | threshold | 70.0 | | time_constraints | [] | | timestamp | 2018-09-06T06:17:09.870004 | | type | gnocchi_resources_threshold | | user_id | e2252ff04be3409e8e823a0a3a925cad | +---------------------------+--------------------------------------+ # after creating, [state] is [insufficient data] because meters are not evaluated yet [cent@dlp ~(keystone)]$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ | 20bd2539-933e-4dd7-950f-7bb14db0ea08 | gnocchi_resources_threshold | cpu_hi | insufficient data | low | True | +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ # if meters has been not evaluated, state turns to [ok] [cent@dlp ~(keystone)]$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | 20bd2539-933e-4dd7-950f-7bb14db0ea08 | gnocchi_resources_threshold | cpu_hi | ok | low | True | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ # if target instance is running and the cpu_util of it would be over 70%, state turns to [alarm] [cent@dlp ~(keystone)]$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | 20bd2539-933e-4dd7-950f-7bb14db0ea08 | gnocchi_resources_threshold | cpu_hi | alarm | low | True | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ # if cpu_util of instance would be under 70%, state would be back to [ok] state [cent@dlp ~(keystone)]$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | 20bd2539-933e-4dd7-950f-7bb14db0ea08 | gnocchi_resources_threshold | cpu_hi | ok | low | True | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ # show histories of an alarm [cent@dlp ~(keystone)]$ openstack alarm-history show 20bd2539-933e-4dd7-950f-7bb14db0ea08 +----------------------------+------------------+------------------------------------------------------------------------- | timestamp | type | detail +----------------------------+------------------+------------------------------------------------------------------------- | 2018-09-06T06:31:36.739713 | state transition | {"transition_reason": "Transition to ok due to 1 samples inside thres... | 2018-09-06T06:26:36.712221 | state transition | {"transition_reason": "Transition to alarm due to 1 samples outside t... | 2018-09-06T06:21:36.732624 | state transition | {"transition_reason": "Transition to ok due to 1 samples inside thres... | 2018-09-06T06:17:09.870004 | creation | {"state_reason": "Not evaluated yet", "user_id": "e2252ff04be3409e8e8... +----------------------------+------------------+------------------------------------------------------------------------- |
Sponsored Link |
|