Hey guys and gals. I wrote a python script that interacts with the Kano API and sends a pushover notification to my mobile device if my hashrate falls below X. Not sure if it would benefit anyone here.
Here's my code:
https://github.com/wobbzz/kanocheck/blob/master/checkhashrate.pyOne limitation is that it uses the same hashrate check for every miner, but this could be easily changed by manually defining your workers in a dictionary.
I haven't look at it, and I can't stand a language that decides code execution based on invisible characters ... so I avoid python completely ... and no that's not a complaint about your code
Just thought I'd mention that
However, to know something of the statistics of workers ...
To know that a worker has stopped is quite simple:
If it hasn't sent a share for 1 minute
1 minute is the best choice
The stats work as follows:
A worker is expected to send 18 shares per minute = 1 share per 3.3333 seconds.
Shares are like blocks, they follow the same poisson distribution of course since blocks are shares
So 30 seconds for a share, would be like a 30/3.3333 = 900% block.
However, of course, you find WAY more shares than blocks.
We expect, on average, a >900% share once every 8103.1 shares.
But since shares come in WAY more often than blocks
(18 * 60 * 24) / 8103.1 gives about 3.2 times a day, a 30 second check would fail and say the worker is down.
At one minute, would be 60/3.3333 = >1800% share = on average, once every 65,659,969 shares
i.e. about once every ... 2533 days ... or about once every ~7 years
So going from 30 seconds to only 60 seconds makes the test exceptionally unlikely to be wrong.
So yep, a VERY reliable test on a worker (if it has only one miner) is that it hasn't submitted a share for 60 seconds.
The API provides the time of the API request and the time of the last share.
Of course you also need to handle when the API isn't working when I do a CKDB restart
Edit: and of course the cgminer API has this same information.
...
of course, don't forget that if you had 2533 miners, you'd expect, on average, one each day to fail the 1 minute test.
Go to 2 minutes and then, yeah, you'd need all the miners on the planet to fail a 2 minute test.
(Edit: 2 minutes is one in ... 4.5x10^14 shares)