So am I right in thinking I would need a dedicated computer to run software to poll the URL showing my user stats and notify me for each worker than goes to 0 hashrate? It does seem simple...
I have a programmer friend I will ask to see if he can figure this out for me, but if anyone thinks its easy and is interested, I would pay them in BTC to help me set it up. PM me if it seems like a reasonably easy / interesting project.
Here you go:
import json
import time
import urllib2
for x in range(10):
response = urllib2.urlopen('http://ckpool.org/users/12PbPgw7e5SANspLJYezBxsi4ociS1PBiK')
miners = json.loads(response.read())
for miner in miners['worker']:
if miner['hashrate1m'] == '0':
print 'poll {}: Worker {} has stopped hashing'.format(x, miner['workername'])
time.sleep(2)
It's not pretty, but fairly simple. You can make it as fancy as you like. One thing I would consider is rather than alert you when hashrate1m goes to zero, may wait for three polls before alerting, or maybe check hashrate5m instead.
Here is the output:
poll 0: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 1: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 2: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 3: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 4: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 5: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 6: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 7: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 8: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 9: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
The for loop could be changed to a
while true loop so it runs forever, and the
time.sleep(2) could be changed so that the polling happens less frequently, say
time.sleep(60), so the polls happen once per minute. To see if it works for you, change
12PbPgw7e5SANspLJYezBxsi4ociS1PBiK to your BTC address. If you use multiple BTC addresses you would need to iterate over all of them with another loop:
import json
import time
import urllib2
btc_addresses = ['12PbPgw7e5SANspLJYezBxsi4ociS1PBiK',
'12PbPgw7e5SANspLJYezBxsi4ociS1PBiK',
'12PbPgw7e5SANspLJYezBxsi4ociS1PBiK']
for x in range(10):
for btc_address in btc_addresses:
response = urllib2.urlopen('http://ckpool.org/users/{}'.format(btc_address))
miners = json.loads(response.read())
for miner in miners['worker']:
if miner['hashrate1m'] == '0':
print 'poll {}: Worker {} has stopped hashing'.format(x, miner['workername'])
time.sleep(2)
And the output from this one:
poll 0: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 0: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 0: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 1: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 1: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 1: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 2: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 2: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 2: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 3: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 3: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 3: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 4: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 4: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 4: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 5: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 5: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 5: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 6: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 6: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 6: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 7: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 7: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 7: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 8: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 8: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 8: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 9: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 9: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing
poll 9: Worker 12PbPgw7e5SANspLJYezBxsi4ociS1PBiK.Compac1 has stopped hashing