Advertisement
fydel

drk_p2pool_hashrate

Aug 17th, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.00 KB | None | 0 0
  1. !/bin/bash
  2. PATH=/usr/sbin:/usr/bin:/sbin:/bin
  3.  
  4. case $1 in
  5.    config)
  6.         cat <<'EOM'
  7. graph_category p2pool
  8. graph_vlabel local p2pool hashrate
  9. hashrate_dead.label hashrate (if miner perfect)
  10. hashrate.label hashrate
  11. graph_title local p2pool hashrate
  12. EOM
  13.         exit 0;;
  14. esac
  15.  
  16. /usr/bin/wget -q http://happymining.de:7903/local_stats -O /tmp/local_stats.json
  17.  
  18. total=0
  19. total_dead=0
  20.  
  21. for code in $(/usr/local/bin/jshon -e miner_hash_rates -k < /tmp/local_stats.json)
  22. do
  23.     miner=`/usr/local/bin/jshon -Q -e miner_hash_rates -e $code < /tmp/local_stats.json`
  24.     miner_dead=`/usr/local/bin/jshon -Q -e miner_dead_hash_rates -e $code < /tmp/local_stats.json`
  25.  
  26.     total=`echo "scale=2 ; $miner+$total" | bc`
  27.  
  28.     if [[ $miner_dead = *[[:digit:]]* ]] ; then
  29.         total_dead=`echo "scale=2 ; $miner_dead+$total_dead" | bc`
  30.     else
  31.         miner_dead=0
  32.     fi
  33. done
  34.  
  35. total_dead=`echo "scale=2 ; $total_dead+$total" | bc`
  36.  
  37. echo "hashrate_dead.value" $total_dead
  38. echo "hashrate.value" $total
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement