# check: nine-domain health patrol

> Run a bounded read-only nine-domain health check and export a self-contained offline HTML report.

---

LLMS index: [llms.txt](/kbdiag-docs/llms.txt)

---

Patrols nine bounded domains in one connection (`connections`, `license`, `disk`, `replication`, `slots`, `archive`, `freeze`, `locks`, `txn`) without scanning user table sizes. Read-only: never modifies sessions, parameters, or objects.

## Usage

```bash
kbdiag check
kbdiag check --json
kbdiag check --html ./patrol.html
kbdiag check --html ./patrol.html --html-raw-sql
```

## Key Options

| Option | Effect |
|---|---|
| `--html <file>` | Write a static offline HTML report atomically (`0600`, strict CSP, no scripts/CDNs) |
| `--html-raw-sql` | Opt in to raw SQL inside HTML (default redacts SQL columns/fields to `<redacted>`) |
| `--json` | Emit `check.domains` matrix plus all 16 domain probes and `redacted[]` metadata |

## Verdict & Reading Output

- **`FAIL` (`exit=2`)** / **`WARN` (`exit=1`)**: Any domain triggers a rule finding; `[NEXT]` prioritizes `FAIL` then `WARN` drilldowns ahead of missing-coverage items so confirmed incidents are never crowded out.
- **`UNKNOWN` (`exit=3`)**: Missing/skipped/error/redacted coverage without a higher-severity finding; failed/skipped probes are listed in top `[COVERAGE]` and affected domains are summarized under `[SUMMARY]` (`Missing domains`) and wrapped cleanly inside `[DOMAIN MATRIX]`.
- **`--html` security**: Zero JavaScript/external resources (`script-src 'none'`); HTML preserves non-SQL cells alongside `<redacted>` SQL placeholders and renders `redacted[]` privilege gaps.

## Example (KES V9 Primary, excerpt, `COLUMNS=80`)

```text
check  UNKNOWN  (KingbaseES V009R002C016, primary, system@local,
    endpoint=/tmp/.s.KINGBASE.54321, 2026-12-03T04:17:23Z)

[COVERAGE]
  space.disk: skipped (insufficient_privilege: statfs
    /data/kingbase/data/sys_wal: permission denied)

[SUMMARY]
  0 FAIL, 0 WARN | covered 8/9 | missing 1
  Missing domains: disk

[DOMAIN MATRIX]
  DOMAIN | STATUS | VERDICT | SUMMARY | DRILLDOWN
  connections | ok | OK | within collected thresholds | kbdiag session
  license | ok | OK | within collected thresholds | kbdiag server license
  disk | skipped | UNKNOWN
    incomplete evidence; missing: space.disk=skipped
    kbdiag space
  ...
  txn | ok | OK | within collected thresholds | kbdiag txn

[NEXT]
  kbdiag space  # disk: inspect findings or restore coverage
```

## Related Commands

- [`kbdiag space`](/kbdiag-docs/docs/reference/space/) — inspect full filesystem mounts and database/tablespace sizes
- [`kbdiag repl`](/kbdiag-docs/docs/reference/repl/) / [`kbdiag slots`](/kbdiag-docs/docs/reference/slots/) — drill into standby streaming links and slot retention
- [`kbdiag session`](/kbdiag-docs/docs/reference/session/) / [`kbdiag lock`](/kbdiag-docs/docs/reference/lock/) — inspect active sessions, waits, and lock trees
