Functional Weave
Code in Python

monitor.check-status@1.0.0

README.md

1,163 bytes · view raw

# monitor.check-status

The shared vocabulary of the `monitor.*` capabilities, and the rule for
combining probes of one target from several locations.

- `CheckStatus` is `up`, `degraded` or `down`: what one probe concluded.
- `Check` is one probe outcome at a moment: `{ at, status }`, `at` in Unix
  seconds. `monitor.uptime`, `monitor.incidents`, `monitor.uptime-bars` and
  the others take lists of these, so a monitoring app stores exactly this.

## aggregateStatus

Monitoring services confirm an outage from more than one location before
alerting, because a single probe location with a bad route is far more common
than a real outage. The rule, in order:

1. At least `downQuorum` statuses are `down`: **down**.
2. Any `down` (below the quorum) or any `degraded`: **degraded**. Something is
   wrong somewhere, but not enough to call it an outage.
3. Otherwise **up**.

Degraded votes never add up to down, however many there are: a slow site is
still serving.

## Errors

- `statuses must not be empty`
- `downQuorum must be 1 to N` where N is the number of statuses: a quorum that
  can never be met would hide every outage.
- `unknown check status: X`