Skip to content

Commit

Permalink
Update monitoring setup docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ktl-XV committed Jan 8, 2025
1 parent f15ab6e commit fba2fab
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions book/src/users/monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,17 @@ Modify the `http_adr` line to use localhost
;http_addr = # Before
http_addr = localhost # After
```

Copy the provisioning files. From trin root directory:
```sh
sudo cp -R etc/grafana/provisioning /etc/grafana/provisioning
```
Modify prometheus datasource to use localhost
```ini
url: http://host.docker.internal:9090 # Before
url: http://127.0.0.1:9090 # After
```

Start grafana
```sh
sudo systemctl daemon-reload
Expand All @@ -236,16 +247,9 @@ sudo systemctl enable grafana-server
```
This will serve metrics over port 3000.

Generate a grafana dashboard. From trin root directory:
```sh
cargo run -p trin -- create-dashboard http://localhost:3000 admin admin http://127.0.0.1:9090
```
This will create a new monitoring database for trin. This will
be visible in the grafana GUI, or directly at a URL similar to:
http://localhost:3000/d/trin-app-metrics/trin-app-metrics

If you would like to run the create-dashboard command again, the
data source and the dashboard must be deleted, which can be done in the grafana GUI.
http://localhost:3000/d/trin-metrics/trin-metrics

### Start trin with metrics on

Expand Down Expand Up @@ -295,7 +299,7 @@ docker run -p 9090:9090 -v /**absolute/path/to/trin/etc/prometheus**:/etc/promet
```
3. Run Grafana:
```sh
docker run -p 3000:3000 --add-host=host.docker.internal:host-gateway grafana/grafana:latest
docker run -p 3000:3000 -v /**absolute/path/to/trin/etc/grafana/provisioning**:/etc/grafana/provisioning --add-host=host.docker.internal:host-gateway grafana/grafana:latest
```
4. Start your Trin process with:
```sh
Expand All @@ -305,13 +309,10 @@ cargo run -p trin -- --enable-metrics-with-url 0.0.0.0:9100 --web3-http-address
complete, and requests from docker instances are considered external.
- The `--enable-metrics-with-url` parameter is the address that Trin exports metrics to, and should be equal to the port to which your Prometheus server is targeting at the bottom of `prometheus/prometheus.yml`
- The `--web-transport http` will allow Grafana to request routing table information from Trin via JSON-RPC over HTTP
5. From the root of the Trin repo, run `cargo run -p trin -- create-dashboard`. If you used different ports than detailed in the above steps, or you are not using docker, then this command's defaults will not work. Run the command with the `-h` flag to see how to provide non-default addresses or credentials.
6. Upon successful dashboard creation, navigate to the dashboard URL that the `create-dashboard` outputs. Use `admin`/`admin` to login.
5. Navigate to http://localhost:3000/d/trin-metrics/trin-metrics. Use `admin`/`admin` to login.

## Gotchas

- If `create-dashboard` fails with an error, the most likely reason is that it has already been run. From within the Grafana UI, delete the "json-rpc" and "prometheus" datasources and the "trin" dashboard and re-run the command.

- There is a limit on concurrent connections given by the threadpool. At last
doc update, that number was 2, but will surely change. If you leave
connections open, then new connections will block.

0 comments on commit fba2fab

Please sign in to comment.