checkfleet

module
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT

README ΒΆ

checkfleet

A fleet of infrastructure checks in one binary.

checkfleet runs domain-aware health checks β€” the kind that generic monitoring can't express β€” and reports them as terminal output, an ops-style markdown report, or JSON. One static Go binary, one YAML config, no agents, no server.

πŸ“– Full documentation: allan-nava.github.io/checkfleet

$ checkfleet check all --config checkfleet.yml

πŸ”΄ BAD   http     https://example.com/health   HTTP 404 (atteso 200), 151ms
🟒 OK    certs    example.com:443              scade tra 41 giorni (2026-09-02, CN=*.example.com)
🟒 OK    http     https://example.com/         HTTP 200, 168ms

3 check: 2 OK, 0 WARN, 1 BAD, 0 ERROR (in 227ms)

Philosophy

Don't rebuild Prometheus or Grafana. checkfleet fills the layer they can't: checks that need domain knowledge (what "healthy" means for a TLS estate, a NATS cluster, an HLS stream), runnable from CI, cron, or your laptop, with reports you can paste straight into your ops docs.

  • Exit code 0 even on WARN/BAD findings β€” a check that ran is a success. Gate on the output, or use --exit-on-bad for CI.
  • Worst findings first β€” the thing you must look at is the first line.
  • Fleet-aware β€” point the certs check at your Ansible inventory and every host becomes a target.

Install

go install github.com/Allan-Nava/checkfleet/cmd/checkfleet@latest
# or: brew install Allan-Nava/tap/checkfleet   (once the tap is published)
# or: download a release archive (tar.gz/zip + checksums.txt) from GitHub Releases

See Installation for all options.

Modules

Module What it checks
certs TLS certificate expiry (WARN/BAD thresholds in days) for explicit targets and/or every host of an Ansible INI inventory
http HTTP probes: expected status, max latency (WARN), body substring
nats NATS JetStream cluster health via /varz + /jsz?meta=1: meta-leader present/expected, offline or lagging peers, ghost/missing peers, mixed versions
haproxy Backend/server health from the CSV stats export: servers DOWN/MAINT/DRAIN, backends with no available server, optional session saturation
stream HLS/DASH stream health from the manifest: reachable & valid, complete bitrate ladder, live-edge freshness (live)
patroni Patroni PostgreSQL cluster via the REST API: single leader, replica state, replica lag, timeline divergence
consul Consul cluster via the HTTP API: raft leader & quorum, critical/warning health checks, required KV keys
postgres PostgreSQL via read-only SQL: wraparound risk, connection saturation, inactive replication slots, replica lag
dns DNS resolution via an in-tree client: records resolve, drift from expected, SOA-serial & answer consistency across resolvers, low TTL

More on the way (see BACKLOG.md): endpoint/disk, Slack output, Prometheus exporter mode.

Configuration

# checkfleet.yml
timeout_seconds: 30
checks:
  certs:
    warn_days: 30
    crit_days: 7
    port: 443
    targets:
      - example.com
      - internal.example:8443
    ansible_inventory: /path/to/inventory   # optional: every host β†’ target
  http:
    targets:
      - url: https://example.com/
        expect_status: 200
        max_latency_ms: 2000
        expect_body: "ok"

Usage

checkfleet check all   --config checkfleet.yml                    # terminal
checkfleet check certs --config checkfleet.yml --output markdown  # ops report
checkfleet check nats  --config checkfleet.yml --output markdown  # NATS cluster health
checkfleet check patroni --config checkfleet.yml                  # PostgreSQL cluster (Patroni)
checkfleet check postgres --config checkfleet.yml                 # PostgreSQL (read-only SQL)
checkfleet check dns   --config checkfleet.yml                    # DNS resolution & drift
checkfleet check http  --config checkfleet.yml --output json      # machine-readable (includes "worst")
checkfleet check all   --config checkfleet.yml --exit-on-bad      # exit 2 on BAD/ERROR, for CI gates
checkfleet check all   --config checkfleet.yml --output slack     # post a Block Kit report to a Slack webhook
checkfleet serve       --config checkfleet.yml --listen :9876     # Prometheus exporter (metrics at /metrics)
checkfleet report-issues --config checkfleet.yml                  # open/close GitHub issues from BAD findings

Finding statuses: OK, WARN (threshold crossed), BAD (target unhealthy), ERROR (the check itself could not measure β€” network, handshake).

Development

go test ./...    # all tests run against local in-test servers β€” no network needed
go vet ./...
go build -o checkfleet ./cmd/checkfleet

