mirror of
https://github.com/alerta/alerta.git
synced 2025-01-30 19:46:21 +00:00
26 lines
750 B
Python
26 lines
750 B
Python
|
|
from alerta.plugins import PluginBase
|
|
|
|
|
|
class EnhanceAlert(PluginBase):
|
|
|
|
def pre_receive(self, alert):
|
|
|
|
if 'TPS reports' in alert.text:
|
|
alert.attributes['customer'] = 'Initech'
|
|
elif 'nexus' in alert.text:
|
|
alert.attributes['customer'] = 'Tyrell Corp.'
|
|
elif 'green wafer' in alert.text:
|
|
alert.attributes['customer'] = 'Soylent Corp.'
|
|
elif 'Skynet' in alert.text:
|
|
alert.attributes['customer'] = 'Cyberdyne Systems'
|
|
else:
|
|
alert.attributes['customer'] = 'ACME Corp.'
|
|
|
|
alert.attributes['runBookUrl'] = 'http://www.mywiki.org/RunBook/%s' % alert.event.replace(' ', '-')
|
|
|
|
return alert
|
|
|
|
def post_receive(self, alert):
|
|
|
|
return
|