{"id":16408203,"url":"https://github.com/moan0s/alertbot","last_synced_at":"2025-03-23T05:31:26.410Z","repository":{"id":104330726,"uuid":"512645440","full_name":"moan0s/alertbot","owner":"moan0s","description":"A bot that receives a webhook and forwards alerts to a matrix room","archived":false,"fork":false,"pushed_at":"2023-10-02T18:00:56.000Z","size":357,"stargazers_count":20,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-10-02T23:59:26.137Z","etag":null,"topics":["alertmanager","grafana","monitoring","prometheus","webhook"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moan0s.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-07-11T06:45:21.000Z","updated_at":"2023-12-20T16:02:00.054Z","dependencies_parsed_at":"2023-12-20T16:13:24.934Z","dependency_job_id":null,"html_url":"https://github.com/moan0s/alertbot","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moan0s%2Falertbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moan0s%2Falertbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moan0s%2Falertbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moan0s%2Falertbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moan0s","download_url":"https://codeload.github.com/moan0s/alertbot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245061382,"owners_count":20554563,"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":["alertmanager","grafana","monitoring","prometheus","webhook"],"created_at":"2024-10-11T06:16:07.000Z","updated_at":"2025-03-23T05:31:25.896Z","avatar_url":"https://github.com/moan0s.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Alertbot banner](assets/alertbanner.png)\n\n# Alertbot\n\nThis bot uses the webhook functionality of monitoring/alerting solutions like Grafana or Alertmanager to forward alerts to matrix rooms.\nThis means that you no longer have to use E-Mail or Slack to receive alerts. \n\n## Getting Started\n\nYou can either [invite](#invite-the-official-instance) an official instance of the bot, or [self-host](#self-host-an-instance) it on your own matrix server.\n\n## Invite the Official Instance\n\n* Create a Matrix room and invite @alertbot:hyteck.de\n* Send `!url` to the room. The bot will answer with the webhook URL\n* Put the Webhook URL into your monitoring solution (see below)\n\n## Self-host an Instance\n\n**Prerequisites:**\n* A Matrix server where you have access to a maubot instance\n   * Refer to the [docs](https://docs.mau.fi/maubot/usage/setup/index.html) for setting up one\n   * or use [spantaleev/matrix-docker-ansible-deploy](https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/configuring-playbook-bot-matrix-registration-bot.md) which has built-in maubot support\n* An instance of alertmanager or grafana or a similar alerting program that is able to send webhooks\n\n**Build the Bot**\n\nThe bot is built using the maubot command line tool `mbc`, you can either build it locally or remotely.\n\nBuild it locally, and afterwards navigate to the Maubot Administration Interface and upload the .mpb file.\n```shell\npip install maubot\ngit clone https://github.com/moan0s/alertbot\ncd alertbot\nmbc build\n```\n\nIt's possible to upload the build to you maubot instance from the CLI. This is especially helpful when developing.\nFirst login to your instance, then add the `-u` flag to upload after build.\n```shell\nmbc login\nmbc build -u\n```\n\n**Configure the Bot**\n\nNext, once the plugin is installed, set up a [client](https://docs.mau.fi/maubot/usage/basic.html#creating-clients) and then create an [instance](https://docs.mau.fi/maubot/usage/basic.html#creating-instances) which connects the client and plugin. \n\nFinally, invite the bot to an encrypted room where alerts should be sent and query the bot for the room id with the command `!roomid`.\n\n## Setup Alertmanager\n\nThis configuration will send all your alerts to the room `!zOcbWjsWzdREnihgeC:example.com` (if the bot has access to it).\nPut in your own room-id (`!roomid`) behind the webhook base url (`!url`):\n```yaml\n\nreceivers:\n- name: alertbot\n  webhook_configs:\n  - url: https://synapse.hyteck.de/_matrix/maubot/plugin/alertbot/webhook/!zOcbWjsWzdREnihgeC:example.com\nroute:\n  group_by:\n  - alertname\n  - cluster\n  - service\n  group_interval: 5m\n  group_wait: 30s\n  receiver: alertbot\n  repeat_interval: 3h\n\n```\n\n## Setup Grafana\n\nThe grafana setup is fairly simple and can be used to forward grafana alerts to matrix.\n\n![Screenshot of the Grafana Setup](assets/grafana.png)\n\n## Send Test Alerts\n\nUse an example from the `alert_examples/` to test your setup\n```shell\ncurl --header \"Content-Type: application/json\" \\\n  --request POST \\\n  --data \"@alert_examples/prometheus.json\" \\\n  https://webhook.example.com/_matrix/maubot/plugin/maubot/webhook/!zOcbWjsWzdREnihreC:example.com\n```\n\n## Matrix Room\n\nThis project has a dedicated [chat room](https://matrix.to/#/#alertbot:hyteck.de)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoan0s%2Falertbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoan0s%2Falertbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoan0s%2Falertbot/lists"}