Adding a module: implement engine.Check in internal/checks/<name>, add its typed config in internal/engine/config.go, wire it in cmd/checkfleet/main.go, and test it against a local fixture server.

License

MIT

Directories ΒΆ

Path Synopsis
cmd
backlog-sync command
Command backlog-sync keeps GitHub issues in sync with BACKLOG.md.
Command backlog-sync keeps GitHub issues in sync with BACKLOG.md.
checkfleet command
checkfleet: a fleet of infrastructure checks with one binary.
checkfleet: a fleet of infrastructure checks with one binary.
internal
backlog
Package backlog parses BACKLOG.md into structured items so tooling can keep GitHub issues in sync with it.
Package backlog parses BACKLOG.md into structured items so tooling can keep GitHub issues in sync with it.
checks/certs
Package certs implements the TLS certificate expiry check: it connects to every target, reads the leaf certificate and reports how many days are left.
Package certs implements the TLS certificate expiry check: it connects to every target, reads the leaf certificate and reports how many days are left.
checks/consul
Package consul implements a health check for a Consul cluster via its HTTP API: a raft leader is elected, the raft peer count meets expectations, service/node health checks are not critical/warning, and required KV keys exist.
Package consul implements a health check for a Consul cluster via its HTTP API: a raft leader is elected, the raft peer count meets expectations, service/node health checks are not critical/warning, and required KV keys exist.
checks/dns
Package dns implements a DNS resolution health check using a minimal in-tree DNS client (no third-party dependency).
Package dns implements a DNS resolution health check using a minimal in-tree DNS client (no third-party dependency).
checks/haproxy
Package haproxy implements a backend/server health check for HAProxy, reading the CSV stats export over HTTP (the `;csv` stats endpoint).
Package haproxy implements a backend/server health check for HAProxy, reading the CSV stats export over HTTP (the `;csv` stats endpoint).
checks/httpcheck
Package httpcheck implements the HTTP probe: status code, latency and an optional body substring, per target.
Package httpcheck implements the HTTP probe: status code, latency and an optional body substring, per target.
checks/nats
Package nats implements a preflight/health check for a NATS JetStream cluster, reading the HTTP monitoring endpoints (/varz and /jsz?meta=1) of each node.
Package nats implements a preflight/health check for a NATS JetStream cluster, reading the HTTP monitoring endpoints (/varz and /jsz?meta=1) of each node.
checks/patroni
Package patroni implements a health check for a Patroni-managed PostgreSQL cluster, reading the Patroni REST API (/cluster).
Package patroni implements a health check for a Patroni-managed PostgreSQL cluster, reading the Patroni REST API (/cluster).
checks/postgres
Package postgres implements a read-only health check for PostgreSQL: it connects to each target and evaluates transaction-id wraparound risk, connection saturation, inactive replication slots retaining WAL, and β€” on a primary β€” replica lag.
Package postgres implements a read-only health check for PostgreSQL: it connects to each target and evaluates transaction-id wraparound risk, connection saturation, inactive replication slots retaining WAL, and β€” on a primary β€” replica lag.
checks/stream
Package stream implements a health check for HLS and DASH streams from their manifests: the manifest is reachable and parseable, the bitrate ladder has the expected number of renditions, and β€” for live streams β€” the live edge is fresh (not stalled).
Package stream implements a health check for HLS and DASH streams from their manifests: the manifest is reachable and parseable, the bitrate ladder has the expected number of renditions, and β€” for live streams β€” the live edge is fresh (not stalled).
engine
Package engine defines the check contract and the runner.
Package engine defines the check contract and the runner.
inventory
Package inventory parses Ansible INI inventories just enough to extract hosts and their ansible_host addresses, so checks can target a whole fleet from the same source of truth used by the playbooks.
Package inventory parses Ansible INI inventories just enough to extract hosts and their ansible_host addresses, so checks can target a whole fleet from the same source of truth used by the playbooks.
issuesync
Package issuesync reconciles a run's findings with a tracker's issues: it opens an issue for each BAD/ERROR finding (deduped by check+target) and closes the ones whose finding has recovered.
Package issuesync reconciles a run's findings with a tracker's issues: it opens an issue for each BAD/ERROR finding (deduped by check+target) and closes the ones whose finding has recovered.
output
Package output renders a run's Result as terminal text, markdown (in the ops-report style: problems first, full table after) or JSON.
Package output renders a run's Result as terminal text, markdown (in the ops-report style: problems first, full table after) or JSON.

Jump to

Keyboard shortcuts

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