Post
Topic
Board Mining (Altcoins)
Re: [OS] nvOC easy-to-use Linux Nvidia Mining v0018
by
_Parallax_
on 18/07/2017, 21:43:09 UTC
Hi All,
i made a telegram script to report hash rates and other stats using telegram bot, the stats consists of power draw, temperature and fan speed on my little mining rig.


Hope this script helps...
any suggestion is appreciated Smiley


I use telegram bot for sending allerts from zabbix monitoring system - @crierbot
For using it you need to add @crierbot in to your telegramm  
(if you use android smart phone go to google  play or if use iPhone go to app store, download and install telegram and send command /start )
in replay you will get TOKEN for using in your scripts

My script  /home/m1/telegram.sh  (need to have chmod +x 755)

#!/bin/bash

PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin


/usr/bin/curl -s http://localhost:3333 | sed '/ETH/!d; /Total/!d; /Speed/!d;' | awk {'print $6'} | tail -n 1 >> /tmp/totalhash.log

TOKEN=YOUR-TOKEN
TOTALHASH="$(/bin/cat /tmp/totalhash.log)"
TARGET="$(/bin/cat /home/m1/target.log)"

FAN=$(/usr/bin/nvidia-smi --query-gpu=fan.speed --format=csv)
WATT=$(/usr/bin/nvidia-smi --query-gpu=power.draw --format=csv)
TEMP=$(/usr/bin/nvidia-smi --query-gpu=temperature.gpu --format=csv)
GPUHASH=$(curl -s http://localhost:3333  | sed '/GPU/!d; /Mh/!d' | tr -d font'>
sleep 2

if [[ $TARGET > $TOTALHASH ]]; then
        wget -O /dev/null "http://crierbot.appspot.com/${TOKEN}/send?message=Warning!!!
        host $(cat /etc/hostname) too slow hash
        ip: $(ifconfig | grep inet | grep -v inet6 | grep -v 127.0.0.1 | cut -d: -f2 | awk '{printf $1}')
            $FAN
            $WATT
            $TEMP
            $GPUHASH
Total Hash: $TOTALHASH"
    else
        echo > /dev/null
fi

tee /tmp/totalhash.log < /dev/null
#

Also in directory /home/m1 you need to create file target.log and put in average value - hash your rig.
Then you need to add the record in /etc/crontab
0-59 *  * * *   m1      /home/m1/telegram.sh

This script fullfils once in a minute and checks the descriase of total hash.  
If it descriases it sends message where hostname, IP adress, fan speed, watt, temp and hash of every GPU is shown.