MyTonCtrl Prometheus Metrics
MyTonCtrl can be configured to expose Prometheus metrics for monitoring and alerting purposes. This guide will walk you through the process of enabling Prometheus metrics in MyTonCtrl.
Metrics delivery method
Currently, for security reasons, MyTonCtrl pushes metrics to a Prometheus Pushgateway, which Prometheus then scrapes.
Setup
For validators, it's highly recommended to run Prometheus and Pushgateway on a separate server.
-
Install Pushgateway
You can install the Pushgateway service by following the instructions in the official documentation. The easiest way to do that is via Docker:
docker pull prom/pushgateway
docker run -d -p 9091:9091 prom/pushgateway -
Configure Prometheus
Create a
prometheus.yml
file, adding the Pushgateway job to thescrape_configs
section.global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "pushgateway"
honor_labels: true
static_configs:
- targets: ["localhost:9091"] # or "host.docker.internal:9091" if you are using Docker -
Install Prometheus
You can install Prometheus by following the instructions in the official documentation. The easiest way to do that is via Docker:
docker volume create prometheus-data
docker run -d \
--add-host host.docker.internal:host-gateway \
-p 9090:9090 \
-v ./prometheus.yml:/etc/prometheus/prometheus.yml \
-v prometheus-data:/prometheus \
prom/prometheus -
Configure MyTonCtrl
Enable mode
prometheus
in MyTonCtrl (see the MyTonCtrl enable_mode command):MyTonCtrl> enable_mode prometheus
Set the Pushgateway URL (see the MyTonCtrl set command):
MyTonCtrl> set prometheus_url http://<host>:9091/metrics/job/<job_name>
warningNote that it is very important to use different job names for different nodes in case you want to monitor multiple nodes with the same Prometheus instance.
-
Check the metrics
You can check that Prometheus scrapes the metrics by opening the Prometheus web interface:
http://<host>:9090/targets