Skip to content

helium miner prometheus client exporter

License

Notifications You must be signed in to change notification settings

PaulVMo/miner_exporter

 
 

Repository files navigation

miner_exporter

Prometheus exporter for the Helium miner (validator). Using prometheus_client, this code exposes metrics from the helium miner to a prometheus compatible server.

This is only the exporter, which still requires a prometheus server for data and grafana for the dashboard. Prometheus and Grafana servers can run on an external machine, the same machine as the miner, or possibly using a cloud service. The helium_miner_grafana_dashboard can be imported to Grafana.

Note port 9825 is the 'reserved' port for this specific exporter. Feel free to use whatever you like, of course, but you won't be able to dial 9VAL on your phone.

Running via Docker

Using the docker file, you can run this with Docker or docker-compose! Both of these expose Prometheus on 9825, feel free to choose your own port.

Build docker image

Clone the repository and build the image to add it to your local repository

git clone https://github.com/PaulVMo/miner_exporter
cd miner_exporter
docker build -t miner_exporter:latest . 

Docker client

docker run -p 9825:9825 --network host --restart always --name miner_exporter -v /var/run/docker.sock:/var/run/docker.sock miner_exporter:latest

Docker-Compose

Using your existing docker-compose file, add the section for the exporter (below). When you're done, run docker-compose up -d as usual. That's it!

version: "3"
services:
  validator:
    image: quay.io/team-helium/validator:latest-val-amd64
    container_name: validator
...
  miner_exporter:
    image: miner_exporter:latest
    container_name: miner_exporter
    network_mode: host
    restart: always
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock

    # Optional parameters
    environment:
    - UPDATE_PERIOD=25

Running locally

On the miner machine:

install python3, python3-venv

pip install prometheus_client

Details on the libraries:

Then install the service in a home directory:

sudo make install

Then install the systemd unit file:

sudo make install-service

Then enable and start the service:

sudo systemctl enable validator_exporter
sudo systemctl start validator_exporter

Configuration

The following parameters can be used to modify configuration and behavior of the exporter:

UPDATE_PERIOD  # seconds between scrapes, int
VALIDATOR_JSONRPC_ADDRESS # address to call jsonrpc methods, default: http://localhost:4467
MINER_EXPORTER_PORT # port which miner_exporter listens on, default: 9825
COLLECT_SYSTEM_USAGE # boolean, default: False
ALL_HBBFT # collect HBBFT performance metrics on all validators, not just this validator, default: False
ALL_PENALTIES # collect penalty and heartbeat metrics on all stakes validators, default: False

About

helium miner prometheus client exporter

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Python 90.9%
  • Makefile 5.3%
  • Dockerfile 3.3%
  • Shell 0.5%