blob: 8ed47c9934d9742ccb020d173241027072e3f111 (
plain)
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
|
# macOS Setup
## Basic installation
```bash
brew install prometheus
brew install grafana
go install github.com/prometheus/pushgateway@latest
brew services start grafana
brew services start prometheus
~/go/bin/pushgateway &
```
Log in to Grafana at http://localhost:3000 (default admin:admin; you will be prompted to change the password). Add http://localhost:9090 as a Prometheus datasource.
## Enable Remote Write receiver (required for watch/historic/backfill/auto)
Watch mode, historic mode, backfill mode, and auto mode with old data require the Prometheus Remote Write receiver.
### Option 1: Permanent configuration
Edit the Prometheus arguments file (Homebrew example):
```bash
nano /opt/homebrew/etc/prometheus.args
```
Add at the end:
```
--web.enable-remote-write-receiver
--web.enable-admin-api
```
Example full file:
```
--config.file /opt/homebrew/etc/prometheus.yml
--web.listen-address=127.0.0.1:9090
--storage.tsdb.path /opt/homebrew/var/prometheus
--web.enable-remote-write-receiver
--web.enable-admin-api
```
Restart Prometheus:
```bash
brew services restart prometheus
```
Verify:
```bash
curl http://localhost:9090/-/healthy
curl -X POST http://localhost:9090/api/v1/write # expect 400, not 404
```
### Option 2: Temporary (testing only)
```bash
brew services stop prometheus
prometheus --web.enable-remote-write-receiver
```
Keep that terminal open; use another for Epimetheus. This stops when you close the terminal.
## Clearing old metrics (optional)
If the Admin API is enabled:
```bash
# Delete metrics by name pattern
curl -X POST -g 'http://localhost:9090/api/v1/admin/tsdb/delete_series?match[]={__name__=~"blockstore_.*"}'
curl -X POST http://localhost:9090/api/v1/admin/tsdb/clean_tombstones
sleep 2
```
## Verify watch mode
```bash
cat > /tmp/test.csv << EOF
status,count,method
200,100,GET
404,50,POST
EOF
./epimetheus -mode=watch -file=/tmp/test.csv -metric-name=test \
-prometheus=http://localhost:9090/api/v1/write
```
You should see a success message. In Prometheus (http://localhost:9090), query `{__name__=~"test_.*"}`.
|