Alertmanager go message broker - A simple message broker made to integrate with alertmanager/prometheus

Alertmanager message broker

Prerequisites

  • Go 1.16+
  • Sqllite driver

About:

The alertmanager message broker is a project made to meet some of my needs to integrate alertmanager with other platforms, through webhooks.

It has the function of registering endpoints (who will receive the alerts) so the same alert is sent to multiple platforms with specific payloads, this record is kept in a sqlite database created by the application, located in /var/lib/sql/database.db.

The logic is present in controller/controller.go, which have the main function of the application.

Build:

  • You can compile directly with go build -ldflags '-extldflags "-static"' -o alertmanager-broker.

To use docker:

  • docker build -t repo@usuario/alertmanager-broker .
  • docker run -t repo@usuario/alertmanager-broker -p 3000:3000

Variables(optional):

If you set url and endpoint as environment variables, they will create an entry in database and will be used as default.

Variable Description
PORT Set port that the application will be listening to, default port is 3000
URL URL with protocol and hostname, example: https://api.google.com
ENDPOINT Endpoint that will Example: api/v1/message/send

Endpoints:

Endpoint Method Description
/api/v1/endpoint POST Add/Remove endpoint (see example of usage bellow)
/api/v1/endpoints GET List all endpoints registered, with ID (required to delete endpoint)
/api/v1/send POST Endpoint that will be used by alertmanager to receive the webhook and send alerts to endpoints
/api/v1/ping GET Send a test alert to endpoints

Example of usage of add/delete endpoints:

Add:

With alertname:

$ curl -X POST http://localhost:3000/api/v1/endpoint -d '{"action":"add","url":"https://contoso.com","endpoint":"/api/v1/message/send","alertname":"test"}' 

Without alertname (by default all alerts will be send to this endpoint):

$ curl -X POST http://localhost:3000/api/v1/endpoint -d '{"action":"add","url":"https://api.google.com","endpoint":"/api/v1/message/send"}' 

Delete:

$ curl -X POST http://localhost:3000/api/v1/endpoint -d '{"action":"delete","id":"1"}'

Notes:

  • This application is a proof of concept, or a model, it is not meant to be used in production right away, you need to configure the controller mechanism according to your needs.
  • When an alert is send to /api/v1/send endpoint, it will verify if alertname matches with one of the registered endpoints, if it does, it will send the alert to the specific endpoint.
  • If you don't inform the alertname while adding the endpoint, it will send the alert to all the registered endpoints.
Owner
Davi Araújo
Linux SysAdmin / DevOps student
Davi Araújo
Similar Resources

Simple docker container to publish a fixed message to a specified queue. Created to be used with k8s CRON scheduling.

RabbitMQ Publish CRON Simple docker container to publish a fixed message to a specified rabbitmq exchange. Created to be used as part of a Kubernetes

Dec 20, 2021

Messagebus - Simple Message Bus Written in Golang

MessageBus Simple Message Bus Written in Golang How to Use go get gopkg.io/Usada

Apr 21, 2022

🔊Minimalist message bus implementation for internal communication

🔊 Bus Bus is a minimalist event/message bus implementation for internal communication. It is heavily inspired from my event_bus package for Elixir la

Jan 3, 2023

An n:m message multiplexer written in Go

An n:m message multiplexer written in Go

What is Gollum? Gollum is an n:m multiplexer that gathers messages from different sources and broadcasts them to a set of destinations. Gollum origina

Dec 23, 2022

A library for scheduling when to dispatch a message to a channel

gosd go-schedulable-dispatcher (gosd), is a library for scheduling when to dispatch a message to a channel. Implementation The implementation provides

Sep 27, 2022

:incoming_envelope: A fast Message/Event Hub using publish/subscribe pattern with support for topics like* rabbitMQ exchanges for Go applications

Hub 📨 A fast enough Event Hub for go applications using publish/subscribe with support patterns on topics like rabbitMQ exchanges. Table of Contents

Dec 17, 2022

Machinery is an asynchronous task queue/job queue based on distributed message passing.

Machinery is an asynchronous task queue/job queue based on distributed message passing.

Machinery Machinery is an asynchronous task queue/job queue based on distributed message passing. V2 Experiment First Steps Configuration Lock Broker

Jan 7, 2023

GTA(Go Task Async) is a lightweight reliable asynchronous task and transaction message library for Golang

GTA (Go Task Async) is a lightweight and reliable asynchronous task and transaction message library for by golang.

Jun 4, 2022

The Xiaomi message push service is a system-level channel on MIUI and is universal across the platform, which can provide developers with stable, reliable, and efficient push services.

Go-Push-API MiPush、JiPush、UMeng MiPush The Xiaomi message push service is a system-level channel on MIUI and is universal across the platform, which c

Oct 20, 2022
KubeMQ is a Kubernetes native message queue broker

KubeMQ Community is the open-source version of KubeMQ, the Kubernetes native message broker. More about KubeMQ

Nov 20, 2021
May 11, 2023
Simple, high-performance event streaming broker

Styx Styx is a simple and high-performance event streaming broker. It aims to provide teams of all sizes with a simple to operate, disk-persisted publ

Nov 24, 2022
ChanBroker, a Broker for goroutine, is simliar to kafka

Introduction chanbroker, a Broker for goroutine, is simliar to kafka In chanbroker has three types of goroutine: Producer Consumer(Subscriber) Broker

Aug 12, 2021
stratus is a cross-cloud identity broker that allows workloads with an identity issued by one cloud provider to exchange this identity for a workload identity issued by another cloud provider.
stratus is a cross-cloud identity broker that allows workloads with an identity issued by one cloud provider to exchange this identity for a workload identity issued by another cloud provider.

stratus stratus is a cross-cloud identity broker that allows workloads with an identity issued by one cloud provider to exchange this identity for a w

Dec 26, 2021
Tool for collect statistics from AMQP (RabbitMQ) broker. Good for cloud native service calculation.

amqp-statisticator Tool for collect statistics around your AMQP broker. For example RabbitMQ expose a lot information trought the management API, but

Dec 13, 2021
Fetch gas stations prices from Tankerkönig api with Orion Context Broker persistence

tankerkoenig-fuel-machinery - Fetch gas stations from tankerkoenig api and persist them into an Orion Context Broker Scope This project aims to fetch

Feb 14, 2022
go broker interface,you can use kafka,redis,pulsar etc.

broker go broker interface,you can use kafka,redis,pulsar etc. pulsar in docker run pulsar in docker docker run -dit \ --name pulsar-sever \ -p 6650:

Sep 8, 2022
Go simple async message bus
Go simple async message bus

?? message-bus Go simple async message bus. ?? ABOUT Contributors: Rafał Lorenz Want to contribute ? Feel free to send pull requests! Have problems, b

Dec 29, 2022
A single binary, simple, message queue.

MiniQueue A stupid simple, single binary message queue using HTTP/2. Most messaging workloads don't require enormous amounts of data, endless features

Nov 9, 2022