|
|
八、添加告警规则; n1 Z/ j, y- U! ~, f8 U7 A6 u
参考:
* x g; L! C: e: u* e9 T" Rhttps://docs.openstack.org/aodh/ ... lemetry-alarms.html
, O. _. `3 {# {7 l9 c8.1 添加instance类型资源利用率告警
" d# f8 Z$ f* T% g1 Z; F( w- y" i: A# d+ x, y
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 instance1 R% W" [$ H& y z
8 y z$ |: \( F9 q1 s1 t7 H5 c+ N3 U) A) x- V% H7 u. i* p
root@controller-01:~# aodh alarm list1 M2 m+ m* w: [+ o
+--------------------------------------+-----------------------------+--------+-------+----------+---------+
2 Y, T. f. i5 E- a/ I| alarm_id | type | name | state | severity | enabled |
# x! _% v6 Z' A+--------------------------------------+-----------------------------+--------+-------+----------+---------+: I% ~% |( ^6 ~4 q$ v' d
| c5fd0a6e-b389-414e-826c-e830c9448261 | gnocchi_resources_threshold | cpu_hi | ok | low | True |1 O) s0 X" p: i8 f7 e( k0 n
+--------------------------------------+-----------------------------+--------+-------+----------+---------+
1 {7 `, d4 c W! _TIPs:insufficient表示尚未通过该告警规则的苹果周期,无法判定是否告警。5 K/ k0 U; J/ C: u! T
+ e! r3 n, M F, F: b( t
8.2 更新alarm的告警阈值为75%
5 |: K7 ^0 R+ U) N* m9 t
& U# `6 z3 @* d) Z5 Broot@controller-01:~# aodh alarm update 566ef2f3-3302-4244-8b11-e49888fa732f --threshold 75
+ Z3 [" P: u+ D$ q8.3 设定alarm告警规则状态
% u6 Q+ F/ R- [ D) f4 f0 X! U3 P8 g! R2 _# q5 g4 h) W6 q. ~
root@controller-01:~# aodh alarm state get 566ef2f3-3302-4244-8b11-e49888fa732f
: N* }) X/ _4 v r6 N& h: j+-------+-------------------+# ~3 I B' X4 S4 E0 l
| Field | Value |: v" _, T) Q6 Y6 Z. ]7 A) T, g, R
+-------+-------------------+6 P2 g1 h: y- H4 r: C* N! x
| state | ok |& s: z6 D! L: y, t
+-------+-------------------+ w6 h$ u( F- G
8.4 查看alarm告警规则告警历史
# _: \) `3 ?; w4 d3 b, w" B3 R! M% i) A# R/ H
aodh alarm-history show c5fd0a6e-b389-414e-826c-e830c9448261- i- w* k l/ |0 I0 X H
+----------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+
. M5 W9 J3 Y8 F$ k| timestamp | type | detail | event_id |
6 U( t. V8 k4 v/ t+----------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+
$ j, b; n( o3 M3 P1 _/ B# f| 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 |
1 n# o' Z( L/ o! R| 2021-03-22T10:03:40.313080 | state transition | {"state": "ok", "state_reason": "Manually set via API"} | ae4d7b6d-9e15-42df-96a0-5e3833b09bf1 |
( C- C* Q4 D, S0 X' Y0 p| 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 |3 K2 |, {' ^& D- I8 K( d
+----------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+1 t; h( V* R- H
+----------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+
2 }# X% ]( T; p( _' `1 V
* B! G0 N0 n6 Z1 D' E4 Z, a4 F5 N2 y. F) }' K [" Q' n
|
|