beacon

module
v0.3.0-rc.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: Apache-2.0

README

Self-hosted monitoring and SSH access for people and their AI agents.

CI Release

English | 简体中文 · Documentation: beacon.openlinkos.com

Beacon checks your websites and services from several places at once, the way your users reach them, and says why a check fails: DNS, connection, TLS, timeout, status code. When a service goes down, it wakes your AI agent (Claude Code, Codex, or anything that speaks MCP or HTTP) and hands it the evidence in one call: what every location sees, what changed just before, what has already been done. The agent logs in to your servers through Beacon with its own ssh, or with Beacon's tools for running commands and editing files, fixes what it can, has every location check again, and leaves a note on the alert. It never holds a password or a private key, and every command it runs is recorded and can be replayed in a browser. Your users see a status page; the people on call get a card in Feishu and, when nobody answers, a call on their phone.

People use the same console to take over an alert, set up services, plan maintenance and control agent access. They can connect to a machine in their own terminal, with sessions recorded under their own account. An optional team credential store gives owners and agents audited use of service tokens for fixed HTTPS requests.

Status: early (0.3, release candidates). Probing, alert routing, Feishu cards and phone escalation, the SSH channel with its recordings, waking agents, evidence, probing on demand, the console and public status pages work end to end, and run the makers' own servers. Until 1.0 the configuration may change between minor versions; the changelog says what to do when it does.

Why

AI coding agents are already good at operations work: reading logs, finding the wrong line in a configuration, restarting the right service. What keeps people from letting them do it is everything around the work.

  • The agent does not know that something broke. Monitoring tools page people and draw dashboards. An agent hears of an outage only when someone pastes the alert into a chat, and then has to guess what the probes saw.
  • To touch a server, it needs your keys. The usual way is to give the agent your SSH key or a root password. From then on it can reach every machine they open, from anywhere, and nothing records what it ran.
  • Afterwards, nobody can tell what happened. The agent's commands scrolled past in a terminal nobody was watching. Reviewing them means asking the agent, which remembers nothing between sessions.

People and agents share the same operations:

  • Checked from where your users are. A probe of under 20 MB, on any small machine, checks HTTP, TLS, TCP, container registries, Git and domain expiry, and records why each check failed. A service is down only when several locations agree, so one location's bad network wakes nobody.
  • The agent is woken with the evidence. A signed webhook or a GitHub workflow wakes the agent you choose. One call, get_evidence, returns each location's result, the other alerts in the same failure domain, the deployments just before, and what people and agents have done so far.
  • Server access without handing over keys. Agents use their own ssh, scp and rsync through Beacon, or its MCP tools. Beacon signs a certificate valid for five minutes for each connection, and your servers trust only Beacon. Revoke one agent, or stop them all with one switch.
  • Every command on record. Sessions are recorded and replay in the browser, interactive shells are split into commands with their exit codes, and the agent's notes land on the alert. You review what was done afterwards instead of approving each step in advance.
  • Fixed means checked again. After a fix the agent asks every location to probe the service at once (probe_now) and sees their answers within a minute.
  • People stay in the loop. A public status page for your users, a console for your team, alert cards in Feishu that can be acknowledged and silenced, and escalation to phones through Pushover when nobody answers.
  • Small, and yours. One Go service and one probe binary, on VictoriaMetrics; a machine with 2 CPUs and 4 GB is plenty. Apache-2.0. Beacon calls no model and needs no cloud account.

