|
|
八、添加告警规则
3 I+ e( g# B; G3 V$ M( A7 f参考:
& t- q; P% \' |2 t2 h7 I: Bhttps://docs.openstack.org/aodh/ ... lemetry-alarms.html
: A2 \; c6 Y" t( S. q8.1 添加instance类型资源利用率告警4 U% C2 N; e* B' r# C
+ J( @0 {5 I) w# S+ I
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
9 R* | p* `: q" R" I2 C, \, y! P. ^, \$ d7 g3 u
& W7 l# y+ v; q- f& aroot@controller-01:~# aodh alarm list
+ K0 f) } @0 }2 Q) D- Q+--------------------------------------+-----------------------------+--------+-------+----------+---------+
; W8 l5 @6 @. _1 }| alarm_id | type | name | state | severity | enabled |1 R+ Q7 S# v: o( ~ l' J/ ^
+--------------------------------------+-----------------------------+--------+-------+----------+---------+5 p6 c! g! M1 i' O& a! k7 L- Z# N% B
| c5fd0a6e-b389-414e-826c-e830c9448261 | gnocchi_resources_threshold | cpu_hi | ok | low | True |: d. `( s' A- F9 W: }$ \5 B
+--------------------------------------+-----------------------------+--------+-------+----------+---------+
3 W! [9 M* T# b/ R& v. s" z7 _6 xTIPs:insufficient表示尚未通过该告警规则的苹果周期,无法判定是否告警。
2 k& A @' E; |
, }( q3 L2 |; [2 M Q* R8.2 更新alarm的告警阈值为75%
T0 o/ x1 g; n! K; j/ }9 V- G- C, a8 D
root@controller-01:~# aodh alarm update 566ef2f3-3302-4244-8b11-e49888fa732f --threshold 75+ C+ j5 _& G' F4 ^ `, L4 e. E8 O# n
8.3 设定alarm告警规则状态
# ~4 X& u4 U5 y& O& p% n! w, r0 p& ^
root@controller-01:~# aodh alarm state get 566ef2f3-3302-4244-8b11-e49888fa732f
; Y4 [- v' O, b+-------+-------------------+
) @# x; K4 |) m7 L3 l2 |4 ^| Field | Value |, A0 n9 a; S9 r3 C& J9 |' O' p
+-------+-------------------+% @1 k, L' v' B& x
| state | ok |
+ U% i* g' k6 t$ b+-------+-------------------+
* \! J1 e7 _8 [6 H( E, L* {8.4 查看alarm告警规则告警历史: z$ N! R* Z1 f
6 \' T/ I; ^; _. jaodh alarm-history show c5fd0a6e-b389-414e-826c-e830c9448261
" y5 l9 V( I" N0 y+ k* \ `+----------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+8 o9 y; U* d! i+ ^
| timestamp | type | detail | event_id |. U: B; x: F6 m
+----------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+
! g+ t# G8 h6 r- ]' Q& O| 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 |: z# @+ i+ |9 F4 q
| 2021-03-22T10:03:40.313080 | state transition | {"state": "ok", "state_reason": "Manually set via API"} | ae4d7b6d-9e15-42df-96a0-5e3833b09bf1 |
0 K3 ` s9 t, N# c2 A% b| 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 |
1 n, z# K8 H. F, `% H U+----------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+
U0 Y- u' G6 E7 T; A+----------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+. f/ O" n: z) L& L- ~' f
, [2 w+ G$ j9 S% G: d: y6 k1 u' h* U) z# c& e6 A$ \
|
|