status: instance overview
Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database test, using ~/kbdiag built from Go source commit 93bf65d (static linux/amd64 binary). This is lab evidence, not production validation. The FAIL example was created by a fault-injection script that fills every connection ordinary users may open. Values belong to this capture only.
Usage
status has no options of its own. Connection options are the same as for sessions.
Only two things are judged:
- FAIL when every connection ordinary users may open is taken (
max_connectionslesssuperuser_reserved_connections). At that point the application can no longer connect. - WARN on a standby that is not receiving WAL, meaning it has no WAL receiver or its status is not
streaming. Queries still work, but if the primary fails now there is no up-to-date standby to take over.
There is no “almost full” warning. How many connections is too many depends on the application, so status shows the count and leaves that call to you.
On the primary
- The role in the first line (primary / standby) comes from
sys_is_in_recovery(). inst.info:connectionscounts only backends connected to a database, not background processes. It compares directly with the 97 connections ordinary users may open.inst.downstreams: one row per standby this instance sends WAL to, fromsys_stat_replication.syncis shown as the server reports it. With repmgr it readsquorumhere, notsync/async.inst.upstreamonly applies to a standby.inst.databases: non-template databases, largest first. Sizes use 1024-based units, aspg_size_prettydoes.inst.disk: the filesystem holdingdata_directory, asdfreports it. Used plus free is less than the total by the blocks reserved for root. It is shown, not judged.
On the standby
- On a standby the upstream comes first. It comes from
sys_stat_wal_receiver: where the standby gets WAL from, through which slot, and when the last message arrived. last_msgis shown, not judged. A quiet primary only sends a message everywal_receiver_status_interval(10 seconds by default), so a few seconds is normal.- A paused WAL receiver (for example one stopped with SIGSTOP) keeps the status
streaming, so status does not report it. Iflast_msgkeeps growing, check the standby’s WAL receiver process yourself. Theslotspage shows a real capture of this.
All connections taken
- 98 is above 97 because superusers still get in through the reserve, including kbdiag’s own
systemconnection. - The
verifyline points tosessions, whose summary counts connections by user, database, application and client. In this capture it shows 93 idle sessions ofkbdiag_rofrom127.0.0.1.
Standby not receiving WAL
This case has not been reproduced in the lab yet. The finding below is quoted from the source code, not captured. On a standby with no WAL receiver, status reports:
If the receiver exists but its status is not streaming, the finding names that status instead. The exit code is 1.
Over TCP
kbdiag only reads inst.disk when it is sure it runs on the database host. That means one of:
- the Unix socket;
--hostset to localhost / 127.0.0.1 / ::1, withdata_directorypresent locally. The directory check is needed because a forwarded port could lead to another machine.
Otherwise inst.disk is not_applicable. Here kbdiag connects to the primary’s own network address as kbdiag_ro:
not_applicable does not affect the verdict.
Without privileges
kbdiag_ro has no monitoring role. On KingbaseES V8R6 it still sees sys_stat_replication, sys_stat_wal_receiver and data_directory in full, so status gives it the same result as system. Only database sizes can be hidden. Without CONNECT on a database, that database’s size is empty and recorded in redacted. Sizes are not judged, so the verdict stays OK rather than UNKNOWN.
JSON
--json keeps raw values: sizes in bytes, times in seconds, and the version as the short number. inst.info also carries usable_connections. inst.disk carries total_bytes, used_bytes and avail_bytes. A probe that does not apply has "status": "not_applicable" and a reason, for example "primary" or "remote connection".
Exit codes
| Code | Meaning |
|---|---|
| 0 | OK |
| 1 | WARN: a standby is not receiving WAL |
| 2 | FAIL: all connections ordinary users may open are taken |
| 3 | UNKNOWN: data not collected |
| 64 | Usage error |
| 69 | Cannot connect |