photinus alpha

How the swarm works, with pictures.

Seven ideas carry the whole design. Each one is checkable against the same question: is this still true if any single machine disappears?

1 · A mesh, not a star

Most monitoring is a star: every host reports to one collector, and a dashboard sits on the collector. The collector is the one machine that must never fail, and the day it does, you are blind. Photinus has no center. Every host runs a lantern, every lantern watches its peers, and any one of them can answer for the whole swarm.

the star collector dies, everyone is blind the mesh any lantern answers for the swarm
There is no machine on the right whose death makes the others blind. That is the entire design test.

2 · The flash

Every couple of seconds each lantern runs its local checks, bundles what it currently believes into a flash, and gossips it to a few random peers. Those peers pass it on. Nobody talks to everyone; news still crosses the swarm in seconds, and the cost per lantern stays flat no matter how big the swarm grows.

check flash out merge what arrives decide one flash a few peers, then their peers
Left: the loop one lantern lives in. Right: constant fan-out; the dashed hops are other lanterns relaying, not the sender working harder.

3 · The life of an alert

Everything above and below hangs on one path: how a failing check becomes exactly one page. This is that path, the same on every lantern, with no step that needs a central machine.

a check runs, it fails one observation, one opinion rides the next flash, gossips subject is the observer's own host? yes no authority: its own word decides, warning at most count the votes of the swarm as last known majority agrees? yes no stays data, no page state changed: hash election picks one live lantern exactly one page
Both decision points are the design: authority for a host's own facts, quorum for everything else, and a deterministic election so agreement never needs a leader. The next sections take each branch apart.

4 · Quorum: opinion versus outage

One lantern failing to reach a host is a fact about that lantern as much as about the host. So a single opinion never pages. Every lantern votes with its own observation, and only when a majority of the swarm as last known agrees does the state become an outage.

db:5432 1 of 5 says down · stays UP · just data db:5432 3 of 5 say down · quorum · OUTAGE, page once
Same host, same checks. The difference between the two pictures is the whole product.

A warning is never an outage: a full disk on a living host can only WARN, because the host is up and its own lantern is saying so. DOWN is reserved for things the swarm confirmed unreachable.

5 · The authority rule

For a host's own facts, disk, cpu, memory, swap, uptime, network rate, no vote is taken. The host's own lantern is the sole authority on its own machine: its word decides, and hearsay from others never mixes in. Quorum is for the things no single machine can know alone, like reachability; authority is for the things only one machine can know at all.

jawa "my disk is 92% full" jawa's own word · decides alone hearsay, never counted peers guessing about jawa's disk
Rule of thumb: quorum for what many can see, authority for what only one can see.

6 · Paging exactly once

When the swarm agrees something broke, fourteen lanterns must not send fourteen emails. There is no leader to do the sending, on purpose. Instead every lantern runs the same arithmetic: hash the alert, and the live lantern whose id sits closest to that hash is the sender. No election protocol, no coordination round. If the chosen lantern is itself the dead one, the same arithmetic picks the next, and the survivor pages.

db:5432 DOWN hash(alert) closest id wins one page → dead winner? the next closest takes over, automatically
Deterministic election: everyone computes the same winner from the same facts, so nobody has to agree on anything first.

A flapping subject, bouncing up and down, is damped: the swarm sends one page that says it is flapping, holds further pages, and closes with one page when it settles.

7 · The heartbeat (pulse)

Some failures are things that did not happen. A backup that silently stopped running has no port to dial. So the job reports in instead: its cron line ends by pinging /pulse/backup-db on any lantern it can reach. The receipt gossips like everything else. When a declared pulse stays silent past its window, every lantern votes down, and quorum turns the silence into a page.

backup cron ping the receipt gossips: everyone knows the last ping window: 26h silence: 27h every lantern votes DOWN
The ping may land anywhere, so there is no special box the job depends on. The alarm needs quorum, so one machine with a wrong clock cannot page alone.

8 · When the network splits

A partition is the nastiest case: both halves believe the other half died. Photinus counts quorum against the swarm as last known, not as currently reachable. The minority side can never reach a majority of that remembered number, so it goes quiet instead of screaming; the majority side still holds quorum and keeps working.

5 of a remembered 7 · quorum holds · still pages 2 of a remembered 7 · can never reach quorum · goes quiet
Wrong monitoring conclusions are worse than missing ones: the side that cannot know stays silent rather than guessing.

What a lantern watches

checkwhat it testskind
tcpdial a host:portremote
httpfetch a url; 2xx or 3xx is upremote
certTLS health; expiring soon warns, broken is downremote
pulsea heartbeat: a job pings any lantern, silence pagesremote
diskfilesystem usage against a thresholdlocal
cpuprocessor utilization against a thresholdlocal
memoryRAM utilization against a thresholdlocal
swapswap use, the early warning before OOMlocal
uptimeflags a reboot since the last flashlocal
nettraffic rate on the main interface, for spotting anomalieslocal
skewclock drift measured from peers' flash timestampsrelational
lanternevery member's liveness, the mesh watching itselfrelational

Local checks fall under the authority rule; remote checks under quorum; the relational ones are the swarm measuring itself. The standard local set runs by default: one binary and a seed address is a fully monitored host.