0
0
Fork 0
mirror of https://github.com/alerta/alerta-contrib.git synced 2025-03-17 22:12:38 +00:00
alerta_alerta-contrib/plugins/timeout/alerta_timeout.py
2017-09-17 16:22:46 +01:00

28 lines
No EOL
622 B
Python

import logging
import os
try:
from alerta.plugins import app # alerta >= 5.0
except ImportError:
from alerta.app import app # alerta < 5.0
from alerta.plugins import PluginBase
LOG = logging.getLogger('alerta.plugins.timeout')
TIMEOUT = os.environ.get('ALERT_TIMEOUT') or app.config.get('ALERT_TIMEOUT', '2600')
class Timeout(PluginBase):
def pre_receive(self, alert):
LOG.debug("Setting timeout for alert to %s ",TIMEOUT)
alert.timeout = TIMEOUT
return alert
def post_receive(self, alert):
return
def status_change(self, alert, status, text):
return