From 32dca2736623b4e8b60853af8e771bea94b88d96 Mon Sep 17 00:00:00 2001 From: Hans Moog <3293976+hmoog@users.noreply.github.com> Date: Mon, 2 Dec 2024 08:17:22 +0000 Subject: [PATCH] fix(docker): grafana local config + private network (#4299) * fixed grafana local config + private network * Make grafana-local compatible with iota-private-network * Use external network * Update prometheus.yaml * Make grafana-local compatible with iota-private-network * Add README.md * Format files --------- Co-authored-by: Hans Moog Co-authored-by: Piotr Macek <4007944+piotrm50@users.noreply.github.com> --- docker/grafana-local/README.md | 7 +++++ docker/grafana-local/docker-compose.yaml | 14 +++++++++ docker/grafana-local/prometheus.yaml | 36 ++++++++++++++---------- 3 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 docker/grafana-local/README.md diff --git a/docker/grafana-local/README.md b/docker/grafana-local/README.md new file mode 100644 index 00000000000..ca46614ea00 --- /dev/null +++ b/docker/grafana-local/README.md @@ -0,0 +1,7 @@ +# Prometheus and Grafana monitoring for `iota-private-network` + +This docker-compose configuration allows launching instances of the Prometheus and Grafana applications for monitoring of locally deployed `iota-private-network`. + +In order to run this monitoring setup, you first need to have `iota-private-network` setup running, because it creates the network that Prometheus and Grafana join. + +To deploy the setup, simply run `docker compose up -d`. diff --git a/docker/grafana-local/docker-compose.yaml b/docker/grafana-local/docker-compose.yaml index 8e8a71e18a6..1ad59567d55 100644 --- a/docker/grafana-local/docker-compose.yaml +++ b/docker/grafana-local/docker-compose.yaml @@ -6,6 +6,8 @@ services: volumes: - ./tempo.yaml:/etc/tempo.yaml - ${TMPDIR}/tempo-data:/tmp/tempo + networks: + iota-network: ports: - "14268:14268" # jaeger ingest - "3200:3200" # tempo @@ -20,13 +22,19 @@ services: - --config.file=/etc/prometheus.yaml - --web.enable-remote-write-receiver - --enable-feature=exemplar-storage + networks: + iota-network: volumes: - ./prometheus.yaml:/etc/prometheus.yaml ports: - "9090:9090" + extra_hosts: + - "host.docker.internal:host-gateway" grafana: image: grafana/grafana:10.1.1 + networks: + iota-network: volumes: - ./grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml - ./dashboards:/etc/grafana/provisioning/dashboards @@ -42,6 +50,8 @@ services: image: prom/node-exporter:latest container_name: node-exporter restart: unless-stopped + networks: + iota-network: volumes: - /proc:/host/proc:ro - /sys:/host/sys:ro @@ -53,3 +63,7 @@ services: - "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)" ports: - "9100:9100" +networks: + iota-network: + external: + name: iota-private-network_iota-network diff --git a/docker/grafana-local/prometheus.yaml b/docker/grafana-local/prometheus.yaml index 9192a853a3d..93bd06973b5 100644 --- a/docker/grafana-local/prometheus.yaml +++ b/docker/grafana-local/prometheus.yaml @@ -5,53 +5,59 @@ global: scrape_configs: - job_name: "prometheus" static_configs: - - targets: ["localhost:9090", "host.docker.internal:9184"] + - targets: ["localhost:9090"] - job_name: "Validator_0" static_configs: - - targets: ["host.docker.internal:2002"] + - targets: ["validator-1:9184"] labels: host: validator0 network: local - job_name: "Validator_1" static_configs: - - targets: ["host.docker.internal:2012"] + - targets: ["validator-2:9184"] labels: host: validator1 network: local - job_name: "Validator_2" static_configs: - - targets: ["host.docker.internal:2022"] + - targets: ["validator-3:9184"] labels: host: validator2 network: local - job_name: "Validator_3" static_configs: - - targets: ["host.docker.internal:2032"] + - targets: ["validator-4:9184"] labels: host: validator3 network: local - - job_name: "Client_1" + - job_name: "Fullnode_0" static_configs: - - targets: ["host.docker.internal:8081"] + - targets: ["fullnode-1:9184"] labels: - host: client1 + host: fullnode0 network: local - - job_name: "Client_2" + - job_name: "Fullnode_1" static_configs: - - targets: ["host.docker.internal:8082"] + - targets: ["fullnode-2:9184"] labels: - host: client2 + host: fullnode1 network: local - - job_name: "Client_3" + - job_name: "Fullnode_2" static_configs: - - targets: ["host.docker.internal:8083"] + - targets: ["fullnode-3:9184"] labels: - host: client3 + host: fullnode2 + network: local + - job_name: "Fullnode_3" + static_configs: + - targets: ["fullnode-4:9184"] + labels: + host: fullnode3 network: local - job_name: "tempo" static_configs: - targets: ["tempo:3200"] - - job_name: "node" + - job_name: "node-exporter" static_configs: - targets: ["host.docker.internal:9100"] labels: