gittech. site

for different kinds of informations and explorations.

Prometheus Exporter for Bitcoin Core

Published at
5 days ago

bitcoin-core-exporter

Simple Prometheus exporter for exposing various metrics from a full Bitcoin Core node.

Setup

  1. Clone the repo on the same machine where the Bitcoin Core node is running.
git clone https://github.com/joetor5/bitcoin-core-exporter.git
cd bitcoin-core-exporter
  1. Create a Python venv and install dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
  1. Start the exporter
chmod +x bitcoin_exporter.py
./bitcoin_exporter.py &

This will start the exporter http server on port 8000 and collect metrics every 60 seconds. You can select a different port with the -p arg. Run with -h arg for general usage and options.

  1. View all the metrics (starting with bitcoin_)
curl http://localhost:8000/metrics
  1. Modify the prometheus.yml config for pulling these metrics from the exporter
scrape_configs:

  - job_name: "bitcoin-core"
    scrape_interval: 60s
    static_configs:
      - targets: ["localhost:8000"]