Post
Topic
Board Mining (Altcoins)
Re: [OS] nvOC easy-to-use Linux Nvidia Mining v0018
by
fullzero
on 19/07/2017, 07:18:55 UTC
I saw post from BaliMiner. Thanks for your post! I decided to split in with my email notification script.
But I decided ti use original telegram-notify tool.

fullzero, please update this too.

Here is my result:

To install telegram-notification may be added to first boot section (from http://bernaerts.dyndns.org/linux/75-debian/351-debian-send-telegram-notification) thanks
Quote

settings section or file
Quote
EMAIL="YES"
 
TELEGRAM="YES"
TELEGRAM_API="your-api-key"
TELEGRAM_CHAT="your-chat-id"

start onebash section:
Quote
if [ $TELEGRAM == "YES" ]
then
echo "[general]" > ~/telegram-notify.conf
echo "api-key=$TELEGRAM_API" >> ~/telegram-notify.conf
echo "user-id=$TELEGRAM_CHAT" >> ~/telegram-notify.conf
sudo mv /home/m1/telegram-notify.conf /etc/telegram-notify.conf
fi


mail.sh file :
Quote
#!/bin/bash
MSM_NUM=$1
source ~/wallets
source ~/settings.sh

MSG=""
IMG=""
DOC=""

case $MSM_NUM in
     0)
     MSG="System was started"
     IMG="--success"
          ;;
     1)
     MSG="GPU Miner was started"
     IMG="--success"
          ;;
     2)
     MSG="CPU Miner was started"
     IMG="--success"
          ;;
     3)
     MSG="GPU miner was crushed and restarting now"
     IMG="--error"
     DOC="--document "/home/m1/4_restartlog""
          ;;
     4)
     MSG="New setiings arrived. Restart now"
     IMG="--question"
     DOC="--document "/home/m1/wallets.diff""
          ;;
     5)
     MSG="Lost GPU so restarting system"
     IMG="--error"
     DOC="--document "/home/m1/4_restartlog""
          ;;
     6)
     MSG="Utilization is too low: so restarting system"
     IMG="--error"
     DOC="--document "/home/m1/4_restartlog""
          ;;
     7)
     MSG="NICEHASH was started just now!"
     IMG="--success"
          ;;
     Cool
     IP=$(cat /home/m1/last_ip)
     MSG="webUI was started just now http://$IP/"
     IMG="--success"
          ;;
     *)
     TEMP=$(/usr/bin/nvidia-smi --query-gpu=temperature.gpu --format=csv)
     PD=$(/usr/bin/nvidia-smi --query-gpu=power.draw --format=csv)
     FAN=$(/usr/bin/nvidia-smi --query-gpu=fan.speed --format=csv)
     LF=$'\n'
     PROFIT=$(cat /home/m1/current-profit)
     MSG=$TEMP$LF$PD$LF$FAN
     #MSG="$WORKER_NAME Error with subject!"
          ;;
esac
# telegram-notify --success --text "Action *sucessful* with markdown *bold* example"
# telegram-notify --error --title "Error" --text "Error message with a title"
# telegram-notify --question --title "File content display" --text "/tmp/log.txt"
# telegram-notify --icon 1F355 --text "Message with custom icon 1F355 and embedded image" --photo "/tmp/icon.png"
# telegram-notify --text "Result is available in the embedded document" --document "/tmp/result.log"

if [ $EMAIL == "YES" ]
then
sendemail -f $RIG_EMAIL -t $ADMIN_EMAIL -u $WORKER_NAME -m "$MSG" -s $RIG_SMTP -o tls=yes -xu $RIG_EMAIL -xp $RIG_EMAIL_PASS & > /dev/null 2>&1
fi

if [ $TELEGRAM == "YES" ]
then
MSG=""$WORKER_NAME" - "$MSG
telegram-notify ${IMG} --text "${MSG}" ${DOC} --html > /dev/null 2>&1
fi


fullzero, also here is my btc address 1GFTEtLLvvwoa4ogDntD5oaXBgJLYokzTC

Maybe it is time to move with your code to github ? A lot of people what to make some fixes, addons and so on.

I used a modified version of your paste updating method in the new 1bash + upPASTE.

I still need to implement a bunch more.  I will make a github repo when most of the requests have been implemented; then focus on optimization. 


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.


BaliMiner please provide a BTC address for the next version.