Your first check
1. Prepare and install
Use a KES V8R6 or V9 instance. Build using the Go version required by the source repository’s go.mod, then copy the static binary to the database host. Choose GOARCH=arm64 for ARM.
On the host, use your approved OS account and chmod +x ~/kbdiag. Run ~/kbdiag --version to confirm the binary (builds without -ldflags "-X main.version=..." print dev).
2. Connect
Defaults: -h /tmp, -p 54321, -d test, -U system (Unix socket /tmp/.s.KINGBASE.54321). Precedence is explicit CLI flag > KINGBASE_* > PG* > default (KINGBASE_HOST/PGHOST, KINGBASE_PORT/PGPORT, KINGBASE_DATABASE/PGDATABASE, KINGBASE_USER/PGUSER, KINGBASE_PASSWORD/PGPASSWORD, PGSSLMODE). Use -h <hostname> for TCP connections, -W/--password for no-echo TTY password prompts, --sslmode to set SSL mode, and --help for command help. Passwords are also read from KINGBASE_PASSWORD, PGPASSWORD, or ~/.pgpass. --timeout bounds each query and --total-timeout bounds the whole command. If the server requires scram-sm3 authentication, kbdiag reports guidance to use a local Unix socket or a compatible authentication channel.
Use an approved monitoring account. sys_monitor can reveal fields hidden from ordinary users; a missing privilege is reported, not silently treated as empty. TCP cannot provide local database-host filesystem measurements.
3. Run
The HTML report omits raw SQL and configuration credentials (passwords, connection URIs, env secrets) by default and writes atomically with 0600 permissions. Review it before sharing. See Read results for output format and exit code details.
4. Read exit codes
| Code | Meaning |
|---|---|
| 0 | OK within collected scope |
| 1 | WARN: investigate the finding |
| 2 | FAIL: urgent finding in visible evidence |
| 3 | UNKNOWN: required evidence missing or masked |
| 64 | Invalid command or flags |
| 69 | Could not connect |
Read $? immediately after the command. WARN/FAIL can coexist with missing coverage; inspect both. Scope and permission gaps remain meaningful even when the exit code is 1 or 2.
5. Drill down
Use lock --tree then session <pid> for blockers; session waits for wait distributions; sql top then sql show --id=<int64> for cumulative workload. object table [name], vacuum and freeze inspect the selected database; switch with -d for another database.
Read results · All 17 command cards
Terminal layout, verdicts, coverage markers, scope boundaries, and JSON structure.