Alertmanager bot for matrix.
  • JavaScript 99.2%
  • Dockerfile 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Owentje 1fc24e3cba Update dependency eslint to v10.15.0 (#36)
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [eslint](https://eslint.org) ([source](https://github.com/eslint/eslint)) | [`10.14.0` → `10.15.0`](https://renovatebot.com/diffs/npm/eslint/10.14.0/10.15.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/eslint/10.15.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/eslint/10.14.0/10.15.0?slim=true) |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/35) for more information.

---

### Release Notes

<details>
<summary>eslint/eslint (eslint)</summary>

### [`v10.15.0`](https://github.com/eslint/eslint/releases/tag/v10.15.0)

[Compare Source](https://github.com/eslint/eslint/compare/v10.14.0...v10.15.0)

#### Features

- [`ec52157`](ec52157ec2) feat: check **proto** and assignment targets in `func-names` ([#&#8203;21521](https://github.com/eslint/eslint/issues/21521)) (Lê Văn Xuân Hoàn)
- [`34a8b1b`](34a8b1b978) feat: recognize string and computed keys in `accessor-pairs` descriptors ([#&#8203;21519](https://github.com/eslint/eslint/issues/21519)) (Lê Văn Xuân Hoàn)
- [`663c825`](663c825cef) feat: handle TS type assertions in `no-invalid-this` ([#&#8203;21464](https://github.com/eslint/eslint/issues/21464)) (Valentin)
- [`4941015`](4941015b27) feat: check individual specifier importKind in `no-shadow` ([#&#8203;21518](https://github.com/eslint/eslint/issues/21518)) (Lê Văn Xuân Hoàn)
- [`17f17cd`](17f17cd7a2) feat: update error location to head for `default-case` ([#&#8203;21469](https://github.com/eslint/eslint/issues/21469)) (Tanuj Kanti)

#### Bug Fixes

- [`23ac66c`](23ac66c0d9) fix: update dependency [@&#8203;eslint/config-array](https://github.com/eslint/config-array) to ^0.23.6 ([#&#8203;21550](https://github.com/eslint/eslint/issues/21550)) (renovate\[bot])
- [`df71e34`](df71e34a8b) fix: skip `no-prototype-builtins` suggestion when object is `super` ([#&#8203;21535](https://github.com/eslint/eslint/issues/21535)) (KooYS)
- [`899065e`](899065e556) fix: preserve inline `type` modifier in `no-useless-rename` autofix ([#&#8203;21527](https://github.com/eslint/eslint/issues/21527)) (sethamus)
- [`af4c3a9`](af4c3a9cc7) fix: preserve TypeScript type parameters in `prefer-arrow-callback` ([#&#8203;21507](https://github.com/eslint/eslint/issues/21507)) (Lê Văn Xuân Hoàn)
- [`b11bcb3`](b11bcb3675) fix: preserve necessary parens in `no-unneeded-ternary` autofix ([#&#8203;21495](https://github.com/eslint/eslint/issues/21495)) (Lê Văn Xuân Hoàn)
- [`7c7292e`](7c7292ef44) fix: require `minimatch@11.0.1` or higher to avoid CVE-2026-118764 ([#&#8203;21492](https://github.com/eslint/eslint/issues/21492)) (nikolawork)

#### Documentation

- [`16eb1d9`](16eb1d9eff) docs: remove Contributor Pool reference ([#&#8203;21539](https://github.com/eslint/eslint/issues/21539)) (Nicholas C. Zakas)
- [`e368730`](e36873082f) docs: discourage non-serializable values in rule options ([#&#8203;21487](https://github.com/eslint/eslint/issues/21487)) (Vitalii Maslianok)
- [`0146008`](0146008d6e) docs: revamp code path analysis docs ([#&#8203;21423](https://github.com/eslint/eslint/issues/21423)) (xbinaryx)
- [`aeb2267`](aeb2267895) docs: revise AI acknowledgment options in templates ([#&#8203;21489](https://github.com/eslint/eslint/issues/21489)) (lumir)
- [`e47a477`](e47a47725b) docs: Update README (GitHub Actions Bot)
- [`11c66ba`](11c66ba083) docs: fix typo in custom rules documentation ([#&#8203;21472](https://github.com/eslint/eslint/issues/21472)) (Pixel)

#### Chores

- [`480afad`](480afad6e7) chore: update github/codeql-action action to v4.39.3 ([#&#8203;21533](https://github.com/eslint/eslint/issues/21533)) (renovate\[bot])
- [`fc3a99b`](fc3a99b198) chore: update ecosystem plugins ([#&#8203;21511](https://github.com/eslint/eslint/issues/21511)) (ESLint Bot)
- [`8fe3ab9`](8fe3ab9d9f) chore: replace `got` with Node.js native `fetch` ([#&#8203;21505](https://github.com/eslint/eslint/issues/21505)) (lumir)
- [`bdd4b1d`](bdd4b1da21) ci: bump pnpm/action-setup from 6.1.0 to 6.1.1 ([#&#8203;21499](https://github.com/eslint/eslint/issues/21499)) (dependabot\[bot])
- [`36db635`](36db63560d) ci: bump github/codeql-action from 4.39.1 to 4.39.2 ([#&#8203;21500](https://github.com/eslint/eslint/issues/21500)) (dependabot\[bot])
- [`19211b3`](19211b3271) chore: replace `fs-teardown` with Node.js native APIs ([#&#8203;21488](https://github.com/eslint/eslint/issues/21488)) (lumir)
- [`bbede5e`](bbede5e5f2) chore: enforce `require-meta-docs-recommended` ([#&#8203;21496](https://github.com/eslint/eslint/issues/21496)) (lumir)
- [`896b8ad`](896b8ad4f2) chore: update ecosystem plugins ([#&#8203;21478](https://github.com/eslint/eslint/issues/21478)) (ESLint Bot)
- [`35801a2`](35801a2be2) ci: re-enable `eslint-plugin-unicorn` ecosystem test ([#&#8203;21470](https://github.com/eslint/eslint/issues/21470)) (Francesco Trotta)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODguMCIsInVwZGF0ZWRJblZlciI6IjQzLjI4OC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Reviewed-on: #36
Reviewed-by: JesseBot <jessebot@noreply.git.open.engineering>
2026-11-14 09:52:10 +00:00
.forgejo this is me trying to wriggle out of lettering a typescript linter tell me what to do (#34) 2026-11-13 11:33:26 +00:00
src log what rooms we're joined to 2026-11-13 14:02:02 +01:00
tests Update deps and add a bit more logic from upstream (#32) 2026-11-13 10:43:47 +00:00
.dockerignore Reorganize code under src directory 2018-12-16 21:12:33 +02:00
.env.default Formatting release: use description for summary; allow greater control over HEX codes used for colors of message text; clean up styling and duplicate info (#15) 2024-07-16 09:57:38 +02:00
.eslintrc.js Reorganize code under src directory 2018-12-16 21:12:33 +02:00
.gitignore I have done so much to please the npm gods and I never use AI, please grant me one blessing 2026-11-13 13:44:50 +01:00
.node-version Update deps and add a bit more logic from upstream (#32) 2026-11-13 10:43:47 +00:00
CHANGELOG.md Release v0.5.0 2021-09-23 22:44:15 +03:00
Dockerfile Update deps and add a bit more logic from upstream (#32) 2026-11-13 10:43:47 +00:00
LICENSE Add setting display name and avatar feature (#6) 2024-07-14 11:28:10 +02:00
package-lock.json Update dependency eslint to v10.15.0 (#36) 2026-11-14 09:52:10 +00:00
package.json log what rooms we're joined to 2026-11-13 14:02:02 +01:00
README.md update the readme to reflect the latest stuff we've done 2026-11-13 11:20:23 +00:00
renovate.json Add renovate.json (#7) 2024-07-15 13:51:49 +02:00

Matrix-Alertmanager

A bot to receive Prometheus Alertmanager webhook events and forward them to chosen matrix rooms. Screenshot of matrix markdown formatted alertmanager bot with collapsed short description of alert

Click me to see what the alerts look like when they're not collapsed Screenshot of matrix markdown formatted alertmanager bot with expanded info on each alert

Main features

  • Uses pre-created Matrix user to send alerts using token auth
  • Configurable room per alert receiver
  • Automatic joining of configured rooms. Private rooms require an invite
  • Secret key authentication with Alertmanager
  • 🎨 HTML formatted messages
    • You can now choose the text colors for each severity too!
  • Optionally mentions @room on firing alerts
  • Optionally set the bot user's display name and avatar

How to use

Running the bot in a Docker container

We host a docker image that builds nightly here: openengineering/matrix-alertmanager. Nightly builds are tagged with main. Checkout out .env.default for the possible env vars to pass in.

Registering the Application Service with matrix

Matrix has a concept of application services (often called an appservice), for bot services/users. To register this bot as an application service, you need to create a registration yaml file, such as alertmanager.yaml that's accessible locally to your matrix homeserver (such as synapse), and it should have the following contents:

# A unique, user-defined ID of the application service which will never change.
id: alertmanager
# The URL for the application service. May include a path after the domain name.
# Optionally set to null if no traffic is required.
# this is an example but it can be whatever URL and port you host this bot at
url: http://matrix-stack-bridge-alertmanager:3000
#  Whether requests from masqueraded users are rate-limited. The sender is excluded.
rate_limited: false
# The localpart of the user associated with the application service.
# Events will be sent to the AS if this user is the target of the event, or is a
# joined member of the room where the event occurred.
sender_localpart: alertmanager
# A secret token that the application service will use to authenticate requests to the homeserver.
as_token: "soemthingverysecurebutdefinitelynotthisexactstringuseyourbestjudgementwitharandomgenerator"
# A secret token that the homeserver will use authenticate requests to the application service.
hs_token: "soemthingelseverysecurebutdefinitelynotthisexactstringuseyourbestjudgementwitharandomgenerator"
# The namespaces that the application service is interested in.
# https://spec.matrix.org/v1.11/application-service-api/#definition-registration_namespaces
namespaces:
  # https://spec.matrix.org/v1.11/application-service-api/#definition-registration_namespace
  users:
    - exclusive: true
      regex: "^@alertmanager.*:mymatrix.server.tld$"
    - exclusive: true
      regex: "^@:mymatrix.server.tld$"

Then, in your homeserver.yaml, you need to include reference to the above registration yaml file, so for example, if you saved that file to /bridges/alertmanager.yaml, you'd add the following to your homeserver config:

# A list of application service config files to use
app_service_config_files:
  - "/bridges/alertmanager.yaml"

Setting up Alertmanager

You will need to configure a webhook receiver in Alertmanager. It should looks something like this:

receivers:
- name: 'myreceiver'
  webhook_configs:
  - url: 'https://my-matrix-alertmanager.tld/alerts?secret=veryverysecretkeyhere'

The secret key obviously should match the one in the alertmanager configuration.

Styling Prometheus rules

Add some styling to your prometheus rules

rules:
- alert: High Memory Usage of Container
  annotations:
    description: Container named <strong>{{\$labels.container_name}}</strong> in <strong>{{\$labels.pod_name}}</strong> in <strong>{{\$labels.namespace}}</strong> is using more than 75% of Memory Limit
  expr: |
    ((( sum(container_memory_usage_bytes{image!=\"\",container_name!=\"POD\", namespace!=\"kube-system\"}) by (namespace,container_name,pod_name, instance)  / sum(container_spec_memory_limit_bytes{image!=\"\",container_name!=\"POD\",namespace!=\"kube-system\"}) by (namespace,container_name,pod_name, instance) ) * 100 ) < +Inf ) > 75
  for: 5m
  labels:
    team: dev

NOTE! Currently the bot cannot talk HTTPS, so you need to have a reverse proxy in place to terminate SSL, or use unsecure unencrypted connections.

Running in Kubernetes

oeng/matrix-chart is a matrix stack for Kubernetes that includes this bot. In your values.yaml include:

bridges:
  alertmanager:
    enabled: true
    image:
      # -- alertmanager bridge docker image
      repository: "jessebot/matrix-alertmanager-bot"
      # -- alertmanager bridge docker image tag
      tag: "0.11.0"
      # -- alertmanager bridge docker image pull policy. If tag is "latest", set tag to "Always"
      pullPolicy: IfNotPresent

    service:
      # -- service type for the alertmanager bridge
      type: ClusterIP

    # -- alertmanager bridge pod replicas
    replicaCount: 1

    # -- set the revisionHistoryLimit to decide how many replicaSets are
    # kept when you change a deployment. Explicitly setting this field to 0,
    # will result in cleaning up all the history of your Deployment thus that
    # Deployment will not be able to roll back.
    revisionHistoryLimit: 2

    existingSecret:
      registration: ""

    # this section is for registering the application service with matrix
    # read more about application services here:
    # https://spec.matrix.org/v1.11/application-service-api/
    registration:
      # -- name of the application service
      id: "alertmanager"
      # -- url of the alertmanager service. if not provided, we will template it
      # for you like http://matrix-alertmanager-service:3000
      url: ""
      # -- should this bot be rate limited?
      rate_limited: false
      # -- localpart of the user associated with the application service.
      # Events will be sent to the AS if this user is the target of the event,
      # or is a joined member of the room where the event occurred.
      sender_localpart: "alertmanager"
      # A secret token that the application service will use to authenticate
      # requests to the homeserver.
      as_token: ""
      # -- Use an existing Kubernetes Secret to store your own generated appservice
      # and homeserver tokens. If this is not set, we'll generate them for you.
      # Setting this won't override the ENTIRE registration.yaml we generate for
      # the synapse pod to authenticate mautrix/discord. It will only replaces the tokens.
      # To replaces the ENTIRE registration.yaml, use
      # bridges.alertmanager.existingSecret.registration
      existingSecret: ""
      existingSecretKeys:
        # -- key in existingSecret for as_token (application service token). If
        # provided and existingSecret is set, ignores bridges.alertmanager.registration.as_token
        as_token: "as_token"
        # -- key in existingSecret for hs_token (home server token)
        hs_token: "hs_token"

    encryption: false

    config:
      # -- appservice port?
      app_port: 3000
      # -- secret key for the webhook events, I don't know what this is
      app_alertmanager_secret: ""
      # -- your homeserver url, e.g. https://homeserver.tld
      homeserver_url: ""

      bot:
        # -- user in matrix for the the alertmanager bot e.g. alertmanager
        # which becomes @alertmanager:homeserver.tld
        user: ""
        # -- optional: display name to set for the bot user
        display_name: ""
        # -- optional: mxc:// avatar to set for the bot user
        avatar_url: ""
        # -- rooms to send alerts to, separated by a |
        # Each entry contains the receiver name (from alertmanager) and the
        # internal id (not the public alias) of the Matrix channel to forward to.
        rooms: ""
        # -- Set this to true to make firing alerts do a `@room` mention.
        # NOTE! Bot should also have enough power in the room for this to be useful.
        mention_room: false

      # -- set to enable Grafana links, e.g. https://grafana.example.com
      grafana_url: ""
      # -- grafana data source, e.g. default
      grafana_datasource: ""
      # -- set to enable silence link, e.g. https://alertmanager.example.com
      alertmanager_url: ""

Tech

  • Node 26
  • Express
  • Matrix JS SDK

Authors and Maintainers

This project was originally created by Jason Robinson at jaywink/matrix-alertmanager, and then it was forked by beeper/matrix-alertmanager but they didn't add their own copyright notice, and then finally we, @open-engineering, forked it as well and it's now maintained by us.

We'll try to also create some PRs to update the other codebases as well :)

License

MIT