-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
629b9c7
commit 2d87ca3
Showing
12 changed files
with
707 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Metrics | ||
|
||
Anchor comes pre-built with a suite of metrics for developers or users to monitor the health | ||
and performance of their node. | ||
|
||
They must be enabled at runtime using the `--metrics` CLI flag. | ||
|
||
## Usage | ||
|
||
In order to run a metrics server, `docker` is required to be installed. | ||
|
||
Once docker is installed, a metrics server can be run locally via the following steps: | ||
|
||
1. Start an anchor node with `$ anchor --metrics` | ||
- The `--metrics` flag is required for metrics. | ||
1. Move into the metrics directory `$ cd metrics`. | ||
1. Bring the environment up with `$ docker-compose up --build -d`. | ||
1. Ensure that Prometheus can access your Anchor node by ensuring it is in | ||
the `UP` state at [http://localhost:9090/targets](http://localhost:9090/targets). | ||
1. Browse to [http://localhost:3000](http://localhost:3000) | ||
- Username: `admin` | ||
- Password: `changeme` | ||
1. Import some dashboards from the `metrics/dashboards` directory in this repo: | ||
- In the Grafana UI, go to `Dashboards` -> `Manage` -> `Import` -> `Upload .json file`. | ||
- The `Summary.json` dashboard is a good place to start. | ||
|
||
## Dashboards | ||
|
||
A suite of dashboards can be found in `metrics/dashboard` directory. The Anchor team will | ||
frequently update these dashboards as new metrics are introduced. | ||
|
||
We welcome Pull Requests for any users wishing to add their dashboards to this repository for | ||
others to share. | ||
|
||
## Scrape Targets | ||
|
||
Prometheus periodically reads the `metrics/scrape-targets/scrape-targets.json` file. This | ||
file tells Prometheus which endpoints to collect data from. The current file is setup to read | ||
from Anchor on its default metrics port. You can add additional endpoints if you want to collect | ||
metrics from other servers. | ||
|
||
An example is Lighthouse. You can collect metrics from Anchor and Lighthouse simultaneously if | ||
they are both running. We have an example file `scrape-targets-lighthouse.json` which allows this. | ||
You can replace the `scrape-targets.json` file with the contents of | ||
`scrape-targets-lighthouse.json` if you wish to collect metrics from Anchor and Lighthouse | ||
simultaneously. | ||
|
||
## Hosting Publicly | ||
|
||
By default Prometheus and Grafana will only bind to localhost (127.0.0.1), in | ||
order to protect you from accidentally exposing them to the public internet. If | ||
you would like to change this you must edit the `http_addr` in `metrics/grafana/grafana.ini`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Anchor Metrics | ||
|
||
[![metrics.png](https://i.postimg.cc/Jh7rxtgp/metrics.png)](https://postimg.cc/4YMRN4Xc) | ||
|
||
Here we provides a `docker-compose` environment which scrapes metrics from Anchor | ||
nodes using Prometheus and presents them in a browser-based Grafana GUI. | ||
|
||
For in-depth details on running metrics, please see the [anchor | ||
book](https://anchor-book.sigmaprime.io). | ||
|
||
## Basic Usage | ||
|
||
1. Start an anchor node with `$ anchor --metrics` | ||
- The `--metrics` flag is required for metrics. | ||
1. Move in to the `metrics` directory `$ cd metrics`. | ||
1. Bring the environment up with `$ docker-compose up --build`. | ||
1. Ensure that Prometheus can access your Anchor node by ensuring it is in | ||
the `UP` state at [http://localhost:9090/targets](http://localhost:9090/targets). | ||
1. Browse to [http://localhost:3000](http://localhost:3000) | ||
- Username: `admin` | ||
- Password: `changeme` | ||
1. Import some dashboards from the `dashboards` directory in this repo: | ||
- In the Grafana UI, go to `Dashboards` -> `Manage` -> `Import` -> `Upload .json file`. | ||
- The `Summary.json` dashboard is a good place to start. | ||
|
||
## Hosting Publicly | ||
|
||
By default Prometheus and Grafana will only bind to localhost (127.0.0.1), in | ||
order to protect you from accidentally exposing them to the public internet. If | ||
you would like to change this you must edit the `http_addr` in `grafana.ini`. | ||
|
||
## Maintenance and Contributing | ||
|
||
The Anchor team has a hosted version of this stack where we do the | ||
majority of the monitoring. The dashboards in this repo are not guaranteed to | ||
be kept updated as we add/modify metrics to Anchor. If you're having | ||
problems, please reach out and we can update the dashboards here. | ||
|
||
Feel free to create your own dashboards, export them and submit them here as | ||
PRs. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# Metrics services -- provides a web GUI to monitor Lighthouse nodes. | ||
# | ||
version: "3.3" | ||
|
||
services: | ||
prometheus: | ||
build: | ||
context: prometheus | ||
volumes: | ||
- prometheus-data:/prometheus | ||
- type: bind | ||
source: ./scrape-targets | ||
target: /prometheus/targets | ||
restart: always | ||
network_mode: host | ||
grafana: | ||
build: | ||
context: grafana | ||
volumes: | ||
- grafana-data:/var/lib/grafana | ||
restart: always | ||
network_mode: host | ||
|
||
volumes: | ||
grafana-data: | ||
prometheus-data: | ||
targets: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM grafana/grafana | ||
|
||
COPY provisioning/ /etc/grafana/provisioning | ||
COPY grafana.ini /etc/grafana/grafana.ini |
Oops, something went wrong.