> ## Documentation Index
> Fetch the complete documentation index at: https://getkanari.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# kanari audit

> One-shot health check with exit codes for CI/CD integration

## Overview

`kanari audit` connects to your Redis and Celery instances, collects metrics, runs the findings engine, and prints a formatted report. It then exits with a status code that reflects the severity of what it found.

```bash theme={null}
kanari audit
```

***

## Flags

| Flag | Default | Description |
| - | - | - |
| `--config`, `-c` | — | Path to a YAML config file |
| `--json` | off | Output machine-readable JSON instead of TUI |
| `--md` | off | Output a Markdown report |
| `--no-config-checks` | off | Skip Redis/Celery configuration analysis (runs by default) |
| `--deep`, `-d` | — | Deprecated no-op — configuration analysis now runs by default |
| `--timeout` | `3.0` | Max seconds to wait for connections and metrics |
| `--no-color` | off | Disable ANSI colors (useful in CI logs) |

***

## Exit codes

| Code | Meaning |
| - | - |
| `0` | Healthy — no findings |
| `1` | Warnings — at least one MEDIUM or LOW finding |
| `2` | Critical — at least one HIGH or CRITICAL finding |

***

## Output modes

### TUI (default)

Rich-formatted report with color-coded status indicators. Best for humans running audits interactively.

```bash theme={null}
kanari audit
```

### JSON

Machine-readable output. Use this in CI scripts, log aggregation, or when piping to other tools.

```bash theme={null}
kanari audit --json
```

```json theme={null}
{
  "timestamp": "2026-05-31T14:22:01Z",
  "system_status": "DEGRADED",
  "exit_code": 2,
  "top_findings": [
    {
      "id": "WORKER_OFFLINE",
      "severity": "CRITICAL",
      "title": "Worker offline: beat-wrk",
      "evidence_summary": "worker=beat-wrk, is_alive=False"
    },
    {
      "id": "QUEUE_SLA_BREACH_EMAILS",
      "severity": "HIGH",
      "title": "SLA breach on queue 'emails'",
      "evidence_summary": "queue=emails, latency_sec=125.4"
    }
  ],
  "metrics": {
    "total_pending": 862,
    "total_active": 7,
    "saturation_pct": 43.8,
    "max_latency_sec": 125.4,
    "redis_connected": true,
    "celery_connected": true
  }
}
```

### Markdown

Structured Markdown output. Useful for posting to Slack, GitHub issues, or incident reports.

```bash theme={null}
kanari audit --md
```

***

## Config file auto-discovery

`--config` is optional. When omitted, `kanari audit` looks for `kanari.yaml` in the current directory and loads it automatically:

```bash theme={null}
kanari audit
# 💡 Using kanari.yaml
```

If `kanari.yaml` is not present, it falls back to localhost defaults and suggests creating one:

```bash theme={null}
kanari audit
# 💡 No kanari.yaml found — connecting to localhost defaults.
#    Run 'kanari init' to generate one.
```

To use a config file in a different location, pass it explicitly:

```bash theme={null}
kanari audit --config /etc/kanari/prod.yaml
```

Run `kanari init` to generate `kanari.yaml`, or see [Configuration](/docs/reference/configuration) for the full reference.

***

## Configuration analysis

Every audit includes a **Configuration Analysis** section that checks your Redis and Celery settings for common production risks — no flag needed. Use `--no-config-checks` to skip it. See [Configuration Analysis](/docs/guides/deep-audit) for details.

***

## Examples

```bash theme={null}
# Quick check — is anything broken right now?
kanari audit

# CI gate — fail pipeline if critical issues found
kanari audit --json && echo "Celery healthy"

# Debug an incident, saving the full report
kanari audit --no-color 2>&1 | tee incident-$(date +%Y%m%d).log

# Check a specific environment
REDIS_URL=redis://staging-redis:6379/0 kanari audit
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.