From 436c107633f8de4ce042492ea7bb5f61d438eab6 Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Wed, 10 Jul 2019 14:31:25 +0300 Subject: [PATCH] Add an example Alertmanager config For when running in config file mode. The same example can be used to manually insert into the SQLite database or figure out how to use the services API to configure Alertmanager service Refs: #264 Signed-off-by: Jason Robinson --- config.sample.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config.sample.yaml b/config.sample.yaml index dc196c9..69a52d3 100644 --- a/config.sample.yaml +++ b/config.sample.yaml @@ -136,3 +136,19 @@ services: "hook1": RoomID: "!someroom:id" MessageType: "m.text" # default is m.text + + - ID: "alertmanager_service" + Type: "alertmanager" + UserID: "@alertmanager:localhost" + Config: + # This is for information purposes only. It should point to Go-NEB path as follows: + # `/services/hooks/` + # Where in this case "service ID" is "alertmanager_service" + # Make sure your BASE_URL can be accessed by the Alertmanager instance! + webhook_url: "http://localhost/services/hooks/YWxlcnRtYW5hZ2VyX3NlcnZpY2UK" + # Each room will get the notification with the alert rendered with the given template + rooms: + "!someroomid:domain.tld": + text_template: "{{range .Alerts -}} [{{ .Status }}] {{index .Labels \"alertname\" }}: {{index .Annotations \"description\"}} {{ end -}}" + html_template: "{{range .Alerts -}} {{ $severity := index .Labels \"severity\" }} {{ if eq .Status \"firing\" }} {{ if eq $severity \"critical\"}} [FIRING - CRITICAL] {{ else if eq $severity \"warning\"}} [FIRING - WARNING] {{ else }} [FIRING - {{ $severity }}] {{ end }} {{ else }} [RESOLVED] {{ end }} {{ index .Labels \"alertname\"}} : {{ index .Annotations \"description\"}} source
{{end -}}" + msg_type: "m.text" # Must be either `m.text` or `m.notice`