Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/!/bin/bash
- #script to feed influxDB with rigg var from /run/ethos/stats.file
- # influxDB variable
- host=10.0.1.7
- port=8086
- user=
- password=
- # The database we created
- dbname=riggs
- # Sample period (s)
- interval=300
- #time=$(date --utc +%Y%m%d_%H%M%SZ)
- hostname=$(grep "hostname:" /run/ethos/stats.file | sed 's/.*://')
- rack_loc=$(grep "rack_loc:" /run/ethos/stats.file | sed 's/.*://')
- #ip=$(grep "ip" /run/ethos/stats.file | sed 's/.*://' | head -n 1)
- #echo $ip
- #curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "ip,host=$hostname value=""$ip"""
- #version=$(grep "version" /run/ethos/stats.file | sed 's/.*://' | tail -n 1)
- #curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "version,host=$hostname value="$version""
- defunct=$(grep "defunct:" /run/ethos/stats.file | sed 's/.*://')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "defunct,host=$hostname value="$defunct""
- overheat=$(grep "overheat" /run/ethos/stats.file | sed 's/.*://')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "overheat,host=$hostname value="$overheat""
- rx_kbps=$(grep "rx_kbps" /run/ethos/stats.file | sed 's/.*://')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "rx_kbps,host=$hostname value="$rx_kbps""
- tx_kbps=$(grep "tx_kbps" /run/ethos/stats.file | sed 's/.*://')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "tx_kbps,host=$hostname value="$tx_kbps""
- uptime=$(grep "uptime" /run/ethos/stats.file | sed 's/.*://')
- #miner=$(show stats | grep "miner:" | head -n 1 | awk '{print $2}')
- #curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "miner,host=$hostname value="$miner""
- #miner_ver=$(grep "version" /run/ethos/stats.file | sed 's/.*://' | head -n 1)
- miner_secs=$(grep "miner_secs" /run/ethos/stats.file | sed 's/.*://')
- load=$(grep "load" /run/ethos/stats.file | sed 's/.*://')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "load,host=$hostname value="$load""
- cpu_temp=$(grep "cpu_temp" /run/ethos/stats.file | sed 's/.*://')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "cpu_temp,host=$hostname value="$cpu_temp""
- gpus=$(grep "gpus" /run/ethos/stats.file | sed 's/.*://')
- #curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "gpus,host=$hostname value="$gpus""
- totalHash=$(grep "hash:" /run/ethos/stats.file | sed 's/.*://' | tail -n 1)
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "total_hash,host=$hostname value="$totalHash""
- #Populate GPU temps
- i=1
- while [ $i -le $gpus ]
- do
- GPUtemp[$i]=$(grep 'temp:' /run/ethos/stats.file | sed 's/.*://' | tail -n 1 | tr -s ' ' | cut -f$i -d' ')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "gputemp,host=$hostname,gpu=$i value="${GPUtemp[$i]}""
- ((i++))
- done
- #Populate GPU Hash
- i=1
- while [ $i -le $gpus ]
- do
- GPUhash[$i]=$(grep 'miner_hashes:' /run/ethos/stats.file | sed 's/.*://' | head -n 1 | tr -s ' ' | cut -f$i -d' ')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "gpuhash,host=$hostname,gpu=$i value="${GPUhash[$i]}""
- ((i++))
- done
- #Populate GPU fan RPM
- i=1
- while [ $i -le $gpus ]
- do
- GPUfan[$i]=$(grep 'fanrpm:' /run/ethos/stats.file | sed 's/.*://' | tr -s ' ' | cut -f$i -d' ')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "fanrpm,host=$hostname,gpu=$i value="${GPUfan[$i]}""
- ((i++))
- done
- #Populate GPU volts
- i=1
- while [ $i -le $gpus ]
- do
- GPUvolt[$i]=$(grep 'voltage:' /run/ethos/stats.file | sed 's/.*://' | tr -s ' ' | cut -f$i -d' ')
- curl -i -XPOST "http://$user:$password@$host:$port/write?db=$dbname" --data-binary "gpuvolt,host=$hostname,gpu=$i value="${GPUvolt[$i]}""
- ((i++))
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement