{"id":13582089,"url":"https://github.com/balerter/balerter","last_synced_at":"2025-04-06T06:10:21.795Z","repository":{"id":39752024,"uuid":"230886499","full_name":"balerter/balerter","owner":"balerter","description":"Script Based Alerting Manager","archived":false,"fork":false,"pushed_at":"2024-07-22T10:24:07.000Z","size":32014,"stargazers_count":303,"open_issues_count":5,"forks_count":18,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-30T04:09:47.414Z","etag":null,"topics":["alert","alertmanager","go","golang","lua","monitoring"],"latest_commit_sha":null,"homepage":"https://balerter.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/balerter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-30T09:25:01.000Z","updated_at":"2025-03-12T09:22:45.000Z","dependencies_parsed_at":"2024-10-23T13:58:09.643Z","dependency_job_id":null,"html_url":"https://github.com/balerter/balerter","commit_stats":{"total_commits":700,"total_committers":5,"mean_commits":140.0,"dds":0.05428571428571427,"last_synced_commit":"1a5fcfd9b30ed274cc29fbab0a949fde2b2c339d"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balerter%2Fbalerter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balerter%2Fbalerter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balerter%2Fbalerter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balerter%2Fbalerter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/balerter","download_url":"https://codeload.github.com/balerter/balerter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441053,"owners_count":20939239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alert","alertmanager","go","golang","lua","monitoring"],"created_at":"2024-08-01T15:02:25.412Z","updated_at":"2025-04-06T06:10:21.773Z","avatar_url":"https://github.com/balerter.png","language":"Go","funding_links":[],"categories":["Go","Software Packages","软件包","Go Tools","DevOps Tools"],"sub_categories":["DevOps Tools","DevOps 工具"],"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) \n\n![logo.png](logo.png)\n\n\u003e A Project in active development. Features may have breaking changes at any time before v1.0.0 version \n\n- [Telegram Group](https://t.me/balerter)\n\nBalerter is a scripts based alerting system.\n\nIn your script you may:\n- obtain needed data from different data sources (prometheus, clickhouse, postgres, external HTTP API etc.)\n- analyze data and make a decision about alert status\n- change Alerts statuses and receive notifications about it \n\nIn the example bellow we create one Clickhouse datasource, one scripts source and one alert channel.\nIn the script we run query to clickhouse, check the value and fire the alert (or switch off it)   \n\n## Notification channels\n\n- Slack\n- Telegram\n- Syslog\n- Desktop Notify\n- Email\n- Discord\n- Webhook\n- Prometheus Alertmanager\n- Prometheus AlertmanagerReceiver\n- Twilio Voice (phone calls)\n\n## Datasources\n\n- Clickhouse\n- Prometheus\n- Postgres\n- MySQL\n- Loki\n- Any external API with `http` lua module\n\n\u003e Full documentation available on https://balerter.com\n\n## Example\n\n```shell\ndocker pull balerter/balerter\n```\n\n```shell\ndocker run \\\n    -v /path/to/config.yml:/opt/config.yml \\\n    -v /path/to/scripts:/opt/scripts \\ \n    -v /path/to/cert.crt:/home/user/db.crt \\\n    balerter/balerter -config=/opt/config.yml\n```\n\nConfig file `config.yml`\n\n```yaml\nscripts:\n  folder:\n    - name: debug-folder\n      path: /opt/scripts\n      mask: '*.lua'\n\ndatasources:\n  clickhouse:\n    - name: ch1\n      host: localhost\n      port: 6440\n      username: default\n      password: secret\n      database: default\n      sslMode: verified_full\n      sslCertPath: /home/user/db.crt\n\nchannels:\n  slack:\n    - name: slack1\n      url: https://hooks.slack.com/services/hash\n```\n\nSample script `rps.lua`\n\n```lua\n-- @cron */10 * * * * *\n-- @name script1\n\nlocal minRequestsRPS = 100\n\nlocal log = require(\"log\")\nlocal ch1 = require(\"datasource.clickhouse.ch1\")\n\nlocal res, err = ch1.query(\"SELECT sum(requests) AS rps FROM some_table WHERE date = now()\")\nif err ~= nil then\n    log.error(\"clickhouse 'ch1' query error: \" .. err)\n    return\nend\n\nlocal resultRPS = res[1].rps\n\nif resultRPS \u003c minResultRPS then\n    alert.error(\"rps-min-limit\", \"Requests RPS are very small: \" .. tostring(resultRPS))\nelse\n    alert.success(\"rps-min-limit\", \"Requests RPS ok\")\nend \n```\n\nAlso, you can to write tests!\n\nAn example:\n\n```lua\n-- @test script1\n-- @name script1-test\n\ntest = require('test')\n\nlocal resp = {\n    {\n        rps = 10\n    }\n} \n\ntest.datasource('clickhouse.ch1').on('query', 'SELECT sum(requests) AS rps FROM some_table WHERE date = now()').response(resp)\n\ntest.alert().assertCalled('error', 'rps-min-limit', 'Requests RPS are very small: 10')\ntest.alert().assertNotCalled('success', 'rps-min-limit', 'Requests RPS ok')\n```\n\nSee a documentation on [https://balerter.com](https://balerter.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalerter%2Fbalerter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalerter%2Fbalerter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalerter%2Fbalerter/lists"}