Features

  • MCP server at /mcp with 46 tools: alerts (list_alerts, get_alert, ack_alert, silence_alert, …), working an alert (get_evidence, get_timeline, add_note, list_changes, probe_now), machines (list_machines, update_machine, run_command, read_file, write_file, edit_file, list_sessions, get_session, …), maintenance and status pages, the configuration, people and the agent's own SSH keys (list_users, invite_user, create_agent, update_agent, add_ssh_key, …), and the agent's own token (whoami, renew_token). Claude Code and Codex sign in to it through the browser, with MCP's OAuth. Every tool has the same REST route under /api/v1.
  • The SSH channel on port 17002: ssh, scp, sftp, rsync and ssh -L to any enrolled machine, the user name naming the machine, also machines behind NAT that connect out with plain ssh -R.
  • Probes (beacon-probe): Blackbox-compatible checks with failure reasons, host metrics and heartbeats, pushed through a queue on disk when the network is down; targets and modules come from the centre, so changing what is checked needs no redeployment.
  • Alerting without Alertmanager: grouping, inhibition, silences and a dead man's switch inside the service; vmalert posts its alerts to Beacon as it would to Alertmanager.
  • Feishu cards that change in place: what is wrong, since when, which locations fail and why, the agent's notes; buttons to acknowledge and silence; escalation to the Feishu app's urgent notice and to Pushover's emergency priority.
  • Waking agents: signed webhooks and GitHub workflow dispatches for new alert groups, and beacon-oncall, a small harness that verifies the webhook and starts the agent program you name (wrappers for Claude Code and Codex included).
  • Public status pages served by Beacon itself: components from the probe targets, 90 days of history, incidents from the alerts, maintenance windows, JSON, an Atom feed and badges.
  • The console at /console (the site's root is the public status page): alerts with their evidence and timeline, machines, every session with its replay, people and their agents with their tokens, OAuth sign-ins and keys, the configuration and its history, the audit log.
  • Configuration through Beacon: probe locations, targets, modules and status pages live in its database, changed through the API, MCP or the command line, every change a version that can be reverted; files are for import and export, so they can stay in git.

Works with

Agent Connects over Can be woken by Beacon
Claude Code MCP over HTTP, its own ssh Yes, with beacon-oncall (headless) or a GitHub workflow
Codex CLI MCP over HTTP, its own ssh Yes, with beacon-oncall
Any MCP client MCP over HTTP Yes, with a webhook
Bots and scripts REST and ssh Yes, with a webhook

Beacon calls no model: what to do about an alert is the agent's decision, and every agent is welcome. See Put an agent on call.

Getting started

Try it first, in ten minutes on the machine in front of you: Docker, one command, no domain and no certificate.

git clone https://github.com/openlinkos/beacon.git && cd beacon/deploy/try
sh up.sh

up.sh starts five containers — Beacon, VictoriaMetrics, vmalert, one probe location and a demo machine — and prints the one-time link that makes the first account. Try it on your laptop walks through the rest: connect Claude Code, break the demo service, and watch an agent repair it through the SSH channel while everything it runs is recorded.

For production: a Linux machine with 2 CPUs and 4 GB of memory, Docker with Compose v2, and two DNS names pointing at it.

git clone https://github.com/openlinkos/beacon.git
sudo cp -r beacon/deploy /opt/beacon && cd /opt/beacon
sudo ./install.sh        # asks for the two host names and an e-mail address for the certificates

install.sh generates the secrets, validates every file, starts Beacon, VictoriaMetrics, vmalert and Caddy, and prints what to do next. On a server walks through the rest: the first probe, the first machine, the first agent, and a rehearsed outage from alert to recovery.

Connect Claude Code

docker exec beacon beacon setup    # a one-time link: open it and choose your username and password
claude mcp add --scope user --transport http beacon https://status.example.com/mcp

Then run /mcp in Claude Code and sign in through the browser: Beacon asks you to allow Claude Code as one of your agents, with what it may do and for how long, and no token is copied anywhere. Then ask, in any session: "Is anything failing right now? Look at the evidence, check the machine, and tell me what you would do." The agent answers from get_evidence and the machine itself, and everything it ran is in the console under Sessions. An agent without a browser takes a token instead: docker exec beacon beacon agent add oncall-bot -owner alice -preset oncall.

Documentation

The documentation lives in docs/ and is published at beacon.openlinkos.com:

How it works

beacon-probe (each location) ──results──▶ gateway ──▶ VictoriaMetrics ◀── vmalert (rules)
CI, Flux ──change events──▶ gateway                                          │ alerts
                                                                             ▼
people ◀── Feishu cards, phones, status page ◀── beacon (router, bridge) ──▶ agents' webhooks
agents ──▶ MCP and REST (evidence, notes, probe_now) ──▶ beacon
agents ──▶ ssh, scp, rsync (port 17002) ──▶ SSH channel ──▶ your servers (5-minute certificates, every session recorded)

One service, beacon, holds the gateway for machines, the alert router, the bridge to people and agents, the API and MCP, the console and status pages, and the SSH channel; its state is one SQLite database, with the session recordings beside it. Metrics and rules stay in VictoriaMetrics and vmalert. Architecture has the parts.

Security

Agents never see a password or a private key: the SSH channel signs a short-lived certificate for every connection and the machines trust only its certificate authority. People sign in with Beacon's own accounts, their passwords kept as argon2id hashes; there is no external sign-in. An agent acts for a person and never does more than that person's role allows, checked on every request. Tokens are stored as SHA-256 hashes, carry scopes and expire; each probe and host can write only as itself. Everything an agent does is audited and echoed to the alert chat. Secrets are read from files and never logged. Report vulnerabilities as SECURITY.md describes.

Contributing

Issues and pull requests are welcome; CONTRIBUTING.md explains how to build, test and propose a change, and AGENTS.md is the guide for AI agents working on the code.

Licence

Apache License 2.0. The LinkOS and OpenLinkOS names and marks are not covered by it.

Beacon is named after the beacon towers of the Great Wall: when a watch post saw trouble it lit a fire, the signal ran from tower to tower to the capital, and the number of fires told how serious it was.

Directories

Path Synopsis
cmd
beacon command
Command beacon is Beacon's service: monitoring with alert delivery on Feishu and phones, the SSH channel through which agents reach machines, a REST API and an MCP server.
Command beacon is Beacon's service: monitoring with alert delivery on Feishu and phones, the SSH channel through which agents reach machines, a REST API and an MCP server.
beacon-oncall command
Command beacon-oncall is the reference harness that runs an agent when Beacon wakes it.
Command beacon-oncall is the reference harness that runs an agent when Beacon wakes it.
beacon-probe command
Command beacon-probe is the probe agent: it checks targets for the status service (like the Blackbox Exporter, with the same metric names, plus a failure reason and multi-step checks) and reports a few host metrics (like a small Node Exporter).
Command beacon-probe is the probe agent: it checks targets for the status service (like the Blackbox Exporter, with the same metric names, plus a failure reason and multi-step checks) and reports a few host metrics (like a small Node Exporter).
internal
agent
Package agent is beacon-probe's push mode, the whole probe agent in one process: every interval it fetches what to check from the gateway (its targets and the module file, cached on disk for when the gateway cannot be reached), probes every target, reads the host's metrics and heartbeats, and pushes it all to the gateway in the Prometheus text format with timestamps.
Package agent is beacon-probe's push mode, the whole probe agent in one process: every interval it fetches what to check from the gateway (its targets and the module file, cached on disk for when the gateway cannot be reached), probes every target, reads the host's metrics and heartbeats, and pushes it all to the gateway in the Prometheus text format with timestamps.
alertmanager
Package alertmanager holds alerts, alert groups and silences in Alertmanager's formats.
Package alertmanager holds alerts, alert groups and silences in Alertmanager's formats.
api
Package api is the REST API under /api/v1.
Package api is the REST API under /api/v1.
bridge
Package bridge closes the loop between the alerts and the people on call.
Package bridge closes the loop between the alerts and the people on call.
catalog
Package catalog is what is monitored and where from: the probe locations, the heartbeats that jobs must send, and the resources (servers, domains, certificates, tokens) whose expiry dates are watched; and what the public status pages show of it (status.go).
Package catalog is what is monitored and where from: the probe locations, the heartbeats that jobs must send, and the resources (servers, domains, certificates, tokens) whose expiry dates are watched; and what the public status pages show of it (status.go).
clientip
Package clientip extracts the client's real IP from a request.
Package clientip extracts the client's real IP from a request.
config
Package config loads the service configuration (YAML) and the secrets it names.
Package config loads the service configuration (YAML) and the secrets it names.
configdb
Package configdb keeps what Beacon monitors in its database: the catalogue (probe locations, heartbeats, expiring resources), the probe targets in named sets that keep the meaning of the file names they came from (all-, overseas-, mainland-, <location>-), and the probe module file.
Package configdb keeps what Beacon monitors in its database: the catalogue (probe locations, heartbeats, expiring resources), the probe targets in named sets that keep the meaning of the file names they came from (all-, overseas-, mainland-, <location>-), and the probe module file.
ctl
Package ctl is the local admin socket: a small HTTP API on a Unix socket in the data directory, so that `beacon token …`, `machine …`, `ssh …`, `config …` and `drill …` work against the running service, which holds the database lock.
Package ctl is the local admin socket: a small HTTP API on a Unix socket in the data directory, so that `beacon token …`, `machine …`, `ssh …`, `config …` and `drill …` work against the running service, which holds the database lock.
events
Package events is the append-only half of the store: the audit log and the record of secret uses, in tables with indexes on time, actor and object, chained by hash so that a change or a deletion among them can be seen (the plan's §14): each record's hash is SHA-256 over the hash of the record before it and a canonical encoding of itself.
Package events is the append-only half of the store: the audit log and the record of secret uses, in tables with indexes on time, actor and object, chained by hash so that a change or a deletion among them can be seen (the plan's §14): each record's hash is SHA-256 over the hash of the record before it and a canonical encoding of itself.
feishu
Package feishu is the Feishu (Lark) self-built app: it sends interactive cards to the alert group, updates them in place, buzzes people, and receives button clicks, either over Feishu's long connection (no public callback URL needed) or as HTTP callbacks.
Package feishu is the Feishu (Lark) self-built app: it sends interactive cards to the alert group, updates them in place, buzzes people, and receives button clicks, either over Feishu's long connection (no public callback URL needed) or as HTTP callbacks.
gateway
Package gateway is the one door for machines (metrics.<domain>): probes and hosts write their samples (Prometheus remote write) and fetch the targets they check, job hosts push heartbeats, agents query metrics, the rule engine and Flux post alerts (Alertmanager's API v2, taken by the router), and CI and Flux post change events (deployments, reconciliations).
Package gateway is the one door for machines (metrics.<domain>): probes and hosts write their samples (Prometheus remote write) and fetch the targets they check, job hosts push heartbeats, agents query metrics, the rule engine and Flux post alerts (Alertmanager's API v2, taken by the router), and CI and Flux post change events (deployments, reconciliations).
ha
Package ha is the primary/standby pair over the PostgreSQL database (the plan's §10.3): one lease row in a leader table decides which instance is active.
Package ha is the primary/standby pair over the PostgreSQL database (the plan's §10.3): one lease row in a leader table decides which instance is active.
hostmetrics
Package hostmetrics reads a few host metrics from /proc, with the Prometheus Node Exporter's names, so that a probe machine needs no node_exporter: CPU time, memory, load, filesystems, network and disk traffic, pressure, time sync, and the heartbeat files of a textfile directory.
Package hostmetrics reads a few host metrics from /proc, with the Prometheus Node Exporter's names, so that a probe machine needs no node_exporter: CPU time, memory, load, filesystems, network and disk traffic, pressure, time sync, and the heartbeat files of a textfile directory.
i18n
Package i18n localises what people read: status pages, alert cards and API errors.
Package i18n localises what people read: status pages, alert cards and API errors.
inventory
Package inventory checks that every CDN node is serving: a probe location that runs on a CDN node names the node's address and the DNS name of its cluster (the rotation), and every minute both are resolved.
Package inventory checks that every CDN node is serving: a probe location that runs on a CDN node names the node's address and the DNS name of its cluster (the rotation), and every minute both are resolved.
kv
Package kv is the key-value layer under the store: everything the store kept in one bbolt file (buckets of JSON values, ordered keys, per-bucket sequences, counters) over a SQL database instead.
Package kv is the key-value layer under the store: everything the store kept in one bbolt file (buckets of JSON values, ordered keys, per-bucket sequences, counters) over a SQL database instead.
mcpserver
Package mcpserver is the built-in MCP server at /mcp (streamable HTTP, stateless).
Package mcpserver is the built-in MCP server at /mcp (streamable HTTP, stateless).
metrics
Package metrics exposes metrics in the Prometheus text format.
Package metrics exposes metrics in the Prometheus text format.
notify
Package notify sends through the channels that are not the Feishu app: Pushover (iOS emergency alerts that repeat until acknowledged), Bark (an iOS push that rings), the Feishu group's custom bot (plain messages that need no app and spend no API quota), and healthchecks.io pings.
Package notify sends through the channels that are not the Feishu app: Pushover (iOS emergency alerts that repeat until acknowledged), Bark (an iOS push that rings), the Feishu group's custom bot (plain messages that need no app and spend no API quota), and healthchecks.io pings.
oauth
Package oauth is Beacon's own authorization server for its MCP endpoint, as the MCP authorization specification asks: an agent's client (Claude Code, Codex) adds Beacon's /mcp, gets a 401 that names the protected resource metadata (RFC 9728), finds the authorization server's metadata (RFC 8414), registers itself (RFC 7591) or names its client ID metadata document, and sends the person to /oauth/authorize, where they sign in to the console and allow it (package web, which uses Parse and Code here).
Package oauth is Beacon's own authorization server for its MCP endpoint, as the MCP authorization specification asks: an agent's client (Claude Code, Codex) adds Beacon's /mcp, gets a 401 that names the protected resource metadata (RFC 9728), finds the authorization server's metadata (RFC 8414), registers itself (RFC 7591) or names its client ID metadata document, and sends the person to /oauth/authorize, where they sign in to the console and allow it (package web, which uses Parse and Code here).
oncall
Package oncall is the reference harness that runs an agent program when Beacon wakes it.
Package oncall is the reference harness that runs an agent program when Beacon wakes it.
probe
Package probe checks targets from a probe location, the way the Prometheus Blackbox Exporter does and with the same metric names (probe_success, probe_duration_seconds, probe_http_status_code, probe_ssl_earliest_cert_expiry), so that alert rules work with either.
Package probe checks targets from a probe location, the way the Prometheus Blackbox Exporter does and with the same metric names (probe_success, probe_duration_seconds, probe_http_status_code, probe_ssl_earliest_cert_expiry), so that alert rules work with either.
probenow
Package probenow is probing on demand: an agent asks the centre to have a target probed again at once, every probe location that has the target assigned is woken through the gateway's long-poll route, probes it with its usual modules and settings and posts what it found, and the agent sees each location's answer within a minute instead of waiting for the next cycle and the rule engine.
Package probenow is probing on demand: an agent asks the centre to have a target probed again at once, every probe location that has the target assigned is woken through the gateway's long-poll route, probes it with its usual modules and settings and posts what it found, and the agent sees each location's answer within a minute instead of waiting for the next cycle and the rule engine.
router
Package router does what Alertmanager did, inside the service: it takes alerts from the rule engine (vmalert or Prometheus, Alertmanager's API v2: POST /api/v2/alerts), groups them, mutes alerts that a firing alert inhibits or that a silence matches, and hands each group to the bridge the way Alertmanager's webhook did.
Package router does what Alertmanager did, inside the service: it takes alerts from the rule engine (vmalert or Prometheus, Alertmanager's API v2: POST /api/v2/alerts), groups them, mutes alerts that a firing alert inhibits or that a silence matches, and hands each group to the bridge the way Alertmanager's webhook did.
s3
Package s3 is a small client for the S3-compatible storage Beacon writes to (MinIO, R2, S3): put, get, head and delete, signed the way every one of them understands, AWS Signature Version 4.
Package s3 is a small client for the S3-compatible storage Beacon writes to (MinIO, R2, S3): put, get, head and delete, signed the way every one of them understands, AWS Signature Version 4.
secrets
Package secrets stores encrypted, destination-bound team credentials and lets agents use them through explicit, expiring grants.
Package secrets stores encrypted, destination-bound team credentials and lets agents use them through explicit, expiring grants.
server
Package server routes the service's HTTP requests: health and readiness, metrics (direct connections only), Feishu's HTTP callbacks, the drill check, the REST API, the MCP endpoint and the pages (the public ones at the root, the console under /console).
Package server routes the service's HTTP requests: health and readiness, metrics (direct connections only), Feishu's HTTP callbacks, the drill check, the REST API, the MCP endpoint and the pages (the public ones at the root, the console under /console).
signedhead
Package signedhead is the signed snapshot of a table's live rows: a name, a monotonic epoch, and the SHA-256 of each stored row.
Package signedhead is the signed snapshot of a table's live rows: a name, a monotonic epoch, and the SHA-256 of each stored row.
sshgate
Package sshgate is the SSH channel: agents reach the machines Beacon knows with the tools they already use (ssh, scp, sftp, rsync, port forwarding) or with the MCP and REST tools, and never hold a key.
Package sshgate is the SSH channel: agents reach the machines Beacon knows with the tools they already use (ssh, scp, sftp, rsync, port forwarding) or with the MCP and REST tools, and never hold a key.
status
Package status computes the public status pages from what Beacon already has: the pages' definitions in the catalogue (catalog.StatusPage), the probes' results in VictoriaMetrics (history.go), the alert groups as incidents, and the maintenance windows.
Package status computes the public status pages from what Beacon already has: the pages' definitions in the catalogue (catalog.StatusPage), the probes' results in VictoriaMetrics (history.go), the alert groups as incidents, and the maintenance windows.
store
Package store keeps the service's state in one SQL database (a single SQLite file by default): alert groups (card, acknowledgement, silence, escalation progress), people's accounts (an argon2id hash of each password) and their agents, tokens and OAuth grants (only their SHA-256), the machines the SSH channel reaches, the index of SSH sessions, small counters — all in a key-value space (internal/kv) with the buckets and keys they always had — and the audit log in event tables with a hash chain (internal/events).
Package store keeps the service's state in one SQL database (a single SQLite file by default): alert groups (card, acknowledgement, silence, escalation progress), people's accounts (an argon2id hash of each password) and their agents, tokens and OAuth grants (only their SHA-256), the machines the SSH channel reaches, the index of SSH sessions, small counters — all in a key-value space (internal/kv) with the buckets and keys they always had — and the audit log in event tables with a hash chain (internal/events).
targets
Package targets is what the probes check: target groups in Prometheus file_sd form ({targets, labels}), in named files (sets, once they are in Beacon's database; see package configdb).
Package targets is what the probes check: target groups in Prometheus file_sd form ({targets, labels}), in named files (sets, once they are in Beacon's database; see package configdb).
testutil
Package testutil builds a bridge with fake collaborators, for the tests of the packages above it.
Package testutil builds a bridge with fake collaborators, for the tests of the packages above it.
version
Package version holds the build information, set by the release pipeline with -ldflags -X.
Package version holds the build information, set by the release pipeline with -ldflags -X.
vm
Package vm queries VictoriaMetrics (or any Prometheus-compatible API) for instant vectors.
Package vm queries VictoriaMetrics (or any Prometheus-compatible API) for instant vectors.
web
Package web serves what people look at: the public pages at the site's root (the status pages, or a page that names the deployment), and under /console the console, Beacon's own workbench, with the pages people open from the chat (an alert's page, with its timeline and the sessions on its machines, and a session's page, with its replay).
Package web serves what people look at: the public pages at the site's root (the status pages, or a page that names the deployment), and under /console the console, Beacon's own workbench, with the pages people open from the chat (an alert's page, with its timeline and the sessions on its machines, and a session's page, with its replay).
web/link
Package link signs the links to the pages people open from the chat, and checks them.
Package link signs the links to the pages people open from the chat, and checks them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL