-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(localnet): Add monitoring tools for localnet (#2108)
Closes #2107 <!-- Please add a reference to the issue that this PR addresses and indicate which files are most critical to review. If it fully addresses a particular issue, please include "Closes #XXX" (where "XXX" is the issue number). If this PR is non-trivial/large/complex, please ensure that you have either created an issue that the team's had a chance to respond to, or had some discussion with the team prior to submitting substantial pull requests. The team can be reached via GitHub Discussions or the Cosmos Network Discord server in the #cometbft channel. GitHub Discussions is preferred over Discord as it allows us to keep track of conversations topically. https://github.com/cometbft/cometbft/discussions If the work in this PR is not aligned with the team's current priorities, please be advised that it may take some time before it is merged - especially if it has not yet been discussed with the team. See the project board for the team's current priorities: https://github.com/orgs/cometbft/projects/1 --> This PR introduces a new folder `test/monitoring` which contains a Docker Compose file that creates a Grafana and a Prometheus server locally for the developer. It connects up with a localnet installation. The localnet Docker compose file (`compose.yml`) was extended to allow Prometheus traffic from the container and documentation was updated to reflect the changes. Short way to execute: ``` make build-linux localnet-start monitoring-start ``` --- The JSON files are pre-populated Grafana dashboards. Two of them are from the qa-infra repository, one is part of host monitoring with "node-explorer" and one is a new one created for storage experiments that are currently ongoing. #### PR checklist - [ ] Tests written/updated - no Go code change - [X] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [X] Updated relevant documentation (`docs/` or `spec/`) and code comments - test docs were updated - [X] Title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec --------- Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
- Loading branch information
1 parent
1d99e05
commit e8b4efa
Showing
19 changed files
with
28,368 additions
and
4 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 @@ | ||
- `[test]` Added monitoring tools and dashboards for local testing with `localnet`. ([\#2107](https://github.com/cometbft/cometbft/issues/2107)) |
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
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
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
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
[rpc] | ||
laddr = "tcp://0.0.0.0:26657" | ||
[instrumentation] | ||
prometheus = true |
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
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,3 @@ | ||
data-grafana | ||
data-prometheus | ||
|
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,26 @@ | ||
# localnet monitoring | ||
Prometheus and Grafana server for localnet. | ||
|
||
# How to run | ||
```bash | ||
docker-compose up -d | ||
``` | ||
This will start both Prometheus and Grafana. | ||
|
||
# Details | ||
This docker compose (`compose.yml`) creates a local Granafa and Prometheus server. | ||
It is useful for local debugging and monitoring, especially for `localnet` setups. | ||
|
||
Prometheus will connect to the host machine's ports for data. By default it will connect to 26670,26671,26672,26673 | ||
which are the prometheus ports defined for `node0`, `node1`, `node2`, `node3` in `make localnet-start`. | ||
|
||
Ports and other settings can be changed in the `config-prometheus/prometheus.yml` file before startup. | ||
|
||
You can access the Grafana web interface at `http://localhost:3000` and the Prometheus web interface at `http://localhost:9090`. | ||
|
||
The default Grafana username and password is `admin`/`admin`. You will only need it if you want to change something. The | ||
pre-loaded dashboards can be viewed without a password. | ||
|
||
Data from Grafana and Prometheus end up in the `data-grafana` and `data-prometheus` folders on your host machine. | ||
This allows you to stop and and restart the servers without data loss. The folders are excluded from Git. | ||
|
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,49 @@ | ||
services: | ||
prometheus: | ||
image: prom/prometheus | ||
container_name: prometheus | ||
ports: | ||
- 127.0.0.1:9090:9090 | ||
volumes: | ||
- ./config-prometheus/prometheus.yml:/etc/prometheus/prometheus.yml | ||
- ./data-prometheus:/prometheus | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
node-exporter: | ||
image: prom/node-exporter | ||
container_name: node-exporter | ||
volumes: | ||
- /proc:/host/proc:ro | ||
- /sys:/host/sys:ro | ||
- /:/rootfs:ro | ||
command: | ||
- '--path.procfs=/host/proc' | ||
- '--path.rootfs=/rootfs' | ||
- '--path.sysfs=/host/sys' | ||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' | ||
grafana: | ||
image: grafana/grafana-oss | ||
container_name: grafana | ||
# if you are running as root then set it to 0 | ||
# else find the right id with the id -u command | ||
user: '501' | ||
ports: | ||
- 127.0.0.1:3000:3000 | ||
volumes: | ||
- ./data-grafana:/var/lib/grafana | ||
- ./config-grafana/provisioning:/etc/grafana/provisioning | ||
environment: | ||
GF_LOG_LEVEL: error | ||
GF_ANALYTICS_ENABLED: false | ||
GF_ANALYTICS_REPORTING_ENABLED: false | ||
GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: false | ||
GF_ANALYTICS_CHECK_FOR_UPDATES: false | ||
GF_ANALYTICS_FEEDBACK_LINKS_ENABLED: false | ||
GF_SECURITY_DISABLE_GRAVATAR: true | ||
GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH: /etc/grafana/provisioning/dashboards-data/main.json | ||
GF_USERS_DEFAULT_THEME: system | ||
GF_USERS_EDITORS_CAN_ADMIN: true | ||
GF_AUTH_ANONYMOUS_ENABLED: true | ||
GF_AUTH_ANONYMOUS_ORG_ROLE: Editor | ||
GF_AUTH_BASIC_ENABLED: false | ||
GF_NEWS_NEWS_FEED_ENABLED: false |
1 change: 1 addition & 0 deletions
1
test/monitoring/config-grafana/provisioning/alerting/.placeholder
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 @@ | ||
Placeholder so the Grafana log does not complain about missing folders. |
Oops, something went wrong.