Skip to content

Prometheus exporter for lotus-daemon and lotus-miner metrics.

License

Notifications You must be signed in to change notification settings

renkeju/lotus_exporter

Repository files navigation

Prometheus Lotus Metrics Exporter

Docker Image Version (latest by date) Docker Pulls Docker Cloud Automated build Docker Cloud Build Status

Prometheus exporter for lotus-daemon and lotus-miner metrics.

grafana FullNode dashboard

grafana Miner dashboard

Building and running the exporter

Run locally

git clone https://github.com/renkeju/lotus_exporter.git
cd lotus_exporter

Get lotus environment variables

lotus auth api-info --perm admin
FULLNODE_API_INFO=asdfghjklqwertyuiopzxcvbnmdqdwewfvde.hlawbdhajkhjksdjhbhchjajdbjbdkjahcvajbajkdlkjLkhkljwhcl.qghjhjbkjvhuiujoi2bf2ufjdnfbajjkhkjkjbcnali:/ip4/127.0.0.1/tcp/1234/http
lotus-miner auth api-info --perm admin
MINER_API_INFO=REYTUIBKY78hqckjdkbadsiwbkasvbafodiv.khq2hkjdhqbdhjqyhlufh89jk23njjhbfvHglwlvwjcakjcbiuvjkh2.kjwfbqebfvjh923brj2jef9rkkcjvjevkjoiekjfvnf:/ip4/127.0.0.1/tcp/2345/http

use os environments variables

export FULLNODE_API_INFO=asdfghjklqwertyuiopzxcvbnmdqdwewfvde.hlawbdhajkhjksdjhbhchjajdbjbdkjahcvajbajkdlkjLkhkljwhcl.qghjhjbkjvhuiujoi2bf2ufjdnfbajjkhkjkjbcnali:/ip4/127.0.0.1/tcp/1234/http
export MINER_API_INFO=REYTUIBKY78hqckjdkbadsiwbkasvbafodiv.khq2hkjdhqbdhjqyhlufh89jk23njjhbfvHglwlvwjcakjcbiuvjkh2.kjwfbqebfvjh923brj2jef9rkkcjvjevkjoiekjfvnf:/ip4/127.0.0.1/tcp/2345/http
python3 main.py --port=9993 --addr=127.0.0.1

If there is no error in executing the command locally, you can use the systemd management service.

git clone https://github.com/renkeju/lotus_exporter.git
mv lotus_exporter /opt/lotus_exporter

Copy the following content and add it to the lotus_exporter.service file in the /etc/systemd/system directory.

[Unit]
Description=Prometheus Lotus Exporter
After=network-online.target

[Service]
WorkingDirectory=/opt/lotus_exporter

Environment=FULLNODE_API_INFO=asdfghjklqwertyuiopzxcvbnmdqdwewfvde.hlawbdhajkhjksdjhbhchjajdbjbdkjahcvajbajkdlkjLkhkljwhcl.qghjhjbkjvhuiujoi2bf2ufjdnfbajjkhkjkjbcnali:/ip4/127.0.0.1/tcp/1234/http
Environment=MINER_API_INFO=REYTUIBKY78hqckjdkbadsiwbkasvbafodiv.khq2hkjdhqbdhjqyhlufh89jk23njjhbfvHglwlvwjcakjcbiuvjkh2.kjwfbqebfvjh923brj2jef9rkkcjvjevkjoiekjfvnf:/ip4/127.0.0.1/tcp/2345/http

Type=simple
User=lotus-exp
Group=lotus-exp
ExecStart=/usr/bin/python3 main.py --port 9993 --addr 127.0.0.1

SyslogIdentifier=lotus_exporter
Restart=always
RestartSec=1800
StartLimitInterval=0

ProtectHome=yes
NoNewPrivileges=yes

ProtectSystem=strict
ProtectControlGroups=true

Create a system user and a system group for lotus_exporter.service

groupadd -r lotus-exp
useradd -r -M -g lotus-exp lotus-exp
chown lotus-exp.lotus-exp -R /opt/lotus_exporter
apt -y install python3-pip
pip3 install -r /opt/lotus_exporter/requirements.txt

Start service

systemctl daemon-reload
systemctl start lotus_exporter.service

Build Docker Image

git clone https://github.com/renkeju/lotus_exporter.git
cd lotus_exporter
docker build . -t lotus_exporter:latest

Run Docker

docker run -d \
    --network=host \
    --rm \
    -e MINER_API_INFO=REYTUIBKY78hqckjdkbadsiwbkasvbafodiv.khq2hkjdhqbdhjqyhlufh89jk23njjhbfvHglwlvwjcakjcbiuvjkh2.kjwfbqebfvjh923brj2jef9rkkcjvjevkjoiekjfvnf:/ip4/127.0.0.1/tcp/2345/http \
    -e FULLNODE_API_INFO=asdfghjklqwertyuiopzxcvbnmdqdwewfvde.hlawbdhajkhjksdjhbhchjajdbjbdkjahcvajbajkdlkjLkhkljwhcl.qghjhjbkjvhuiujoi2bf2ufjdnfbajjkhkjkjbcnali:/ip4/127.0.0.1/tcp/1234/http \
    -e DEFAULT_PORT=9993 \
    -e DEFAULT_ADDR=127.0.0.1 \
    -v /etc/localtime:/etc/localtime \
    lotus_exporter:latest

P.S.: It is recommended to use the host network model. This way promethes will be more convenient to obtain data.

Features

  • daemon
    • Chain Sync State
    • BaseFee
    • Network
    • Wallet Balance
    • Local Message Pool Pending
  • miner
    • Wallet Balance
    • Power & Sectors States(Off by default)
    • Sectors Jobs
    • Network
    • Actor Control Wallet Balance
    • Daels
    • Daedlines

Support

MoyMI Logo

About

Prometheus exporter for lotus-daemon and lotus-miner metrics.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published