alerta / alerta-webui

Alerta Web UI 7.0
https://try.alerta.io
Apache License 2.0
109 stars 55 forks source link

Blackout never end if alert is not updated #577

Open danielelopez1 opened 3 months ago

danielelopez1 commented 3 months ago

Issue Summary when you set a blackout, the alert status don't change when the blackout expire. It change when a new alert arrive, but if not, it always shows as blackout.

Environment

PLUGINS = [ "blackout", "reject" ]

DELETE_SCOPES = ["delete:alerts"]

NOTIFICATION_BLACKOUT = True BLACKOUT_ACCEPT = ['normal', 'ok', 'cleared']

CUSTOMER_VIEWS = True DEFAULT_FIELD = 'resource'

AUTH_REQUIRED = True ADMIN_USERS = ['admin'] ADMIN_ROLES = ['admin'] USER_DEFAULT_SCOPES = ['read:alerts','read:customers'] AUTH_PROVIDER = 'basic' SIGNUP_ENABLED = False GUEST_DEFAULT_SCOPES = ['read:alerts']

AUTO_REFRESH_INTERVAL=60000 ALLOWED_ENVIRONMENTS = ['Production', 'Pre-Production', 'Disaster Recovery', 'Development', 'Test', 'UNKNOWN'] COLUMNS = ['severity', 'status', 'createTime', "customer", 'origin', 'environment', 'service', 'resource', 'event', 'text', 'owner','ip']

DEBUG = False

AUDIT_TRAIL = ['admin', 'write', 'auth'] AUDIT_LOG = True AUDIT_LOG_JSON = True

LOG_HANDLERS = ['file'] LOG_FILE = '/var/log/alerta/alertad.log' LOG_BACKUP_COUNT = 1 LOG_FORMAT = 'json' LOG_LEVEL = 'WARNING'

To Reproduce Steps to reproduce the behavior:

  1. Go to 'blackout'
  2. Set blackout
  3. receive an alert that match blackout
  4. wait for blackout to expire

For web app issues, include any web browser JavaScript console errors.

Expected behavior when blackout end, the blackout status on the alert had to expire as well, and return the previous status.

Additional context I know alerta donesn't work retroactively on alerts, but some things need to be done retroactively, like blackouts. if you can please tell me where to find the code that match the alerts with the blackout, I can try to implement a plugin or modify the code itself, to achive this. The idea is: when I set a blackout, I run the blackout against all alerts that match, and set them in the blackout status. (not the closed ones). when an alert match the blackout, I can assign the blackout id to that alert (more then one if it matchs more blackouts). when the blackout expire, I make a select to match all the alerts that match that blackout (by blackoutid) and remove it. if there are no more blackouts id on that alert, I'll restore the previous alert's status. maybe there is a better way to do it, but I have no idea how it works now. If you can please tell me the best way to achive this, I can try to work on it and then I'll give you the code for future implementations.