Giter Club home page Giter Club logo

am-route-test's Introduction

Alertmanager Route Test

I use Alertmanager1 with Prometheus to route alerts from Prometheus servers to the right team. This also does various filtering, handle high and low priority alerts, and other things which have made the routing tree more complex than I'd like. Often, requests to fine tune various bits come in that require some modification of the route tree. Because alert notification simply cannot break, I wanted a tool that could automate unit testing of my route tree.

This lead to writing of am-route-test. This will parse a given Alertmanager config, use the label / value pairs supplied on the command line, and print out the Alertmanager receivers that would eventually handle that an alert with those labels.

Usage of am-route-test:
Evalute what receiver(s) are used when an alert with the given labels
is passed through the routing tree found in the Alertmanager config.

        am-route-test [options] label=value [label=value ...]

  -e string
        Comma seperated list of expected alert receivers
  -f string
        Alertmanager configuration file (default "alertmanager.yml")

Use the -e option to make the tool exit with a status code of 2 if the receivers found do not match the comma seperated list of receivers passed to that flag.

Examples are below for some edge case testing we have in the PERF environment.

#!/bin/bash

set +eux

# ...

# PERF environment is special
./am-route-test -e perfcap-high-priority,default-event-handler \
    monitor=node severity=page environment=perf
./am-route-test -e perfcap-low-priority,default-event-handler \
    monitor=node severity=warning environment=perf

Maintenance

Alertmanager is not meant to be used as a library, so its completely vendored into this source code. Maintenance and upgrades should include updating the vendoring. Perhaps even managing it with govendor or dep.

Could this be contributed directly to the amtool CLI that ships with Alertmanager?

Contributing

Open a PR.

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.