Chia Exporter is an application that is intended to run alongside a chia installation and exports prometheus style metrics based on data available from Chia RPCs. Where possible, all data is received as events from websocket subscriptions. Some data that is not available as a metrics event is also fetched as well, but usually in response to an event that was already received that indicates the data may have changed (with the goal to only make as many RPC requests as necessary to get accurate metric data).
This project is actively under development and relies on data that may not yet be available in a stable release of Chia Blockchain. Dev builds of chia may contain bugs or other issues that are not present in tagged releases. We do not recommend that you run pre-release/dev versions of Chia Blockchain on mission critical systems.
Download the correct executable file from the release page and run. If you are on debian/ubuntu, you can install using the apt repo, documented below.
apt
package index and install packages to allow apt to use a repository over HTTPS:sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
curl -sL https://repo.chia.net/FD39E6D3.pubkey.asc | sudo gpg --dearmor -o /usr/share/keyrings/chia.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/chia.gpg] https://repo.chia.net/chia-exporter/debian/ stable main" | sudo tee /etc/apt/sources.list.d/chia-exporter.list > /dev/null
sudo apt-get update
sudo apt-get install chia-exporter
First, install chia-blockchain. Chia exporter expects to be run on the same machine as the chia blockchain installation, and will use either the default chia config (~/.chia/mainnet/
) or else the config located at CHIA_ROOT
, if the environment variable is set.
chia-exporter serve
will start the metrics exporter on the default port of 9914
. Metrics will be available at <hostname>:9914/metrics
.
To run Chia exporter in the background and have it automatically start when you boot your computer, you can create a systemd
unit file. If you have installed with apt
or from the .deb
package, the systemd file is installed automatically and you can skip the downloading step below.
Download chia-exporter@.service and copy it to the /etc/systemd/system/
folder on your machine.
Save the file and start the service. Replace [YOUR-USERNAME]
with the username of the user and group you want running the service.
We assume that your username and group name are the same.
sudo systemctl daemon-reload
sudo systemctl start chia-exporter@[YOUR-USERNAME].service
sudo systemctl status chia-exporter@[YOUR-USERNAME].service
The last command should show that the service is Running.
To start chia-exporter at boot:
sudo systemctl enable chia-exporter@[YOUR-USERNAME].service
Configuration options can be passed using command line flags, environment variables, or a configuration file, except for --config
, which is a CLI flag only. For a complete listing of options, run chia-exporter --help
.
To set a config value as an environment variable, prefix the name with CHIA_EXPORTER_
, convert all letters to uppercase, and replace any dashes with underscores (metrics-port
becomes CHIA_EXPORTER_METRICS_PORT
).
To use a config file, create a new yaml file and place any configuration options you want to specify in the file. The config file will be loaded by default from ~/.chia-exporter
, but the location can be overridden with the --config
flag.
metrics-port: 9914
When running alongside the crawler, the exporter can optionally export metrics indicating how many peers have been discovered in each country (based on IP address) and/or how many peers are in each ASN. To enable this functionality, you will need to download the appropriate MaxMind GeoLite2 database and provide the path to the exporter application. The paths can be provided with command line flags, an entry in the config yaml file , or an environment variable . To gain access to the MaxMind DBs, you can register here.
ASN data can cause a huge explosion of labels in prometheus, and as such, it is not recommended to export ASN data to prometheus. We support writing ASN data to MySQL as another supported Grafana datasource instead.
--maxmind-country-db-path /path/to/GeoLite2-Country.mmdb
maxmind-country-db-path: /path/to/GeoLite2-Country.mmdb
CHIA_EXPORTER_MAXMIND_COUNTRY_DB_PATH=/path/to/GeoLite2-Country.mmdb