Prometheus is a monitoring platform that collects metrics from monitored targets by scraping metrics HTTP endpoints on these targets. Official documentation is available here.
Grafana is a dashboard used to visualize the collected data.
Update prometheus.yml located in /etc/prometheus/prometheus.yml
Change the <block producer ip address> in the following command.
cat>prometheus.yml<<EOFglobal: scrape_interval: 15s # By default, scrape targets every 15 seconds. # Attach these labels to any time series or alerts when communicating with # external systems (federation, remote storage, Alertmanager). external_labels: monitor: 'codelab-monitor'# A scrape configuration containing exactly one endpoint to scrape:# Here it's Prometheus itself.scrape_configs: # The job name is added as a label job=<job_name> to any timeseries scraped from this config. - job_name: 'prometheus' static_configs: - targets: ['localhost:9100'] labels: alias: 'relaynode1' type: 'prometheus-node-exporter' - targets: ['<block producer ip address>:9100'] labels: alias: 'block-producer-node' type: 'prometheus-node-exporter' - targets: ['<block producer ip address>:12798'] labels: alias: 'block-producer-node' type: 'cardano-node' - targets: ['localhost:12798'] labels: alias: 'relaynode1' type: 'cardano-node'EOFsudomvprometheus.yml/etc/prometheus/prometheus.yml
Do not expose Grafana (port 3000) to the public internet as this invites a new attack surface! A secure solution would be to access Grafana through a ssh tunnel.
Example of how to create a ssh tunnel in Linux or MacOS: