alerta / alerta-contrib

Contributed integrations, plugins and custom webhooks
http://alerta.io
MIT License
119 stars 170 forks source link

SLACK_SEVERITY_FILTER allows pre-filtering of alerts sent to Slack solely by severity #319

Closed mdfischer closed 4 years ago

mdfischer commented 4 years ago

Adds configuration setting SLACK_SEVERITY_FILTER (list) in alertad.conf to allow filtering of alerts to be forwarded to Slack based upon their severity. For example, if SLACK_SEVERITY_FILTER = ['warning'], all alerts with 'warning' severity will NOT get processed or filtered by the other rules in the config file. Alerts of any other severity will pass through this filter.

I found this useful because we use the Alerta UI as well as Slack, where we only want to get Slack notifications for the more serious stuff that requires immediate attention (severity levels of 'major' or 'critical'), and we leave it to our admin staff to look at the UI panel regularly to deal with less urgent lower level alerts.

mdfischer commented 4 years ago

Sorry, that was lazy of me. It seemed a really easy change to slip in late at night...I should have been more thorough...

mdfischer commented 4 years ago

OK I think this is good to go. Note that I changed the logic so that the default is to block no Slack messages if SLACK_SEVERITY_FILTER is not set or is an empty list. Only alerts with severities listed in SLACK_SEVERITY_FILTER will be blocked from being sent to Slack.

satterly commented 4 years ago

Thanks 👍