Skip to content

Commit 7a7396e

Browse files
authored
Merge pull request #1871 from input-output-hk/jpraynaud/1826-mithril-nodes-footprint
Monitor Mithril nodes footprint
2 parents ffc6dc2 + 35ef708 commit 7a7396e

File tree

8 files changed

+100
-1
lines changed

8 files changed

+100
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ As a minor extension, we have adopted a slightly different versioning convention
99

1010
## Mithril Distribution [XXXX] - UNRELEASED
1111

12+
- Support for Mithril nodes footprint support in Prometheus monitoring in infrastructure
13+
1214
- **UNSTABLE** Cardano stake distribution certification:
1315

1416
- Implement the signable and artifact builders for the signed entity type `CardanoStakeDistribution`

mithril-infra/assets/docker/docker-compose-monitoring.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,44 @@ services:
5252
options:
5353
tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"
5454

55+
process-exporter:
56+
image: ncabatoff/process-exporter:latest
57+
container_name: process-exporter
58+
profiles:
59+
- tools
60+
- monitoring
61+
- all
62+
restart: always
63+
ports:
64+
- "9256:9256"
65+
volumes:
66+
- /proc:/host/proc:ro
67+
- ./prometheus/process_exporter/process.yml:/config/process.yml:ro
68+
command:
69+
- "-procfs=/host/proc"
70+
- "-config.path=/config/process.yml"
71+
logging:
72+
driver: "${LOGGING_DRIVER}"
73+
options:
74+
tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"
75+
76+
disk-usage-exporter:
77+
container_name: disk-usage-exporter
78+
restart: always
79+
build:
80+
context: .
81+
dockerfile: ./prometheus/disk_usage_exporter/Dockerfile
82+
args:
83+
DISK_USAGE_EXPORTER_VERSION: 0.6.0
84+
profiles:
85+
- all
86+
ports:
87+
- "9995:9995"
88+
volumes:
89+
- ./prometheus/disk_usage_exporter/disk_usage_exporter.yml:/config/disk_usage_exporter.yml:ro
90+
- ../data/${NETWORK}/:/data
91+
command: ["run", "--config", "/config/disk_usage_exporter.yml"]
92+
5593
loki:
5694
image: grafana/loki:2.8.0
5795
container_name: loki
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ARG DOCKER_IMAGE_FROM=debian:11-slim
2+
FROM $DOCKER_IMAGE_FROM
3+
4+
# Create appuser
5+
RUN adduser --no-create-home --disabled-password appuser
6+
7+
# Precreate workdir
8+
RUN mkdir -p /app/bin
9+
10+
# Upgrade
11+
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && apt-get clean && rm -rf /var/lib/apt/lists/*
12+
13+
#Workdir
14+
WORKDIR /app/
15+
16+
## Download Disk usage exporter
17+
ARG DISK_USAGE_EXPORTER_VERSION=0.6.0
18+
ARG DISK_USAGE_EXPORTER_URL=https://github.com/dundee/disk_usage_exporter/releases/download/v$DISK_USAGE_EXPORTER_VERSION/disk_usage_exporter_linux_386.tgz
19+
RUN wget $DISK_USAGE_EXPORTER_URL \
20+
&& tar xzf disk_usage_exporter_linux_386.tgz \
21+
&& chmod u+x disk_usage_exporter_linux_386 \
22+
&& mv disk_usage_exporter_linux_386 /app/bin/disk_usage_exporter \
23+
&& rm -f disk_usage_exporter_linux_386.tgz
24+
25+
# Use an unprivileged user
26+
USER appuser
27+
28+
# Run the executable
29+
ENTRYPOINT ["/app/bin/disk_usage_exporter"]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
multi-paths:
2+
/data/mithril-aggregator/mithril: 1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
process_names:
2+
- comm:
3+
- cardano-node
4+
- mithril-aggregator
5+
- mithril-aggrega
6+
- mithril-client
7+
- mithril-signer
8+
- mithril-relay

mithril-infra/assets/docker/prometheus/prometheus-base.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ scrape_configs:
1919
static_configs:
2020
- targets: ["node-exporter:9100"]
2121

22+
- job_name: "process-exporter"
23+
static_configs:
24+
- targets: ["process-exporter:9256"]
25+
26+
- job_name: "disk-usage-exporter"
27+
static_configs:
28+
- targets: ["disk-usage-exporter:9995"]
29+
2230
- job_name: "reverse-proxy"
2331
static_configs:
2432
- targets: ["reverse-proxy:8080"]

mithril-infra/assets/infra.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.27
1+
0.2.28

mithril-infra/mithril.monitoring.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,24 @@ cat >> /home/curry/docker/promtail/promtail-config.yml << EOF
7575
- url: https://${var.loki_ingest_username}:${var.loki_ingest_password}@${var.loki_ingest_host}/loki/api/v1/push
7676
EOF
7777
fi
78+
EOT
79+
,
80+
<<-EOT
81+
set -e
82+
# Setup disk usage exporter configuration
83+
cp /home/curry/docker/prometheus/disk_usage_exporter/disk_usage_exporter-base.yml /home/curry/docker/prometheus/disk_usage_exporter/disk_usage_exporter.yml
84+
# Setup disk usage exporter targets for Mithril signers
85+
MITHRIL_SIGNER_NODES=$(docker ps --format='{{.Names}},' | grep "mithril-signer" | grep -v "www" | grep -v "relay" | sort | tr -d '\n\t\r ' | sed 's/.$//' | tr ',' ' ')
86+
for MITHRIL_SIGNER_NODE in $MITHRIL_SIGNER_NODES; do
87+
echo " /data/$MITHRIL_SIGNER_NODE/mithril: 1" >> /home/curry/docker/prometheus/disk_usage_exporter/disk_usage_exporter.yml
88+
done
7889
EOT
7990
]
8091
}
8192

8293
provisioner "remote-exec" {
8394
inline = [
95+
"export NETWORK=${var.cardano_network}",
8496
"export LOGGING_DRIVER='${var.mithril_container_logging_driver}'",
8597
"export PROMETHEUS_HOST=${local.prometheus_host}",
8698
"export PROMETHEUS_AUTH_USER_PASSWORD=$(htpasswd -nb ${var.prometheus_auth_username} ${var.prometheus_auth_password})",

0 commit comments

Comments
 (0)