Also credit to sanskys for documenting original procedure for adapools
Step 1 - Copy Link to json File from Cexplorer
Copy your Json file from Cexplorer.io. Navigate to your pool then click on Share Tab. Then scroll down to "Data" and copy link to "JSON data output" file. Copy URL.
Keep this URL you will need it later
click on Share Tab
scroll down to "Data" copy link to "JSON data output"
Copy URL
Step 2 - Create poolStat Directory
Create poolStat directory by running the following commands:
Step 3 -Create script getstat.sh
Now we will create a script in the poolStat directory to pull pool stat json file and trim non-numeric strings.
Prometheus can work only with numeric data, so we must trim non-numeric strings which is returned from the JSON file provided by Cexplorer.
Replace "https://js.cexplorer.io/api-static/pool/poolID.json" with the URL that you copied from Step 1
Step 4 - Add Permissions and Run the getstat Script
Add permissions and run getstat script by running these commands:
Step 5 - Check Output File
Check output file to make sure it contains only numeric values by running:
Step 6 - Configure Prometheus to Grab Data from poolStat.prom File
Configure prometheus-node-exporter.service to grab data from poolStat.prom file.
First let's backup the prometheus-node-exporter.service file by running the following:
Then let's edit file by running the following command:
Now we need to change ExecStart line to:
Replace "< YOUR NODE FULL PATH >"
Hint: to find your full path run:
cd $NODE_HOME
readlink -f poolStat
Step 7 - Change Default User for prometheus-node-exporter.service
hange the default user to your Linux user name in prometheus-node-exporter.service. Replace below.
Or Alternatively: The default user of prometheus-node-exporter is “prometheus”. So, you could give the user “prometheus” read and write rights for poolStat.prom
Step 8 - Reload Daemon and Restart Services
Reload daemon and restart services by running:
Verify that the services are running properly:
Step 9 - Setup Cron Job to Update Data
The data will constantly change so we need to setup a cron job to grab the new data every so often. In this example we will grab new data every 6 hours.
First run:
Add the following to your cronjobs.
Replace "<YOUR NODE FULL PATH>"
Hint: to find your full path run:
find ~+ -type f -name getstats.sh
Step 10 - Display Data in Grafana
Now for your data source select Prometheus:
Select Prometheus for Data source
Now you should see all the "cexplorer_" Metrics
Some of the data you might want to display:
Remember amounts are given in lovelace so you need to divide by 1,000,000 to display in ADA
Pledge = (cexplorer_pledge)/1000000
Active Stake = (cexplorer_stake)/1000000
Lifetime Blocks = cexplorer_blocks_lifetime
Estimated Blocks per Epoch = cexplorer_blocks_est_epoch
Lifetime ROA = cexplorer_roa_lifetime
Current Number of Delegators = cexplorer_delegators
Pool Rank = cexplorer_position
Lifetime Luck = (cexplorer_luck_lifetime)*100
Congratulations you did it!
Contributors
Thanks to the following pools for helping to put together these guides. Please consider delegating to their pools to support them. Are you a pool? Consider buying them a coffee