Skip to content

Commit

Permalink
feat: Add logic to telegram plugin to check previous severity (#360)
Browse files Browse the repository at this point in the history
* fix syntax errors

* add routing plugin

* change alert duplicate count in routing plugin to 1

* fix routing

* reinit plugin

* update routing pluging

* disable telegram notification for custom severity

* remove routing plugin

* disable telegram notification for custom severity

* Revert "remove routing plugin"

This reverts commit 0deefe0.

* Revert "update routing pluging"

This reverts commit 7d5fc43.

* Revert "add routing plugin"

This reverts commit b14f434.

* Revert "fix syntax errors"

This reverts commit cc0d62c.

* disable TELEGRAM_DISABLE_NOTIFICATION_SEVERITY

* revert

* add checking previous severity for telegram forwarding

* remove closed frome severity

* remove 'closed' from severities
  • Loading branch information
demshin authored Oct 18, 2021
1 parent 106e3e2 commit a979958
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/telegram/alerta_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ def post_receive(self, alert):
if alert.severity in TELEGRAM_DISABLE_NOTIFICATION_SEVERITY:
return

if alert.severity in ['ok', 'normal', 'cleared', app.config.get('DEFAULT_NORMAL_SEVERITY')] and alert.previous_severity in TELEGRAM_DISABLE_NOTIFICATION_SEVERITY:
LOG.debug("Alert severity is %s but previous_severity was %s (included in DEFAULT_NORMAL_SEVERITY list), thus it will not be forwarded to Telegram." % (alert.severity, alert.previous_severity))
return

LOG.debug('Telegram: post_receive sendMessage disable_notification=%s', str(disable_notification))

chat_ids = TELEGRAM_CHAT_ID.split(",")
Expand Down

0 comments on commit a979958

Please sign in to comment.