0
0
Fork 0
mirror of https://github.com/alerta/alerta-contrib.git synced 2025-03-17 05:52:38 +00:00
alerta_alerta-contrib/plugins/normalise/alerta_normalise.py
2016-11-21 22:13:25 +00:00

29 lines
696 B
Python

import logging
from alerta.plugins import PluginBase
LOG = logging.getLogger('alerta.plugins.normalise')
class NormaliseAlert(PluginBase):
def pre_receive(self, alert):
LOG.info("Normalising alert...")
# prepend severity to alert text
alert.text = '%s: %s' % (alert.severity.upper(), alert.text)
# supply different default values if missing
if not alert.group or alert.group == 'Misc':
alert.group = 'Unknown'
if not alert.value or alert.value == 'n/a':
alert.value = '--'
return alert
def post_receive(self, alert):
return
def status_change(self, alert, status, text):
return