Skip to content

Integration of Alertmanager notifications in RocketChat

License

Notifications You must be signed in to change notification settings

andloh/AlertmanagerRocketChat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

AlertmanagerRocketChar

Overview

AlertmanagerIntegration is script that will parse webhook notifications coming to Rocket.Chat.

Installation

Rocket.Chat

  1. Login as admin user and go to: Administration => Integrations => New Integration => Incoming WebHook

  2. Set "Enabled" and "Script Enabled" to "True"

  3. Set all channel, icons, etc. as you need

  4. Paste contents of AlertmanagerIntegrations.js into Script field.

  5. Create Integration. You;ll see some values apper. Copy WebHook URL and proceed to Alertmanager.

Alertmanager

  1. Create new receiver or modify config of existing one. You'll need to add webhooks_config to it. Small example:
route:
    repeat_interval: 30m
    group_interval: 30m
    receiver: 'rocketchat'

receivers:
    - name: 'rocketchat'
      webhook_configs:
          - send_resolved: false
            url: '${WEBHOOK_URL}'
  1. Reload/restart alertmanager.

If everything is OK you should see alerts like this:

alert example

Testing

In order to test the webhook you can use the following curl (replace ):

curl -X POST -H 'Content-Type: application/json' --data '
{
  "text": "Example message",
  "attachments": [
    {
      "title": "Rocket.Chat",
      "title_link": "https://rocket.chat",
      "text": "Rocket.Chat, the best open source chat",
      "image_url": "https://rocket.cha t/images/mockup.png",
      "color": "#764FA5"
    }
  ],
  "status": "firing",
  "alerts": [
    {
      "labels": {
        "alertname": "high_load",
        "instance": "node-exporter:9100"
      },
      "annotations": {
        "description": "node-exporter:9100 of job xxxx is under high load.",
        "severity": "major",
        "summary": "node-exporter:9100 under high load."
      }
    }
  ]
}
' <webhook-url>

NOTES

Alertmanager doesn't actually sends singular alerts - it sends array of current alerts, so it doesn't seem possible for now to split then in separate messages, but if you want, you can configure separate alerts/receivers/webhooks.

Alertmanager Docs

Rocket.Chat Docs

About

Integration of Alertmanager notifications in RocketChat

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%