|
|
八、添加告警规则
$ C/ m" Q0 Q/ v: h# [" J参考:- p' g; F! \9 N! i) O5 F
https://docs.openstack.org/aodh/ ... lemetry-alarms.html
& n0 E; @+ f. y( ]* t8.1 添加instance类型资源利用率告警/ \+ {$ l* G( ~* C
0 C6 Q/ W& N, O8 o! I/ Z
root@controller-01:~# aodh alarm create --name cpu_hi --type gnocchi_resources_threshold --description 'instance running hot' --metric cpu_util --threshold 1.0 --comparison-operator gt --aggregation-method mean --granularity 60 --evaluation-periods 3 --alarm-action 'log://' --resource-id 6583b3b0-96fd-45fa-bd75-fa7b0ae389e3 --resource-type instance' X+ Q; X: ]) L; q3 _& }
' Z) \5 c$ H8 c& C1 c! S1 [9 E& Y
- V& J6 V6 R* a
root@controller-01:~# aodh alarm list: ]! g; F, L. T2 M
+--------------------------------------+-----------------------------+--------+-------+----------+---------+& L8 E- ~+ E$ o) n6 J* A7 n9 Y
| alarm_id | type | name | state | severity | enabled |$ ~2 A; ]+ Z5 c" g+ M+ L [
+--------------------------------------+-----------------------------+--------+-------+----------+---------+5 K9 W: k$ x: @9 l) Y% z" O
| c5fd0a6e-b389-414e-826c-e830c9448261 | gnocchi_resources_threshold | cpu_hi | ok | low | True |
1 K( L1 Z0 x) y+--------------------------------------+-----------------------------+--------+-------+----------+---------+
/ _; m* S: N8 ?; r+ vTIPs:insufficient表示尚未通过该告警规则的苹果周期,无法判定是否告警。; X$ \' {0 Q7 T0 \/ r. k* c
% z4 @) S% |2 z2 E. s% ^
8.2 更新alarm的告警阈值为75%
7 k G1 U1 \9 Z( o. o$ h0 A; Z! Z: [ q. [! @
root@controller-01:~# aodh alarm update 566ef2f3-3302-4244-8b11-e49888fa732f --threshold 754 }& G+ @" F/ w5 i& C1 s6 g1 g' S
8.3 设定alarm告警规则状态: T0 q3 P3 @ \$ I. J* D( K
* p) ?0 F7 s8 h6 z9 Froot@controller-01:~# aodh alarm state get 566ef2f3-3302-4244-8b11-e49888fa732f7 f0 Y! W* k6 G3 J; k8 r
+-------+-------------------+9 s8 V4 ]% J% z' a7 E
| Field | Value |( k: f" t: b4 v+ a1 H# x( C
+-------+-------------------+: m. c4 U: k ~4 J
| state | ok |0 B' C7 Z5 @! A7 a7 o6 g
+-------+-------------------+8 L+ o; X7 y) A- x! [
8.4 查看alarm告警规则告警历史
; o8 I4 X' Z) a6 `, T/ r
) \) b- v7 j( T, r# J& v" ~7 laodh alarm-history show c5fd0a6e-b389-414e-826c-e830c9448261
2 a" o& I* `# D# y+----------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+
) g# L) d4 i* V" S [| timestamp | type | detail | event_id |8 I: P6 F! ^+ H. T5 k
+----------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+( T$ M2 W+ k; y `
| 2021-03-22T10:04:34.355141 | state transition | {"transition_reason": "aggregation mean does not exist for metric cpu of resource f4bf417d-c2cc-4e8f-be65-f2e4e4f13d11", "state": "insufficient data"} | 412bc50f-342e-4b14-beda-0bf62b27cf53 |! \2 C) }$ f# w* U$ n2 u6 ~; _! O
| 2021-03-22T10:03:40.313080 | state transition | {"state": "ok", "state_reason": "Manually set via API"} | ae4d7b6d-9e15-42df-96a0-5e3833b09bf1 |
( v+ E3 N- b! P* h. G| 2021-03-22T09:51:51.297369 | creation | {"state_reason": "Not evaluated yet", "user_id": "1d51703e805548d99cb35b0c3fb83a58", "name": "cpu_hi", "state": "insufficient data", "timestamp": "2021-03-22T09:51:51.297369", "description": "instance running hot", "enabled": true, "state_timestamp": "2021-03-22T09:51:51.297369", "rule": {"evaluation_periods": 3, "metric": "cpu", "resource_id": "f4bf417d-c2cc-4e8f-be65-f2e4e4f13d11", "aggregation_method": "mean", "granularity": 10, "threshold": 1.0, "comparison_operator": "gt", "resource_type": "instance"}, "alarm_id": "c5fd0a6e-b389-414e-826c-e830c9448261", "time_constraints": [], "insufficient_data_actions": [], "repeat_actions": false, "ok_actions": [], "project_id": "15b1010426194e309cd8f3de6bf63e1a", "type": "gnocchi_resources_threshold", "alarm_actions": ["log://"], "severity": "low"} | 8afa9dd9-8e9c-42fe-a867-d3e87c91e4fa |
5 X9 f% o2 i/ K: l& J1 N- W f+----------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+3 [% `# `! {7 K% e( @9 ~
+----------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+
. M& i2 l* q$ Y( `
0 h8 H+ ~0 L c) ^+ l
% F z; T( v/ i& L |
|