Skip to content

Instantly share code, notes, and snippets.

@ralberts
Last active March 11, 2018 16:02
Show Gist options
  • Save ralberts/acf0cc28fbea96b1da67f611fef4d40b to your computer and use it in GitHub Desktop.
Save ralberts/acf0cc28fbea96b1da67f611fef4d40b to your computer and use it in GitHub Desktop.
Antminer Temps

Antminer Scripts

Here is a quick script to check and monitor the temperature of the antminer machine. This script can be placed right on the antminer and run in a loop. This was just a quick and dirty way to start monitoring. I am sure there are better ways though searching on the internet I hadn't found anything documented as well to find the correct api's for direct access.

#!/bin/bash
if [ -e SENT_MESSAGE ]; then
echo "Message sent already"
exit 0;
fi
OUTPUT=$(curl --digest --user 'root:root' http://<LOCAL_URL_TO_ANTMINER/cgi-bin/minerStatus.cgi)
RESULTOLD=$(echo $OUTPUT | sed -n 's/.*cbi-table-1-temp2\">\([0-9][0-9]\)<.*/\1 \2/p')
RESULT=$(echo $OUTPUT | grep -o 'cbi-table-1-temp2\">\([0-9][0-9]\)<' | while read line ; do echo $line | sed 's/cbi-table-1-temp2">//' | sed 's/<.*//' ; done)
echo "Result: $RESULT"
TOP=0
for i in $(echo $RESULT | tr " " "\n")
do
echo "...$i..."
num=$(($i + 0))
if [[ $num -gt $TOP ]]; then
TOP=$num
fi
done
echo "Hotest number: $TOP"
if [[ $TOP -gt 80 ]]; then
echo "Antminer too hot: $TOP"
echo "Calling script to send sms message"
# CALL SMS SCRIPT HERE
# This could be twilio, slack, or some other service
touch SENT_MESSAGE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment