Last active
December 25, 2021 15:53
-
-
Save os11k/497fc47c1648385ba809149ba8583ca1 to your computer and use it in GitHub Desktop.
Kraken prices to file, so we can grab them with node exporter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# script should be located under /adapools directory and statistic file in /adapools/stats directory | |
# mkdir -p /adapools/stats | |
# our crontab entry: | |
# * * * * * /adapools/price.sh | |
# node exporter should be reading /adapools/stats directory something like this: | |
# --collector.textfile.directory=/adapools/stats | |
# following metrics should be availlable in grafana, if you did everything right - adaeur, adausd, btcusd & ethusd | |
PRICES=$(curl -s https://api.kraken.com/0/public/Ticker?pair=ADAEUR,ADAUSD,XXBTZUSD,XETHZUSD) | |
echo $PRICES | jq .result.ADAEUR.c | jq .[0] | sed 's/"//g'| sed 's/^/adaeur /' > /adapools/stats/price.prom | |
echo $PRICES | jq .result.ADAUSD.c | jq .[0] | sed 's/"//g'| sed 's/^/adausd /' >> /adapools/stats/price.prom | |
echo $PRICES | jq .result.XXBTZUSD.c | jq .[0] | sed 's/"//g'| sed 's/^/btcusd /' >> /adapools/stats/price.prom | |
echo $PRICES | jq .result.XETHZUSD.c | jq .[0] | sed 's/"//g'| sed 's/^/ethusd /' >> /adapools/stats/price.prom |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment