-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import json | ||
import requests | ||
import time | ||
import os | ||
|
||
# pool hash check, reboot if hash lower than desired_hash times_to_check times in a row | ||
address = "696b18d7e003be5b4d1a66b981313e1959d69066" | ||
desired_hash = 169000000 | ||
times_to_check = 3 | ||
worker_name = "worker001" # I don't think it's case sensitive | ||
|
||
desired_log = [] | ||
|
||
time.sleep(60) | ||
|
||
while times_to_check > 0: | ||
time.sleep(600) | ||
try: | ||
r = requests.get(f'https://api.ethermine.org/miner/:{address}/workers') | ||
found_worker = False | ||
|
||
for worker in r.json()["data"]: | ||
|
||
if worker["worker"] == worker_name: | ||
|
||
if worker["reportedHashrate"] < desired_hash: | ||
current_hash = worker["reportedHashrate"] | ||
print(f"low hash detected: {current_hash}") | ||
desired_log.append(False) | ||
|
||
else: | ||
print("satisfactory hashrate") | ||
desired_log.append(True) | ||
|
||
found_worker = True | ||
break | ||
|
||
if found_worker == False: | ||
print("worker not found on pool") | ||
desired_log.append(False) | ||
|
||
except requests.ConnectionError: | ||
print("error, no internet") | ||
desired_log.append(False) | ||
except AttributeError: | ||
print("not logged on yet") | ||
desired_log.append(False) | ||
|
||
times_to_check -= 1 | ||
|
||
if any(desired_log): | ||
print("satisfactory") | ||
else: | ||
os.system("shutdown -t 10 -r") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import json | ||
import requests | ||
import time | ||
import os | ||
|
||
# pool hash check, reboot if hash lower than desired_hash times_to_check times in a row | ||
address = "696b18d7e003be5b4d1a66b981313e1959d69066" | ||
desired_hash = 169000000 | ||
times_to_check = 3 | ||
worker_name = "WORKER001" # note: case sensitive | ||
|
||
desired_log = [] | ||
|
||
time.sleep(60) | ||
|
||
while times_to_check > 0: | ||
time.sleep(600) | ||
try: | ||
r = requests.get(f'https://hiveon.net/api/v1/stats/miner/{address}/ETH/workers') | ||
worker_data = r.json()["workers"][worker_name] | ||
|
||
if int(worker_data["reportedHashrate"]) < desired_hash: | ||
current_hash = r.json()["reportedHashrate"] | ||
print(f"low hash detected: {current_hash}") | ||
desired_log.append(False) | ||
else: | ||
print("satisfactory hashrate") | ||
desired_log.append(True) | ||
|
||
except requests.ConnectionError: | ||
print("error, no internet") | ||
desired_log.append(False) | ||
except KeyError: | ||
print("not in pool") | ||
desired_log.append(False) | ||
|
||
times_to_check -= 1 | ||
|
||
if any(desired_log): | ||
print("satisfactory") | ||
else: | ||
os.system("shutdown -t 10 -r") |