3.10.5. 알람 생성
aodh를 사용하여 임계값에 도달할 때 활성화되는 알람을 생성할 수 있습니다. 이 예에서 알람은 개별 인스턴스의 평균 CPU 사용률이 80%를 초과하면 로그 항목을 활성화하고 추가합니다. 모니터링 목적으로 특정 인스턴스의 ID(94619081-abf5-4f-81c7-9cedaa872403)를 분리하는 데 쿼리가 사용됩니다.
# aodh alarm create --type gnocchi_aggregation_by_resources_threshold --name cpu_usage_high --metric cpu_util --threshold 80 --aggregation-method sum --resource-type instance --query '{"=": {"id": "94619081-abf5-4f1f-81c7-9cedaa872403"}}' --alarm-action 'log://'
+---------------------------+-------------------------------------------------------+
| Field | Value |
+---------------------------+-------------------------------------------------------+
| aggregation_method | sum |
| alarm_actions | [u'log://'] |
| alarm_id | b794adc7-ed4f-4edb-ace4-88cbe4674a94 |
| comparison_operator | eq |
| description | gnocchi_aggregation_by_resources_threshold alarm rule |
| enabled | True |
| evaluation_periods | 1 |
| granularity | 60 |
| insufficient_data_actions | [] |
| metric | cpu_util |
| name | cpu_usage_high |
| ok_actions | [] |
| project_id | 13c52c41e0e543d9841a3e761f981c20 |
| query | {"=": {"id": "94619081-abf5-4f1f-81c7-9cedaa872403"}} |
| repeat_actions | False |
| resource_type | instance |
| severity | low |
| state | insufficient data |
| state_timestamp | 2016-12-09T05:18:53.326000 |
| threshold | 80.0 |
| time_constraints | [] |
| timestamp | 2016-12-09T05:18:53.326000 |
| type | gnocchi_aggregation_by_resources_threshold |
| user_id | 32d3f2c9a234423cb52fb69d3741dbbc |
+---------------------------+-------------------------------------------------------+
기존 임계값 알람을 편집하려면 aodh alarm update 명령을 사용합니다. 예를 들어 알람 임계값을 75%로 늘리려면 다음을 수행합니다.
# aodh alarm update --name cpu_usage_high --threshold 75