Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/balerter/balerter
Script Based Alerting Manager
https://github.com/balerter/balerter
alert alertmanager go golang lua monitoring
Last synced: 4 days ago
JSON representation
Script Based Alerting Manager
- Host: GitHub
- URL: https://github.com/balerter/balerter
- Owner: balerter
- License: mit
- Created: 2019-12-30T09:25:01.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-22T10:24:07.000Z (5 months ago)
- Last Synced: 2024-11-28T23:58:53.192Z (14 days ago)
- Topics: alert, alertmanager, go, golang, lua, monitoring
- Language: Go
- Homepage: https://balerter.com
- Size: 30.5 MB
- Stars: 301
- Watchers: 10
- Forks: 18
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - balerter/balerter - Script Based Alerting Manager (Go)
- awesome-go-extra - balerter - 12-30T09:25:01Z|2022-08-15T10:49:03Z| (Go Tools / DevOps Tools)
README
![GitHub release (latest by date)](https://img.shields.io/github/v/release/balerter/balerter) [![Go Report Card](https://goreportcard.com/badge/github.com/balerter/balerter)](https://goreportcard.com/report/github.com/balerter/balerter) ![Test](https://github.com/balerter/balerter/workflows/Test/badge.svg) [![codecov](https://codecov.io/gh/balerter/balerter/branch/master/graph/badge.svg)](https://codecov.io/gh/balerter/balerter)
![logo.png](logo.png)
> A Project in active development. Features may have breaking changes at any time before v1.0.0 version
- [Telegram Group](https://t.me/balerter)
Balerter is a scripts based alerting system.
In your script you may:
- obtain needed data from different data sources (prometheus, clickhouse, postgres, external HTTP API etc.)
- analyze data and make a decision about alert status
- change Alerts statuses and receive notifications about itIn the example bellow we create one Clickhouse datasource, one scripts source and one alert channel.
In the script we run query to clickhouse, check the value and fire the alert (or switch off it)## Notification channels
- Slack
- Telegram
- Syslog
- Desktop Notify
- Discord
- Webhook
- Prometheus Alertmanager
- Prometheus AlertmanagerReceiver
- Twilio Voice (phone calls)## Datasources
- Clickhouse
- Prometheus
- Postgres
- MySQL
- Loki
- Any external API with `http` lua module> Full documentation available on https://balerter.com
## Example
```shell
docker pull balerter/balerter
``````shell
docker run \
-v /path/to/config.yml:/opt/config.yml \
-v /path/to/scripts:/opt/scripts \
-v /path/to/cert.crt:/home/user/db.crt \
balerter/balerter -config=/opt/config.yml
```Config file `config.yml`
```yaml
scripts:
folder:
- name: debug-folder
path: /opt/scripts
mask: '*.lua'datasources:
clickhouse:
- name: ch1
host: localhost
port: 6440
username: default
password: secret
database: default
sslMode: verified_full
sslCertPath: /home/user/db.crtchannels:
slack:
- name: slack1
url: https://hooks.slack.com/services/hash
```Sample script `rps.lua`
```lua
-- @cron */10 * * * * *
-- @name script1local minRequestsRPS = 100
local log = require("log")
local ch1 = require("datasource.clickhouse.ch1")local res, err = ch1.query("SELECT sum(requests) AS rps FROM some_table WHERE date = now()")
if err ~= nil then
log.error("clickhouse 'ch1' query error: " .. err)
return
endlocal resultRPS = res[1].rps
if resultRPS < minResultRPS then
alert.error("rps-min-limit", "Requests RPS are very small: " .. tostring(resultRPS))
else
alert.success("rps-min-limit", "Requests RPS ok")
end
```Also, you can to write tests!
An example:
```lua
-- @test script1
-- @name script1-testtest = require('test')
local resp = {
{
rps = 10
}
}test.datasource('clickhouse.ch1').on('query', 'SELECT sum(requests) AS rps FROM some_table WHERE date = now()').response(resp)
test.alert().assertCalled('error', 'rps-min-limit', 'Requests RPS are very small: 10')
test.alert().assertNotCalled('success', 'rps-min-limit', 'Requests RPS ok')
```See a documentation on [https://balerter.com](https://balerter.com)