# PostgreSQL — process check + port + optional replication lag custom check. widgets: - type: process_check name: PostgreSQL process: postgres - type: port_check name: PG Port host: localhost port: 5432 timeout: 5 # Optional: check replication lag (requires psql access). # Exit 0 = ok, exit 1 = lag > threshold, exit 2 = cannot connect. # - type: custom_cmd # name: PG Replication lag # cmd: | # LAG=$(psql -U postgres -tAc "SELECT EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))::int" 2>/dev/null) # [ -z "$LAG" ] && exit 2 # [ "$LAG" -gt 300 ] && exit 1 || exit 0