Simple Go HTTP service that runs configured URL checks and exposes an aggregated health endpoint. Use case is to run health checks on a set of services and aggregate their health status into a single endpoint. Useful for envoy health checks.
- Load checks from a YAML config file
- HTTP health endpoints:
/healthz— run all checks in all named groups (aggregate)/healthz/<name>— run only the checks in the named group<name>
- CLI flags:
--config(default:config.yml) - path to config file; single positional argument is accepted as a fallback--version- print version and exit
listen_address: ":9001"
checks:
public_sites:
- name: google
url: https://www.google.com
expected_status: 200
timeout: 2s
- name: example
url: https://example.com
expected_status: 200
timeout: 1s
internal_sites:
- name: web
url: https://web.internal.example.com
expected_status: 200
timeout: 2sNotes:
listen_addressdefaults to:9001if omitted.- checks is a mapping of group names to lists of checks.
timeoutvalues use Go duration format (for example500ms,1s,2s).expected_statusdefaults to200if omitted.
Run:
go build -o healthzUsing default config.yml:
./healthzSpecify config path:
./healthz --config /path/to/config.yml
# or as a single positional argument:
./healthz /path/to/config.ymlPrint version:
./healthz --versionAggregate - all groups
curl -s http://localhost:9001/healthzReturns 200 and body OK when all checks pass for all groups. Returns 500 and body FAIL if any check fails.
Named group (run only otel1):
curl -s http://localhost:9001/healthz/public_sitesReturns 200 and body OK when all checks in the public_sites group pass. Returns 500 and body FAIL on the first failing check.
GPL-3.0 License