diff options
Diffstat (limited to 'docs/operations/macos-setup.md')
| -rw-r--r-- | docs/operations/macos-setup.md | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/docs/operations/macos-setup.md b/docs/operations/macos-setup.md new file mode 100644 index 0000000..8ed47c9 --- /dev/null +++ b/docs/operations/macos-setup.md @@ -0,0 +1,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_.*"}`. |
