Coder Social home page Coder Social logo

kaali09 / alertmanager-github-receiver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hemajv/alertmanager-github-receiver

0.0 1.0 0.0 149 KB

Prometheus Alertmanager webhook receiver that creates GitHub issues from alerts

License: Apache License 2.0

Go 98.99% Dockerfile 0.90% Makefile 0.11%

alertmanager-github-receiver's Introduction

alertmanager-github-receiver

Version Build Status Coverage Status GoDoc | Go Report Card

Not all alerts are an emergency. But, we want to track every one because alerts are always an actual problem. Either:

  • an actual problem in the monitored system
  • an actual problem in processes around the monitored system
  • an actual problem with the alert itself

The alertmanager github receiver creates GitHub issues using Alertmanager webhook notifications.

Build

make docker DOCKER_TAG=repo/imageName

This will build the binary and push it to repo/imageName.

Setup

Create GitHub access token

The github receiver uses user access tokens to create issues in an existing repository.

Generate a new access token:

Because this access token has permission to create issues and operate on repositories the access token user can access, protect the access token as you would a password.

Start GitHub Receiver

To start the github receiver locally:

docker run -it measurementlab/alertmanager-github-receiver:latest
        -authtoken=$(GITHUB_AUTH_TOKEN) -org=<org> -repo=<repo>

Note: both the org and repo must already exist.

Configure Alertmanager Webhook Plugin

The Prometheus Alertmanager supports third-party notification mechanisms using the Alertmanager Webhook API.

Add a receiver definition to the alertmanager configuration.

- name: 'github-receiver-issues'
  webhook_configs:
  - url: 'http://localhost:9393/v1/receiver'

To publish a test notification by hand, try:

msg='{
  "version": "4",
  "groupKey": "fakegroupkey",
  "status": "firing",
  "receiver": "http://localhost:9393/v1/receiver",
  "groupLabels": {"alertname": "FoobarIsBroken"},
  "externalURL": "http://localhost:9093",
  "alerts": [
    {
      "labels": {"thing": "value"},
      "annotations": {"hint": "how to fix foobar"},
      "status": "firing",
      "startsAt": "2018-06-12T01:00:00Z",
      "endsAt": "2018-06-14T01:00:00Z"
    }
  ]
}'
curl -XPOST --data-binary "${msg}" http://localhost:9393/v1/receiver

Configuration

Auto close

If -enable-auto-close is specified, the program will close each issue as its corresponding alert is resolved. It searches for matching issues by filtering open issues on the value of -alertlabel and then matching issue titles. The issue title template can be overridden using -title-template-files for greater (or lesser) specificity. The default template is {{ .Data.GroupLabels.alertname }}, which sets the issue title to the alert name. The template is passed a Message as its argument.

Repository

If the alert includes a repo label, issues will be created in that repository, under the GitHub organization specified by -org. If no repo label is present, issues will be created in the repository specified by the -repo option.

alertmanager-github-receiver's People

Contributors

stephen-soltesz avatar pboothe avatar robertodauria avatar cjyar avatar lenahoinkis avatar krasi-georgiev avatar

Watchers

James Cloos 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.