2020-07-03 14:52:40 +00:00
|
|
|
# lotus-stats
|
2019-10-12 00:13:16 +00:00
|
|
|
|
2020-07-03 14:52:40 +00:00
|
|
|
`lotus-stats` is a small tool to push chain information into influxdb
|
2019-10-12 00:13:16 +00:00
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
Influx configuration can be configured through env variables.
|
|
|
|
|
|
|
|
```
|
2021-08-26 23:55:46 +00:00
|
|
|
LOTUS_STATS_INFLUX_ADDR="http://localhost:8086"
|
|
|
|
LOTUS_STATS_INFLUX_USER=""
|
|
|
|
LOTUS_STATS_INFLUX_PASS=""
|
2019-10-12 00:13:16 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2021-08-26 23:55:46 +00:00
|
|
|
lotus-stats will look in `~/.lotus` to connect to a running daemon and resume collecting stats from last record block height.
|
2019-10-12 00:13:16 +00:00
|
|
|
|
2020-07-03 14:52:40 +00:00
|
|
|
For other usage see `./lotus-stats --help`
|
2019-10-12 00:13:16 +00:00
|
|
|
|
|
|
|
```
|
2020-07-03 14:52:40 +00:00
|
|
|
go build -o lotus-stats *.go
|
2021-08-26 23:55:46 +00:00
|
|
|
. env.stats && ./lotus-stats run
|
2019-10-12 00:13:16 +00:00
|
|
|
```
|
|
|
|
|
2021-08-26 23:55:46 +00:00
|
|
|
For large networks there is an additional query in the `Top Miner Power` table, which can be toggled on to only show miners larger
|
|
|
|
than 1 PiB. This is a good option to enable to reduce the number of miners listed when viewing mainnet stats.
|
2019-10-12 00:13:16 +00:00
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
Start grafana and influxdb containers and import the dashboard to grafana.
|
|
|
|
The url of the imported dashboard will be returned.
|
|
|
|
|
|
|
|
If the script doesn't work, you can manually setup the datasource and import the dashboard.
|
|
|
|
|
|
|
|
```
|
|
|
|
docker-compose up -d
|
|
|
|
./setup.bash
|
|
|
|
```
|
|
|
|
|
|
|
|
The default username and password for grafana are both `admin`.
|
2021-08-26 23:55:46 +00:00
|
|
|
|
|
|
|
## Updating the dashboard
|
|
|
|
|
|
|
|
After importing the provided dashboard in `chain.dashboard.json`, you may make changes to the dashboard. To export
|
|
|
|
the dashboard to be commited back to the project, make sure the option "sharing externally" is toggled on.
|