0
0
Fork 0
mirror of https://github.com/alerta/alerta-contrib.git synced 2025-03-16 05:23:28 +00:00
alerta_alerta-contrib/plugins/enhance/alerta_enhance.py
2016-09-15 10:18:03 +01:00

33 lines
921 B
Python

import logging
from alerta.plugins import PluginBase
LOG = logging.getLogger('alerta.plugins.enhance')
class EnhanceAlert(PluginBase):
def pre_receive(self, alert):
LOG.info("Enhancing 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
def status_change(self, alert, status, text):
return