Link Search Menu Expand Document

Prometheus: System Monitoring

There’s a lot going on within the BitBoxBase and it’s good to have reliable metrics over time to aid in development, fine-tuning, during operations and when looking for the cause of a specific error. Prometheus takes care of that. It is a open-source monitoring solution that is easily extensible to monitor any application. Measurements are stored in a time-series database that can easily be queried and visualized, e.g. using Grafana. This database is also the main source of data that is queried by the Base Middleware.


Prometheus is downloaded directly from the GitHub releases page and checked against a hardcoded checksum. The .tar.gz archive is extracted, its content copied to various system locations and proper ownerwhip is set while building the Armbian image.

mkdir -p /etc/prometheus /var/lib/prometheus
cp prometheus promtool /usr/local/bin/
cp -r consoles/ console_libraries/ /etc/prometheus/
chown -R prometheus /etc/prometheus /var/lib/prometheus


Applications providing metrics basically just run a webserver that returns plain-text content in a specific format on a certain port. Prometheus queries these URI in fixed intervals and stores the metrics in its database. Where to get this information how often is specified in /etc/prometheus/prometheus.yml:

  scrape_interval:     1m
  evaluation_interval: 1m
  - job_name: node
      - targets: ['']
  - job_name: base
      - targets: ['']
  - job_name: bitcoind
      - targets: ['']
  - job_name: electrs
    - targets: ['']
  - job_name: lightningd
    - targets: ['']


The following metrics are collected both from the system and from specific applications.

  • Operating System: the Prometheus Node Exporter collects very granular information about the system, such as CPU and memory usage.
    • Installation: downloaded from the GitHub releases page, verified against a hardcoded checksum and installed by the Armbian build script similar to Prometheus itself
    • Service management: run by systemd as prometheus-node-exporter.service
    • Prometheus URI:
  • BitBoxBase
  • Bitcoin Core
  • electrs
    • Installation & service management: electrs provides Prometheus metrics by default, no additional steps necessary.
    • Prometheus URI:
  • c-lightning
    • Installation: single Python3 script that is downloaded from the lightningd/plugins GitHub repository to /opt/shift/scripts/ and checked against a hardcoded checksum
    • Service management: the script is run as a c-lightning server plugin and started together with lightningd. It is specified in the configuration file /etc/lightningd/lightningd.conf.
    • Prometheus URI:

Service management

The Prometheus service itself is managed by systemd. Relevant parameters are specified in the unit file /etc/systemd/system/prometheus.service shown below.


ExecStart=/usr/local/bin/prometheus \
    --web.listen-address="" \
    --config.file /etc/prometheus/prometheus.yml \
    --storage.tsdb.path=/mnt/ssd/prometheus \
    --web.console.templates=/etc/prometheus/consoles \


Data storage

The database is stored on the SSD in the /mnt/ssd/prometheus/ directory.