From 2f779b670b6d4a9f5d1199b9177111ded5dfd118 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Mon, 21 Mar 2022 16:28:48 +0100
Subject: [PATCH] L2SS-685: Document how to forward alerts from Grafana to
 Alerta

---
 docker-compose/grafana/alerting.json          | 26 +++++++++++++++++++
 .../docs/source/installation.rst              | 16 ++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 docker-compose/grafana/alerting.json

diff --git a/docker-compose/grafana/alerting.json b/docker-compose/grafana/alerting.json
new file mode 100644
index 000000000..1a08e2ceb
--- /dev/null
+++ b/docker-compose/grafana/alerting.json
@@ -0,0 +1,26 @@
+{
+  "template_files": {},
+  "alertmanager_config": {
+    "route": {
+      "receiver": "Alerta"
+    },
+    "templates": null,
+    "receivers": [
+      {
+        "name": "Alerta",
+        "grafana_managed_receiver_configs": [
+          {
+            "uid": "ROaAvQEnz",
+            "name": "Alerta",
+            "type": "webhook",
+            "disableResolveMessage": false,
+            "settings": {
+              "url": "http://alerta-web:8080/api/webhooks/prometheus?api-key=demo-key"
+            },
+            "secureFields": {}
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/tangostationcontrol/docs/source/installation.rst b/tangostationcontrol/docs/source/installation.rst
index 2699d1baa..fd01fe45e 100644
--- a/tangostationcontrol/docs/source/installation.rst
+++ b/tangostationcontrol/docs/source/installation.rst
@@ -72,3 +72,19 @@ The ELK stack requires some kernel settings to be tuned, before it will start. A
   make restart elk
 
 after reboot, or configure your system to set ``sysctl -w vm.max_map_count=262144`` (or higher) as root during boot.
+
+Configuration
+---------------------------
+
+These sections are optional, to configure specific functionality you may or may not want to use.
+
+Alerta
+````````
+
+If you want Grafana alerts to appear in Alerta, you need to manually configure Grafana to forward them. Import the alert settings manually:
+
+- Go to Grafana (http://localhost:3000) and sign in with an administration account (default: admin/admin),
+- Go to ``Alerting`` and select ``Admin`` in the left menu bar,
+- Copy/paste the following information, and press ``Save``:
+
+.. literalinclude:: ../../../docker-compose/grafana/alerting.json
-- 
GitLab