Refactor Zebra metrics docs (#2687)
* Refactor Zebra metrics docs * Refactor Zebra metrics docs Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
This commit is contained in:
parent
f9c90b3d86
commit
985747861e
|
@ -4,7 +4,18 @@ Zebra has support for Prometheus, configured using the [`MetricsSection`][metric
|
||||||
|
|
||||||
This requires supporting infrastructure to collect and visualize metrics, for example:
|
This requires supporting infrastructure to collect and visualize metrics, for example:
|
||||||
|
|
||||||
1. Install Prometheus and Grafana via Docker
|
1. Create the `zebrad.toml` file with the following contents:
|
||||||
|
```
|
||||||
|
[metrics]
|
||||||
|
endpoint_addr = "127.0.0.1:9999"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run Zebra, and specify the path to the `zebrad.toml` file, for example:
|
||||||
|
```
|
||||||
|
zebrad -c zebrad.toml start
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Install and run Prometheus and Grafana via Docker:
|
||||||
|
|
||||||
```
|
```
|
||||||
# create a storage volume for grafana (once)
|
# create a storage volume for grafana (once)
|
||||||
|
@ -22,20 +33,13 @@ sudo docker run --detach --network host --env GF_SERVER_HTTP_PORT=3030 --env GF_
|
||||||
Now the grafana dashboard is available at [http://localhost:3030](http://localhost:3030) ; the default username and password is `admin`/`admin`.
|
Now the grafana dashboard is available at [http://localhost:3030](http://localhost:3030) ; the default username and password is `admin`/`admin`.
|
||||||
Prometheus scrapes Zebra on `localhost:9999`, and provides the results on `localhost:9090`.
|
Prometheus scrapes Zebra on `localhost:9999`, and provides the results on `localhost:9090`.
|
||||||
|
|
||||||
2. Configure Grafana with a Prometheus HTTP Data Source, using Zebra's `metrics.endpoint_addr`.
|
4. Configure Grafana with a Prometheus HTTP Data Source, using Zebra's `metrics.endpoint_addr`.
|
||||||
|
|
||||||
In zebrad.toml:
|
|
||||||
```
|
|
||||||
[metrics]
|
|
||||||
endpoint_addr = "127.0.0.1:9999"
|
|
||||||
```
|
|
||||||
|
|
||||||
In the grafana dashboard:
|
In the grafana dashboard:
|
||||||
1. Create a new Prometheus Data Source `Prometheus-Zebra`
|
1. Create a new Prometheus Data Source `Prometheus-Zebra`
|
||||||
2. Enter the HTTP URL: `127.0.0.1:9090`
|
2. Enter the HTTP URL: `127.0.0.1:9090`
|
||||||
3. Save the configuration
|
3. Save the configuration
|
||||||
|
|
||||||
Now you can add the grafana dashboards from `zebra/grafana` (Create > Import >
|
5. Now you can add the grafana dashboards from `zebra/grafana` (Create > Import > Upload JSON File), or create your own.
|
||||||
Upload JSON File), or create your own.
|
|
||||||
|
|
||||||
[metrics_section]: https://doc.zebra.zfnd.org/zebrad/config/struct.MetricsSection.html
|
[metrics_section]: https://doc.zebra.zfnd.org/zebrad/config/struct.MetricsSection.html
|
||||||
|
|
Loading…
Reference in New Issue