1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# ClickHouse
Epimetheus can ingest metrics into ClickHouse in **watch mode** only. ClickHouse is optional: you can use it in addition to Prometheus or as the only backend (by setting `-prometheus=` to disable Prometheus ingestion).
## Data flow (watch mode only)
```
┌─────────────────┐ poll (1s) ┌─────────────────────────────────────┐
│ CSV file(s) │ ─────────────────▶ │ Epimetheus (watch mode) │
│ (mtime = │ │ • Parse tabular CSV │
│ timestamp) │ │ • -metric-name + columns → metrics │
└─────────────────┘ └─────────────────────────────────────┘
│
┌────────────────────┼────────────────────┐
│ │ │
▼ ▼ │
┌───────────────┐ ┌───────────────┐ │
│ Prometheus │ │ ClickHouse │ │
│ (optional) │ │ (optional) │ │
│ -prometheus= │ │ -clickhouse= │ │
│ Remote Write │ │ HTTP insert │ │
└───────────────┘ └───────────────┘ │
│
At least one of -prometheus or -clickhouse │
```
## When It's Used
- **Mode:** Watch only. Other modes (realtime, historic, backfill, auto) do not write to ClickHouse.
- **Flags:**
- `-clickhouse` – ClickHouse HTTP URL (e.g. `http://localhost:8123`). If empty, no ClickHouse ingestion.
- `-clickhouse-table` – Table name (default: `epimetheus_metrics`).
At least one of `-prometheus` or `-clickhouse` must be set for watch mode.
## Table Schema
Epimetheus creates the table if it does not exist. Schema:
```sql
CREATE TABLE IF NOT EXISTS epimetheus_metrics (
metric String,
labels Map(String, String),
value Float64,
timestamp DateTime64(3)
) ENGINE = MergeTree()
ORDER BY (metric, timestamp)
```
- `metric` – metric name (e.g. from `-metric-name` and column headers in tabular CSV).
- `labels` – key-value map of label names and values.
- `value` – sample value.
- `timestamp` – sample time (millisecond precision).
## Examples
**Prometheus and ClickHouse:**
```bash
./epimetheus -mode=watch -file=data.csv -metric-name=myapp \
-prometheus=http://localhost:9090/api/v1/write \
-clickhouse=http://localhost:8123
```
**ClickHouse only:**
```bash
./epimetheus -mode=watch -file=test-data/watch-clickhouse-test.csv \
-metric-name=watch_test \
-clickhouse=http://localhost:8123 \
-prometheus=
```
**Custom table:**
```bash
./epimetheus -mode=watch -file=data.csv -metric-name=myapp \
-clickhouse=http://localhost:8123 \
-clickhouse-table=my_metrics
```
## Verification
Use the provided script to check that data landed in ClickHouse:
```bash
./scripts/verify-clickhouse.sh
# Or with custom URL/table:
./scripts/verify-clickhouse.sh http://localhost:8123 epimetheus_metrics
```
The script checks connectivity, row count, distinct metrics, sample rows, and rows per metric. See [Setup: ClickHouse](../operations/setup-clickhouse.md) for getting ClickHouse running.
|