Exit codes

pgdba check

Exit Meaning
0 OK — no warning-or-worse findings (or thresholds set and not breached)
1 WARNING — warning threshold reached (also: non-TTY --apply refusal)
2 CRITICAL — critical threshold reached
3 UNKNOWN — config, connection, or apply error

Threshold interaction: --critical N exits 2 when critical count ≥ N; --warning M exits 1 when warning+critical count ≥ M. With either threshold set and no breach, the exit is 0 even if findings exist; without thresholds, the exit follows the worst finding severity.

pgdba migrate

0 success · 1 verify/report failures · 2 CRITICAL findings on gate · 3 preflight/confirm/config errors (non-TTY without --yes aborts here with zero target writes).

pgdba config doctor

0 valid and every profile connects · 1 validation passed but a probe failed · 3 validation failed or the config is missing (names the discovery order).

pgdba verify-restore

0 verified · 1 rehearsal issues (report says which) · 3 config/fencing errors.

Note

Cron rule: alert on any non-zero exit; exit 3 usually means unreachable, not unhealthy — page on it separately.