Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yukitsune/minialert
A lightweight prometheus alerts manager that publishes alerts via a Discord bot
https://github.com/yukitsune/minialert
alertmanager dicsord prometheus
Last synced: 24 days ago
JSON representation
A lightweight prometheus alerts manager that publishes alerts via a Discord bot
- Host: GitHub
- URL: https://github.com/yukitsune/minialert
- Owner: YuKitsune
- License: agpl-3.0
- Created: 2022-08-09T15:23:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-25T11:10:21.000Z (almost 2 years ago)
- Last Synced: 2024-11-07T14:27:45.704Z (3 months ago)
- Topics: alertmanager, dicsord, prometheus
- Language: Go
- Homepage:
- Size: 388 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Minialert
A lightweight Prometheus alert manager.Designed as an alternative to Alertmanager.
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/yukitsune/minialert/ci.yml?branch=main)](https://github.com/YuKitsune/minialert/actions/workflows/ci.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/yukitsune/minialert)](https://goreportcard.com/report/github.com/yukitsune/minialert)
[![License](https://img.shields.io/github/license/YuKitsune/minialert)](https://github.com/YuKitsune/minialert/blob/main/LICENSE)
[![Latest Release](https://img.shields.io/github/v/release/YuKitsune/minialert?include_prereleases)](https://github.com/YuKitsune/minialert/releases)
[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/yukitsune/minialert)](https://pkg.go.dev/mod/github.com/yukitsune/minialert)
# Installation
## Docker
The easiest way to run Minialert is via [Docker](https://www.docker.com).
```shell
docker run \
--name minialert \
-e MINIALERT_DATABASE_URI=mongodb://username:password@host:27017
-e MINIALERT_DATABASE_NAME=minialert \
ghcr.io/yukitsune/minialert:latest
```## Compiling from Source
Minialert can be compiled from source by running the following command:
```shell
# Using make
make build# Without make
mkdir -p bin
go build -o ./bin/ ./cmd/...
```# Configuration
Minialert can be configured using a yaml config file, or environment variables.
By default, minialert will check for a `minialert.yaml` file in the current working directory, or `/etc/minialert/`.A config file can be specified manually using the `--config` flag. Example:
```shell
minialert run --config ./somewhere/else/custom-config.yaml
```Here is an example config file, along with corresponding environment variables.
```yaml
database:# The MongoDB URI.
# MINIALERT_DATABASE_URI
uri:# The name of the database to use.
# MINIALERT_DATABASE_NAME
name:# Whether or not to use an in-memory database.
# Note: All data will be lost after the program has exited.
# MINIALERT_DATABASE_INMEMORY
inMemory: falsebot:
# The bot token.
# MINIALERT_BOT_TOKEN
token:# The client ID.
# MINIALERT_BOT_CLIENTID
clientId:# The permissions integer represented as a string.
# Discord provides resources to help determine the permissions number:
# https://discord.com/developers/docs/topics/community-resources#permission-calculators
# MINIALERT_BOT_PERMISSIONS
permissions:# (Optional) The list of scopes which the bot requires.
# Defaults to "bot", "application.commands".
# MINIALERT_BOT_SCOPES
scopes:
- bot
- applications.commandslog:
# (Optional) The level of logging.
# Defaults to "info"
# MINIALERT_LOG_LEVEL
level: info```
# Setup
When the bot starts, an invite link is written to the logs.
Once the bot has joined a server, a scrape config needs to be created. This can be done using the `/create-scrape-config` command.Once the scrape config is created, minialert will begin scraping using the given config.
Multiple scrape configs can be specified. A separate goroutine is created for each scrape config, allowing the bot to scrape multiple endpoints at once.Scrape configs can be updated using `/update-scrape-config`, and removed using `/remove-scrape-config`.
`/get-alerts` can be used to get all currently firing alerts for a particular scrape config.
# Contributing
Contributions are what make the open source community such an amazing place to be, learn, inspire, and create.
Any contributions are **greatly appreciated**!