Skip to content

Send this server's alerts to ntfy or a webhook #1196

Backlog

Description

@CG-8663

Before building this, I would like your view on the shape. A working prototype exists (backend and tests, no screen); I can open it as a draft pull request if that helps.

The problem

This server already raises warnings: a joined computer offline, a disk nearly full, a machine running hot, a restart or security updates waiting, failed services. They are only visible with the app open. Someone running a server at home finds out a disk filled up when something breaks.

Proposal

Let the owner choose one place alerts are sent, off by default:

  • ntfy: a topic address (ntfy.sh or their own ntfy server). Plain text, with a title and priority.
  • Webhook: any address. JSON with each alert's id, kind, severity, machine and message.

The alerts are the ones swarm.alerts already produces. Nothing new is measured.

Rules the prototype follows

  • Off until chosen. Nothing leaves the server until the owner sets a destination.
  • Owner only. The address can hold a secret topic or token, so only its host is ever shown back, and the settings file is 0600.
  • https, or home network. http:// is accepted only for a private or loopback address.
  • No redirects. A redirect is refused, not followed.
  • Each alert once. It is sent when it appears and not again while it lasts. A cleared alert can be sent too, if asked for.
  • At most one message a minute, with new alerts batched.
  • A failed send is retried at the next check; the alert is kept until a send works.
  • A Test button sends one message so the owner sees it arrive.
  • Text from a machine can't add headers or lines. Control characters are stripped.

Questions for the maintainers

  1. Where does it live? My guess is Settings, next to Security, as one row: "Send alerts to…". It is a setting of this server, not a machine reading.
  2. Which alerts? The prototype sends warning and critical by default and leaves info (updates waiting) out. Is that the right line?
  3. This server's own readings. swarm.alerts covers joined computers. This server's disk, heat and posture (Machines: this server shows its own restart, failed-service and port readings #1193) would need adding to the same list. Same change or a later one?
  4. One destination or several? The prototype has one. Is that enough to start?
  5. Email. Left out on purpose: it needs an SMTP account and password stored on the server. ntfy and a webhook cover it for people who want email.
  6. MODC Connect. Should alerts ever go out through the Connect tunnel instead? The prototype talks to the address directly.

What the prototype has been through

  • 9 tests against a real HTTP receiver on this machine. Off by default, once-only sending, the one-a-minute limit, cleared alerts, retry after a failure, a refused redirect, address checks, header injection, and a damaged settings file.
  • A live run through a real backend over HTTP: signed out is refused (401), the owner sets an ntfy address, presses Test, and the message arrives at the receiver.
  • Not built: any screen. Not tested: against the real ntfy.sh, or on an Omarchy machine.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions