4b6817381b
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
115 lines
3.1 KiB
Plaintext
115 lines
3.1 KiB
Plaintext
---
|
|
title: "ClickHouse"
|
|
description: "Connect ClickHouse so OpenSRE can inspect query activity and system health during investigations"
|
|
---
|
|
|
|
OpenSRE queries ClickHouse system tables to surface slow queries, active connections, replica status, and table statistics — helping diagnose database performance issues during alert investigations.
|
|
|
|
## Prerequisites
|
|
|
|
- ClickHouse 21.x or later
|
|
- Network access from the OpenSRE environment to your ClickHouse instance
|
|
- A user with read access to system tables
|
|
|
|
## Setup
|
|
|
|
### Option 1: Interactive CLI
|
|
|
|
```bash
|
|
opensre integrations setup
|
|
```
|
|
|
|
Select **ClickHouse** when prompted and provide your host and credentials.
|
|
|
|
### Option 2: Environment variables
|
|
|
|
Add to your `.env`:
|
|
|
|
```bash
|
|
CLICKHOUSE_HOST=your-clickhouse-host
|
|
CLICKHOUSE_PORT=8123
|
|
CLICKHOUSE_DATABASE=default
|
|
CLICKHOUSE_USER=default
|
|
CLICKHOUSE_PASSWORD=your-password
|
|
CLICKHOUSE_SECURE=false # set to true for HTTPS
|
|
```
|
|
|
|
| Variable | Default | Description |
|
|
| --- | --- | --- |
|
|
| `CLICKHOUSE_HOST` | — | **Required.** ClickHouse hostname or IP |
|
|
| `CLICKHOUSE_PORT` | `8123` | HTTP(S) port (8123 for HTTP, 8443 for HTTPS) |
|
|
| `CLICKHOUSE_DATABASE` | `default` | Default database |
|
|
| `CLICKHOUSE_USER` | `default` | Username |
|
|
| `CLICKHOUSE_PASSWORD` | — | Password |
|
|
| `CLICKHOUSE_SECURE` | `false` | Use HTTPS (`true`/`false`) |
|
|
|
|
### Option 3: Persistent store
|
|
|
|
```json
|
|
{
|
|
"version": 1,
|
|
"integrations": [
|
|
{
|
|
"id": "clickhouse-prod",
|
|
"service": "clickhouse",
|
|
"status": "active",
|
|
"credentials": {
|
|
"host": "your-clickhouse-host",
|
|
"port": 8443,
|
|
"database": "default",
|
|
"username": "opensre_readonly",
|
|
"password": "your-password",
|
|
"secure": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## Creating a read-only user
|
|
|
|
```sql
|
|
CREATE USER opensre_readonly IDENTIFIED BY 'secure-password';
|
|
GRANT SELECT ON system.* TO opensre_readonly;
|
|
GRANT SELECT ON default.* TO opensre_readonly;
|
|
```
|
|
|
|
## Investigation tools
|
|
|
|
When OpenSRE investigates a ClickHouse-related alert, three diagnostic tools are available:
|
|
|
|
- **Query activity** — reads `system.query_log` to surface recent slow and failed queries
|
|
- **System health** — reads `system.metrics` for active connections, query count, replica status, and uptime
|
|
- **Table stats** — reads `system.parts` for table-level row counts and storage sizes
|
|
|
|
All operations are read-only.
|
|
|
|
## Verify
|
|
|
|
```bash
|
|
opensre integrations verify clickhouse
|
|
```
|
|
|
|
Expected output:
|
|
|
|
```
|
|
Service: clickhouse
|
|
Status: passed
|
|
Detail: Connected to ClickHouse 23.8.1; database: default
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
| Symptom | Fix |
|
|
| --- | --- |
|
|
| **Connection refused** | Check host, port, and firewall. Use port `8443` with `CLICKHOUSE_SECURE=true` |
|
|
| **Authentication failed** | Verify username and password |
|
|
| **SSL error** | Set `CLICKHOUSE_SECURE=true` and use port `8443` |
|
|
| **Access denied on system tables** | Grant `SELECT ON system.*` to the OpenSRE user |
|
|
|
|
## Security best practices
|
|
|
|
- Create a **dedicated read-only user** with access only to `system.*` and the databases OpenSRE needs.
|
|
- Use **HTTPS** (`CLICKHOUSE_SECURE=true`) in production.
|
|
- Store credentials in `.env`, not in source code.
|