File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22timezone = Europe/London
33;timezone = Australia/Sydney
44colour = yes
5- output = text
5+ output = psql ; Postgres-style table format
66
77[profile production]
88endpoint = https://uk.alerta.io
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22
3- from alertaclient .api import AlertaClient
4- from alertaclient .models .alert import Alert
3+ from alertaclient .api import Client
54
6- client = AlertaClient ()
7-
8- alert = Alert (
9- resource = 'web-server-01' ,
10- event = 'HttpError' ,
11- correlate = ['HttpOK' ],
12- group = 'Web' ,
13- environment = 'Production' ,
14- service = ['theguardian.com' ],
15- severity = 'major' ,
16- value = 'Bad Gateway (502)' ,
17- text = 'Web server error.' ,
18- tags = ['web' , 'dc1' , 'london' ],
19- attributes = {'customer' : 'The Guardian' }
20- )
21- print (alert )
5+ client = Client ()
226
237try :
24- print (client .send (alert ))
8+ alert = client .send_alert (
9+ resource = 'web-server-01' ,
10+ event = 'HttpError' ,
11+ correlate = ['HttpOK' ],
12+ group = 'Web' ,
13+ environment = 'Production' ,
14+ service = ['theguardian.com' ],
15+ severity = 'major' ,
16+ value = 'Bad Gateway (502)' ,
17+ text = 'Web server error.' ,
18+ tags = ['web' , 'dc1' , 'london' ],
19+ attributes = {'customer' : 'The Guardian' }
20+ )
21+ print (alert )
2522except Exception as e :
2623 print (e )
You can’t perform that action at this time.
0 commit comments