Git Product home page Git Product logo

alertmanager-webhook-rocketchat's Introduction

alertmanager-webhook-rocketchat

Build Status

Prometheus AlertManager webhook receiver to Rocket.Chat, written in Go.

The goal of this project is to provide a standard component to send alerts from the AlertManager to the Rocket.Chat team communication tool.

Getting Started

Prerequisites

To run this project, you will need a working Go environment.

Installing

go get -u github.com/FXinnovation/alertmanager-webhook-rocketchat

Running the tests

make test

Usage

./alertmanager-webhook-rocketchat -h

Deployment

The project takes 2 optional parameters to be configured :

  • config.file to specify RocketChat configuration. Cf config/rocketchat_example.yml (default : config/rocketchat.yml)
  • listen.address to specify the listening port (default : 9876)

Configuration is done at three levels: alertmanager-webhook-rocketchat, AlertManager, and Prometheus server.

alertmanager-webhook-rocketchat config

alertmanager-webhook-rocketchat Rocket.Chat endpoint, credentials, severity_colors, and channel are configured in a yml file, as shown in the example below. Note that fields severity_colors and channel are optional. More severity color mappings can be added.

endpoint:
  scheme: "https"
  host: "<host.url>"
credentials:
  name: "<user>"
  email: "<[email protected]>"
  password: "<password>"
severity_colors:
  warning: "<warning_color_hexcode>"
  critical: "<critical_color_hexcode>"
channel:
  default_channel_name: "<default_channel_name>"

AlertManager config

In the AlertManger config (e.g., alertmanager.yml), a webhook_configs target the alertmanager-webhook-rocketchat URL, e.g.:

global:
  resolve_timeout: 5m

route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 10m
  receiver: 'rocketchat'

receivers:
- name: 'rocketchat'
  webhook_configs:
  - url: "http://localhost:9876/webhook"
    send_resolved: true

Prometheus rules config

In the Prometheus server rules files, alerts defines channel_name and severity, e.g.:

groups:
- name: example
  rules:
  # Alert for any instance that is unreachable for >1 minutes.
  - alert: InstanceDown
    expr: up == 0
    for: 1m
    labels:
      severity: critical
      channel_name: "prometheus-test-room"
    annotations:
      summary: "Instance {{ $labels.instance }} down"
      description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minutes."

Building

Build the sources with

make build

Note: As this is a go build you can use GOOS and GOARCH environment variables to build for another platform.

Crossbuilding

The Makefile contains a crossbuild target which builds all the platforms defined in .promu.yml file and puts the files in .build folder. Alternatively you can specify one platform to build with the OSARCH environment variable;

OSARCH=linux/amd64 make crossbuild

Docker image

To run alertmanager-webhook-rocketchat on Docker, you can use the fxinnovation/alertmanager-webhook-rocketchat image.

You can also build a docker image from sources using:

make docker

The resulting image is named fxinnovation/alertmanager-webhook-rocketchat:{git-branch}. It exposes port 9876 and expects the config in /config/rocketchat.yml. To configure it, you can bind-mount a config from your host:

$ docker run -p 9876 -v /path/on/host/config/rocketchat.yml:/config/rocketchat.yml fxinnovation/alertmanager-webhook-rocketchat:master

Contributing

Refer to CONTRIBUTING.md.

License

Apache License 2.0, see LICENSE.

alertmanager-webhook-rocketchat's People

Contributors

beginin avatar thomaslacher avatar vincentcreusotfx avatar vinzfx avatar zakichammaa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.