There is an idea how to more standartize the logs of programs for further processing them in scripts, notifications and monitoring:
I propose to do:
1) Create file .screenrc in /home/m1 with content:
#
acladd root
multiuser on
logfile flush 1
log on
logfile /tmp/miner.output.tmp
caption always
caption string "%{= RW} $STY | host: %H | For return to terminal press: Ctrl+a d | %m/%d/%y %c:%s | go go to the mooooooon
"
#
2) In the 1bash file, replace the line of the
screen -dmS miner $HCD -S $ETH_POOL -O $ETHADDR:x -U
on
/usr/bin/screen -c /home/m1/.screenrc -l -L -dmS miner $HCD -S $ETH_POOL -O $ETHADDR:x -U
For genoil, I use this script:
telegram.sh
#====================
#!/bin/bash
PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/usr/bin/tee /tmp/totalhash.log < /dev/null
/usr/bin/tail -n 1 /tmp/miner.log | awk '{print $2}' >> /tmp/totalhash.log
TOKEN=YOU_TELEGRAM_BOT_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 | awk '{print $1}' | tr '\n' ','|sed -e 's/,/ /g' -e 's/, $/\n/')
WATT=$(/usr/bin/nvidia-smi --query-gpu=power.draw --format=csv | awk '{print $1}' | tr '\n' ','|sed -e 's/,/ /g' -e 's/, $/\n/')
TEMP=$(/usr/bin/nvidia-smi --query-gpu=temperature.gpu --format=csv | awk '{print $1}' | tr '\n' ','|sed -e 's/,/ /g' -e 's/, $/\n/')
UPTIME=$(/usr/bin/uptime -p)
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}')
$UPTIME
$FAN
$WATT
$TEMP
Total Hash: $TOTALHASH"
else
echo > /dev/null
fi
/usr/bin/tee /tmp/miner.log < /dev/null
/usr/bin/tail -n 10 /tmp/miner.output.tmp | grep MH/s | awk '{print $3, $9}' | tr -d MH/s >> /tmp/miner.log
/usr/bin/tee /tmp/miner.output.tmp < /dev/null
#=====================
I created the /home/m1/target.log file and entered the approximate value of HASH for RIG
In crontab, I added the line that is executed every 3 minutes
*/3 * * * * m1 /home/m1/telegram.sh
The script compares the value from the /home/m1/target.log file with the value that
the /tmp/totalhash.log receives from the file and if there is a difference, sends me a notification.
I hope that our community optimizes this script and writes more universal, which wil work with all mining programs.