Commit 5adf0d7 1 parent 1d9898c commit 5adf0d7 Copy full SHA for 5adf0d7
File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,24 @@ def transform_text(text):
20
20
21
21
22
22
def format_message (alert ):
23
+ status = alert ['status' ].upper ()
24
+ alert = alert ['labels' ]['alertname' ]
25
+ clusterID = alert ['labels' ]['tenant_cluster_id' ]
26
+ description = ''
27
+ if 'description' in alert ['annotations' ]:
28
+ description = alert ['annotations' ]['description' ]
29
+ elif 'summery' in alert ['annotations' ]:
30
+ description = alert ['annotations' ]['summery' ]
31
+ elif 'action' in alert ['annotations' ]:
32
+ description = alert ['annotations' ]['action' ]
33
+ else :
34
+ description = 'No description provided'
35
+
23
36
return '[{}] {} in {}%0a{}' .format (
24
- alert [ ' status' ]. upper () ,
25
- alert [ 'labels' ][ 'alertname' ] ,
26
- alert [ 'labels' ][ 'tenant_cluster_id' ] ,
27
- alert [ 'annotations' ][ 'summary' ] )
37
+ status ,
38
+ alert ,
39
+ clusterID ,
40
+ description )
28
41
29
42
30
43
def send_sms (message , recipients ):
You can’t perform that action at this time.
0 commit comments