OpenStack Epoxy : How to use Aodh2025/06/02 |
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 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ dlp.srv.world ] | | [ network.srv.world ] | | [ node01.srv.world ] | | (Control Node) | | (Network Node) | | (Compute Node) | | | | | | | | MariaDB RabbitMQ | | Open vSwitch | | Libvirt | | Memcached Nginx | | Neutron Server | | Nova Compute | | Keystone httpd | | OVN-Northd | | Open vSwitch | | Glance Nova API | | Nginx iSCSI Target | | OVN Metadata Agent | | Cinder API | | Cinder Volume | | OVN-Controller | | | | Gnocchi httpd | | Ceilometer Compute | | | | Ceilometer Central | | | | | | Aodh Services | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[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 | +--------------------------------------+----------+---------+------------------------------------+----------------+----------+ | ba6f1ab3-86c9-4966-b1e6-ceabe5353c07 | CentOS-9 | SHUTOFF | private=10.0.0.208, 192.168.100.57 | CentOS-Stream9 | m1.small | +--------------------------------------+----------+---------+------------------------------------+----------------+----------+ # for example, set an alarm to occur when the instance's CPU metric exceeds [100000000000.0 ns] [cent@dlp ~(keystone)]$ INSTANS_ID=$(openstack server list | grep CentOS-9 | awk '{print $2}')
[cent@dlp ~(keystone)]$ openstack alarm create \
--name cpu_hi \
--type gnocchi_resources_threshold \
--description 'CPU High' \
--metric cpu \
--threshold 100000000000.0 \
--comparison-operator gt \
--aggregation-method mean \
--granularity 300 \
--evaluation-periods 1 \
--resource-type instance \
--resource-id $INSTANS_ID
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| alarm_id | 76185c90-e01b-4f2d-88e1-9d720658efda |
| name | cpu_hi |
| description | CPU High |
| enabled | True |
| ok_actions | [] |
| alarm_actions | [] |
| insufficient_data_actions | [] |
| repeat_actions | False |
| type | gnocchi_resources_threshold |
| time_constraints | [] |
| project_id | 6cd379304e2447da8514a66bb6cdfda5 |
| user_id | b6e98dc2822541dd8c4571ac4ed54778 |
| timestamp | 2025-06-02T00:19:49.574278 |
| state | insufficient data |
| state_timestamp | 2025-06-02T00:19:49.574278 |
| state_reason | Not evaluated yet |
| severity | low |
| evaluate_timestamp | 2025-06-02T00:19:49.599346 |
| metric | cpu |
| resource_id | ba6f1ab3-86c9-4966-b1e6-ceabe5353c07 |
| resource_type | instance |
| comparison_operator | gt |
| threshold | 100000000000.0 |
| aggregation_method | mean |
| evaluation_periods | 1 |
| granularity | 300 |
+---------------------------+--------------------------------------+
# 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 | +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ | 76185c90-e01b-4f2d-88e1-9d720658efda | gnocchi_resources_threshold | cpu_hi | insufficient data | low | True | +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ # data of the target instance is evaluated and if it does not exceed the threshold, the state is [ok] [cent@dlp ~(keystone)]$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | 76185c90-e01b-4f2d-88e1-9d720658efda | gnocchi_resources_threshold | cpu_hi | ok | low | True | +--------------------------------------+-----------------------------+--------+-------+----------+---------+[cent@dlp ~(keystone)]$ openstack metric measures show $(openstack metric resource show $(openstack metric resource list | awk '{print $2,$4}' | grep -w 'instance' | awk '{print $1}') | grep 'cpu:' | awk '{print $5}') +---------------------------+-------------+---------------+ | timestamp | granularity | value | +---------------------------+-------------+---------------+ | 2025-06-02T09:15:00+09:00 | 300.0 | 21520000000.0 | | 2025-06-02T09:25:00+09:00 | 300.0 | 22280000000.0 | | 2025-06-02T09:30:00+09:00 | 300.0 | 23270000000.0 | +---------------------------+-------------+---------------+ # when the CPU metric of the target instance exceeds the set threshold, state turns to [alarm] [cent@dlp ~(keystone)]$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------+----------+---------+ | 76185c90-e01b-4f2d-88e1-9d720658efda | gnocchi_resources_threshold | cpu_hi | alarm | low | True | +--------------------------------------+-----------------------------+--------+-------+----------+---------+[cent@dlp ~(keystone)]$ openstack metric measures show $(openstack metric resource show $(openstack metric resource list | awk '{print $2,$4}' | grep -w 'instance' | awk '{print $1}') | grep 'cpu:' | awk '{print $5}') +---------------------------+-------------+----------------+ | timestamp | granularity | value | +---------------------------+-------------+----------------+ | 2025-06-02T09:15:00+09:00 | 300.0 | 21520000000.0 | | 2025-06-02T09:25:00+09:00 | 300.0 | 22280000000.0 | | 2025-06-02T09:30:00+09:00 | 300.0 | 23270000000.0 | | 2025-06-02T09:35:00+09:00 | 300.0 | 75700000000.0 | | 2025-06-02T09:40:00+09:00 | 300.0 | 261170000000.0 | +---------------------------+-------------+----------------+ # if the target instance is stopped, [state] is [insufficient data] [cent@dlp ~(keystone)]$ openstack alarm list +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ | alarm_id | type | name | state | severity | enabled | +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ | 76185c90-e01b-4f2d-88e1-9d720658efda | gnocchi_resources_threshold | cpu_hi | insufficient data | low | True | +--------------------------------------+-----------------------------+--------+-------------------+----------+---------+ # show histories of an alarm [cent@dlp ~(keystone)]$ openstack alarm-history show 04f4bf40-1caf-4b6c-a5f7-9aff0e3584fa +----------------------------+------------------+---------------------------------------------------------------------------------------- | timestamp | type | detail +----------------------------+------------------+---------------------------------------------------------------------------------------- | 2025-06-02T00:55:27.209797 | state transition | {"state": "insufficient data", "transition_reason": "No datapoint for granularity 30... | 2025-06-02T00:42:27.207622 | state transition | {"state": "alarm", "transition_reason": "Transition to alarm due to 1 samples outsid... | 2025-06-02T00:20:27.900749 | state transition | {"state": "ok", "transition_reason": "Transition to ok due to 1 samples inside thres... | 2025-06-02T00:19:49.574278 | creation | {"alarm_id": "76185c90-e01b-4f2d-88e1-9d720658efda", "type": "gnocchi_resources_thre... +----------------------------+------------------+---------------------------------------------------------------------------------------- |
Sponsored Link |
|