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/normalise/alerta_normalise.py

31 lines
697 B
Python
Raw Normal View History

2017-09-17 14:56:55 +00:00
2016-09-15 09:16:11 +00:00
import logging
from alerta.plugins import PluginBase
2016-09-15 09:16:11 +00:00
LOG = logging.getLogger('alerta.plugins.normalise')
class NormaliseAlert(PluginBase):
def pre_receive(self, alert):
2016-09-15 09:16:11 +00:00
LOG.info("Normalising alert...")
2016-11-21 22:09:22 +00:00
# prepend severity to alert text
alert.text = '%s: %s' % (alert.severity.upper(), alert.text)
2016-09-15 09:16:11 +00:00
2016-11-21 22:09:22 +00:00
# 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