feat(sources): add Uptime Robot source #7

Merged
jfro merged 1 commit from feat/4-uptime-robot into main 2026-11-01 16:48:29 +00:00
Owner

Closes #4

Adds an Uptime Robot source (uptime_robot), a :problems source modeled on the Uptime Kuma one, reading Uptime Robot's v3 API (GET https://api.uptimerobot.com/v3/monitors, bearer read-only API key). v2 is legacy (keys in POST bodies); v3 is the documented REST API with cursor pagination and a published OpenAPI spec, which the fixture is shaped after.

What it reports

  • monitor:<id> (:incident), from the monitor's status:
    • DOWN → failing, with Uptime Robot's incident reason as why (e.g. "Connection Timeout") and the incident's startedAt as the report start
    • LOOKS_DOWN (Uptime Robot confirming from other regions) and STARTED (not checked yet) → pending
    • PAUSED → suppressed, or a warning when Report paused monitors is on
    • UP → ok
  • monitor:<id>:certificate (:security), from sslExpiryDateTime: warning/critical within the configured days, critical once expired (skipped for paused monitors)

Settings

API key (secret, required), Only monitors tagged (passed to the API's tags filter), Report paused monitors, and certificate warning/critical days (validated so critical ≤ warning). Monitors tagged lamplighter:ignore are skipped; lamplighter:warning|serious|critical (or lamplighter-…) set severity when down.

Errors and logging

  • 401/403 name the key to use (read-only/main, not monitor-specific) and include the API's error message
  • 429 says when Uptime Robot allows the next request (Retry-After) and explains the free plan's 10 req/min
  • non-list bodies and transport errors (via HTTP.describe_transport_error) are explained
  • Logger.warning on failed polls with the URL and duration, Logger.debug with monitor/page counts and duration, and a warning when X-RateLimit-Remaining drops to ≤ 1
  • pagination follows nextLink cursors (200 per page, capped at 50 pages)

README gets an Uptime Robot section.

Screenshots

Settings form with example values, desktop and 390px:

Uptime Robot settings, desktop

Uptime Robot settings, 390px

Source type picker:

Source type picker

Testing

  • test/lamplighter/sources/uptime_robot_test.exs: 18 tests with Req.Test stubs (auth header, tags filter, cursor pagination, 401/429/bad body/transport errors, rate-limit log) and a fixture covering every status, tags, and certificates
  • mix precommit: 624 tests pass, no warnings, formatted

Not tried against a live Uptime Robot account (no key here); status strings follow the API's documented filter values (PAUSED, STARTED, UP, LOOKS_DOWN, DOWN).

Closes #4 Adds an **Uptime Robot** source (`uptime_robot`), a `:problems` source modeled on the Uptime Kuma one, reading Uptime Robot's **v3 API** (`GET https://api.uptimerobot.com/v3/monitors`, bearer read-only API key). v2 is legacy (keys in POST bodies); v3 is the documented REST API with cursor pagination and a published OpenAPI spec, which the fixture is shaped after. ### What it reports - `monitor:<id>` (`:incident`), from the monitor's status: - `DOWN` → failing, with Uptime Robot's incident reason as *why* (e.g. "Connection Timeout") and the incident's `startedAt` as the report start - `LOOKS_DOWN` (Uptime Robot confirming from other regions) and `STARTED` (not checked yet) → pending - `PAUSED` → suppressed, or a warning when **Report paused monitors** is on - `UP` → ok - `monitor:<id>:certificate` (`:security`), from `sslExpiryDateTime`: warning/critical within the configured days, critical once expired (skipped for paused monitors) ### Settings API key (secret, required), **Only monitors tagged** (passed to the API's `tags` filter), **Report paused monitors**, and certificate warning/critical days (validated so critical ≤ warning). Monitors tagged `lamplighter:ignore` are skipped; `lamplighter:warning|serious|critical` (or `lamplighter-…`) set severity when down. ### Errors and logging - 401/403 name the key to use (read-only/main, not monitor-specific) and include the API's error message - 429 says when Uptime Robot allows the next request (`Retry-After`) and explains the free plan's 10 req/min - non-list bodies and transport errors (via `HTTP.describe_transport_error`) are explained - `Logger.warning` on failed polls with the URL and duration, `Logger.debug` with monitor/page counts and duration, and a warning when `X-RateLimit-Remaining` drops to ≤ 1 - pagination follows `nextLink` cursors (200 per page, capped at 50 pages) README gets an Uptime Robot section. ### Screenshots Settings form with example values, desktop and 390px: ![Uptime Robot settings, desktop](https://git.knope.dev/attachments/0c97931a-c4b1-409c-8b87-58c396d46097) ![Uptime Robot settings, 390px](https://git.knope.dev/attachments/37c2d6d3-bc86-48d0-947b-b01f244594b9) Source type picker: ![Source type picker](https://git.knope.dev/attachments/df05f866-762e-4756-9cf4-e9ab0ffe4f88) ### Testing - `test/lamplighter/sources/uptime_robot_test.exs`: 18 tests with `Req.Test` stubs (auth header, tags filter, cursor pagination, 401/429/bad body/transport errors, rate-limit log) and a fixture covering every status, tags, and certificates - `mix precommit`: 624 tests pass, no warnings, formatted Not tried against a live Uptime Robot account (no key here); status strings follow the API's documented filter values (`PAUSED, STARTED, UP, LOOKS_DOWN, DOWN`).
feat(sources): add Uptime Robot source
All checks were successful
CI / test (pull_request) Successful in 1m1s
14bb7b0e9a
Polls Uptime Robot's v3 API (GET /monitors, bearer read-only key) for
down, looks-down, and paused monitors, with the incident's reason and
start time, and TLS certificate expiry. Follows nextLink cursors, filters
by tags, honors lamplighter:* severity/ignore tags, and explains 401/403/429
(with Retry-After) and transport errors. Logs failures with timing and
a nearly exhausted rate limit.

Closes #4
jfro added this to the v1.0 milestone 2026-11-01 16:18:13 +00:00
jfro merged commit 826fb7c659 into main 2026-11-01 16:48:29 +00:00
jfro deleted branch feat/4-uptime-robot 2026-11-01 16:48:29 +00:00
Sign in to join this conversation.
No description provided.