C++ node
Integrate MyTonCtrl with Prometheus
MyTonCtrl pushes metrics to a Prometheus Pushgateway so Prometheus (and Grafana, if used) can scrape them without exposing the node directly.
Prerequisites
- Docker and Docker Compose are installed on the host that runs Prometheus.
- MyTonCtrl installed and running on the node that emits metrics.
Deploy Prometheus and Pushgateway
- In an empty directory, create
docker-compose.yml:
services:
pushgateway:
image: prom/pushgateway:v1.4.0
restart: unless-stopped
ports:
- "9091:9091"
prometheus:
image: prom/prometheus:v2.52.0
restart: unless-stopped
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
command:
- "--config.file=/etc/prometheus/prometheus.yml"
ports:
- "9090:9090"- Create
prometheus.ymlalongside it:
global:
scrape_interval: 15s
scrape_configs:
- job_name: "mytonctrl_pushgateway"
static_configs:
- targets: ["pushgateway:9091"]- Start the stack and confirm the container status:
docker compose up -d
docker compose psConfigure MyTonCtrl to push metrics
- Open the MyTonCtrl console:
mytonctrl- Enable Prometheus mode:
MyTonCtrl> enable_mode prometheus- Point MyTonCtrl to the Pushgateway (include a job name):
MyTonCtrl> set prometheus_url http://<PUSHGATEWAY_HOST>:9091/metrics/job/<JOB_NAME><PUSHGATEWAY_HOST> — host running the Pushgateway (use 127.0.0.1 when MyTonCtrl and Docker run on the same machine).
<JOB_NAME> — unique label for this node, for example validator1.
Use unique job names
Do not reuse the same JOB_NAME across nodes when scraped by one Prometheus instance, or metrics collide.
Verify metrics
- Pushgateway: open
http://<PUSHGATEWAY_HOST>:9091and confirm metrics appear under<JOB_NAME>. - Prometheus targets: open
http://<PROMETHEUS_HOST>:9090/targetsand check thatmytonctrl_pushgatewayshowsUP. - Prometheus graph: query
mytonctrl_syncedor other MyTonCtrl metrics athttp://<PROMETHEUS_HOST>:9090/graph.
Last updated on