Skip to content

Instantly share code, notes, and snippets.

@os11k
Last active December 25, 2021 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save os11k/497fc47c1648385ba809149ba8583ca1 to your computer and use it in GitHub Desktop.
Save os11k/497fc47c1648385ba809149ba8583ca1 to your computer and use it in GitHub Desktop.
Kraken prices to file, so we can grab them with node exporter
# 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