Skip to content
Snippets Groups Projects
Commit d17beadb authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-685: Prepare alerta to recognise stations as resources

parent 68fc6eec
No related branches found
No related tags found
1 merge request!290Resolve L2SS-685 "Add alerta docker"
...@@ -16,7 +16,7 @@ DATE_FORMAT_MEDIUM_DATE = "dd DD/MM HH:mm" ...@@ -16,7 +16,7 @@ DATE_FORMAT_MEDIUM_DATE = "dd DD/MM HH:mm"
DATE_FORMAT_LONG_DATE = "yyyy-MM-DD HH:mm:ss.sss" DATE_FORMAT_LONG_DATE = "yyyy-MM-DD HH:mm:ss.sss"
# Default overview settings # Default overview settings
COLUMNS = ['severity', 'status', 'lastReceiveTime', 'environment', 'resource', 'lofarDevice', 'lofarAttribute', 'event', 'text'] COLUMNS = ['severity', 'status', 'lastReceiveTime', 'resource', 'lofarDevice', 'lofarAttribute', 'event', 'text']
DEFAULT_FILTER = {'status': ['open']} DEFAULT_FILTER = {'status': ['open']}
SORT_LIST_BY = "createTime" SORT_LIST_BY = "createTime"
AUTO_REFRESH_INTERVAL = 5000 # ms AUTO_REFRESH_INTERVAL = 5000 # ms
...@@ -44,13 +44,13 @@ BASE_URL = os.environ.get("BASE_URL", "") ...@@ -44,13 +44,13 @@ BASE_URL = os.environ.get("BASE_URL", "")
SLACK_PAYLOAD = { SLACK_PAYLOAD = {
"channel": "{{ channel }}", "channel": "{{ channel }}",
"emoji": ":fire:", "emoji": ":fire:",
"text": "*{{ alert.severity|capitalize }}* :: _{{ alert.event }}_\n\n```{{ alert.text }}```", "text": "*{{ alert.severity|capitalize }}* :: *{{ alert.resource }}* :: _{{ alert.event }}_\n\n```{{ alert.text }}```",
"attachments": [{ "attachments": [{
"color": "{{ color }}", "color": "{{ color }}",
"fields": [ "fields": [
{"title": "Device", "value": "{{ alert.attributes.lofarDevice }}", "short": True }, {"title": "Device", "value": "{{ alert.attributes.lofarDevice }}", "short": True },
{"title": "Attribute", "value": "{{ alert.attributes.lofarAttribute }}", "short": True }, {"title": "Attribute", "value": "{{ alert.attributes.lofarAttribute }}", "short": True },
{"title": "Environment", "value": "{{ alert.environment }}", "short": True }, {"title": "Resource", "value": "{{ alert.resource }}", "short": True },
{"title": "Status", "value": "{{ status|capitalize }}", "short": True }, {"title": "Status", "value": "{{ status|capitalize }}", "short": True },
{"title": "Dashboards", "value": "<{{ config.BASE_URL }}/#/alert/{{ alert.id }}|Alerta>\nGrafana <{{ alert.attributes.grafanaDashboardUrl }}|Dashboard> <{{ alert.attributes.grafanaPanelUrl }}|Panel>", "short": True }, {"title": "Dashboards", "value": "<{{ config.BASE_URL }}/#/alert/{{ alert.id }}|Alerta>\nGrafana <{{ alert.attributes.grafanaDashboardUrl }}|Dashboard> <{{ alert.attributes.grafanaPanelUrl }}|Panel>", "short": True },
{"title": "Configure", "value": "Grafana <{{ alert.attributes.grafanaAlertUrl }}|View> <{{ alert.attributes.grafanaSilenceUrl }}|Silence>", "short": True }, {"title": "Configure", "value": "Grafana <{{ alert.attributes.grafanaAlertUrl }}|View> <{{ alert.attributes.grafanaSilenceUrl }}|Silence>", "short": True },
......
...@@ -26,6 +26,9 @@ class EnhanceLOFAR(PluginBase): ...@@ -26,6 +26,9 @@ class EnhanceLOFAR(PluginBase):
if key == "name": if key == "name":
alert.attributes['lofarAttribute'] = value alert.attributes['lofarAttribute'] = value
if key == "station":
alert.resource = value
return alert return alert
def post_receive(self, alert, **kwargs): def post_receive(self, alert, **kwargs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment