getminera / minera

Minera is a web interface to monitor and manage mining devices
http://getminera.com
Other
372 stars 156 forks source link

Miner detection fails on D3 #194

Closed stangerm2 closed 5 years ago

stangerm2 commented 6 years ago

I'm running 16 D3s with cgminer 4.10 and none will show as online on the dashboard. I've tried both manual & auto add methods. Though when I manually add it shows online in the settings section, but again no dashboad info populates. I'm using the Raspberry Pi (3) pre-build image and when I ssh into minera I can run a 'curl miner-addr:4028' and I get back a response from the miner api. I can run tcpdump on port 4028 on minera and see it hitting the miner as well. Any idea's what's going on?

michelem09 commented 6 years ago

What Minera version do you have? You need 0.9.0

stangerm2 commented 6 years ago

Ya I used the 0.9.0 image that was hosted in the getting started link and after encountering the issues, I even did the 'git fetch' & './upgrade_minera.sh' steps to make sure I was on the latest. It also clearly shows 0.9.0 in the top right 'help' button. Is there anything specific I can look at on the system/logs for what is going on?

ps. I'm an experienced embedded linux dev so please don't shy away from technicalities.

michelem09 commented 6 years ago

mmm, that's weird, please get a terminal on your Minera and run this command against a D3 IP:

echo '{"command":"summary+stats+pools"}' | nc <D3-IP> 4028

And let me know if you get something.

gnanet commented 6 years ago

I see you know that the D3 presents invalid JSON on the STATS request...

It will be a local issue to you @nimjox , because normally you should get something similar, to the output below (its an anonimized version of the complete output of a D3) :

{"summary":[{"STATUS":[{"STATUS":"S","When":1513810279,"Code":11,"Msg":"Summary","Description":"cgminer 4.9.0"}],"SUMMARY":[{"Elapsed":246617,"GHS 5s":"18930.5","GHS av":19326.10,"Found Blocks":0,"Getworks":61832,"Accepted":"  7.0000","Rejected":"  7.0000","Hardware Errors":2698,"Utility":6.90,"Discarded":269028,"Stale":0,"Get Failures":4,"Local Work":1669500,"Remote Failures":0,"Network Blocks":1563,"Total MH":4766142462.0000,"Work Utility":269.00,"Difficulty Accepted":1105376.75517130,"Difficulty Rejected":305.02857537,"Difficulty Stale":0.00000000,"Best Share":769335,"Device Hardware%":0.2434,"Device Rejected%":0.0276,"Pool Rejected%":0.0276,"Pool Stale%":0.0000,"Last getwork":1513810278}],"id":1}],"stats":[{"STATUS":[{"STATUS":"S","When":1513810279,"Code":70,"Msg":"CGMiner stats","Description":"cgminer 4.9.0"}],"STATS":[{"CGMiner":"4.9.0","Miner":"1.0.0.6","CompileTime":"Thu Aug 31 13:38:33 CST 2017","Type":"Antminer D3"}{"STATS":0,"ID":"D10","Elapsed":246617,"Calls":0,"Wait":0.000000,"Max":0.000000,"Min":99999999.000000,"GHS 5s":"18930.5","GHS av":19326.10,"miner_count":3,"frequency":"537","fan_num":2,"fan1":6240,"fan2":6210,"temp_num":3,"temp1":47,"temp2":45,"temp3":48,"temp4":0,"temp2_1":63,"temp2_2":62,"temp2_3":63,"temp2_4":0,"temp_max":48,"Device Hardware%":0.0304,"no_matching_work":2698,"chain_acn1":60,"chain_acn2":60,"chain_acn3":60,"chain_acn4":0,"chain_acs1":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooo","chain_acs2":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooo","chain_acs3":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooo","chain_acs4":"","chain_hw1":1609,"chain_hw2":405,"chain_hw3":684,"chain_hw4":0,"chain_rate1":"6290.62","chain_rate2":"6298.97","chain_rate3":"6340.89","chain_rate4":""}],"id":1}],"pools":[{"STATUS":[{"STATUS":"S","When":1513810279,"Code":7,"Msg":"3 Pool(s)","Description":"cgminer 4.9.0"}],"POOLS":[{"POOL":0,"URL":"ANONYMIZED","Status":"Dead","Priority":0,"Quota":0,"Long Poll":"N","Getworks":0,"Accepted":0,"Rejected":0,"Discarded":0,"Stale":0,"Get Failures":0,"Remote Failures":0,"User":"ANONYMIZED","Last Share Time":"0","Diff":"  0.0000","Diff1 Shares":0,"Proxy Type":"","Proxy":"","Difficulty Accepted":0.00000000,"Difficulty Rejected":0.00000000,"Difficulty Stale":0.00000000,"Last Share Difficulty":0.00000000,"Has Stratum":true,"Stratum Active":false,"Stratum URL":"","Has GBT":false,"Best Share":"  0.0000","Pool Rejected%":0.0000,"Pool Stale%":0.0000},{"POOL":1,"URL":"ANONYMIZED","Status":"Alive","Priority":1,"Quota":0,"Long Poll":"N","Getworks":61832,"Accepted":28360,"Rejected":7,"Discarded":269028,"Stale":0,"Get Failures":4,"Remote Failures":0,"User":"ANONYMIZED","Last Share Time":"0:00:32","Diff":" 40.4511","Diff1 Shares":8876660,"Proxy Type":"","Proxy":"","Difficulty Accepted":1105376.75517130,"Difficulty Rejected":305.02857537,"Difficulty Stale":0.00000000,"Last Share Difficulty":66.74425479,"Has Stratum":true,"Stratum Active":true,"Stratum URL":"ANONYMIZED","Has GBT":false,"Best Share":"  0.0000","Pool Rejected%":0.0276,"Pool Stale%":0.0000},{"POOL":2,"URL":"","Status":"Dead","Priority":2,"Quota":0,"Long Poll":"N","Getworks":0,"Accepted":0,"Rejected":0,"Discarded":0,"Stale":0,"Get Failures":0,"Remote Failures":0,"User":"","Last Share Time":"0","Diff":"  0.0000","Diff1 Shares":0,"Proxy Type":"","Proxy":"","Difficulty Accepted":0.00000000,"Difficulty Rejected":0.00000000,"Difficulty Stale":0.00000000,"Last Share Difficulty":0.00000000,"Has Stratum":false,"Stratum Active":false,"Stratum URL":"","Has GBT":false,"Best Share":"  0.0000","Pool Rejected%":0.0000,"Pool Stale%":0.0000}],"id":1}],"id":1}
gnanet commented 6 years ago

@michelem09 i just looked at the changeset that added D3 and S9 support, and i think there is a more simple way, than adding the str_replace part one by one for every minertype:

First you should keep in mind, that you know there is a JSON syntax error, caused by a missing comma between }{ for maybe all the recent Antminers.

So, if you can make sure, that the $line you are going to fix, is in fact a JSON reply of an affected miner, you do not need to differentiate which specific model it is, you simply do a

$line = str_replace('}{', '},{', $line);

to restore the JSON validity, and you're done.

Edit:

i have some custom scripts, and i do the API calls with this simple function, where you see, i also trim off a disturbing \0 if it exsist:


function antminer_api_cmd($cmd,$therigip,$therigport=4028) {
    $response = '';
    $socket = stream_socket_client('tcp://'.$therigip.':'.$therigport, $errno, $errstr, 2);

    if (!$socket || $errno != 0) {
        return null;
    } else {
        fwrite($socket, $cmd);
        while (!feof($socket)) {
            $response .= fgets($socket);
        }
        fclose($socket);
    }

    return str_replace('}{','},{',str_replace("\0", '', $response)); // JSON response has ASCII BOM at the begining.
}
stangerm2 commented 6 years ago

Not sure what you mean @gnanet , here's my json response from netcat. Looks like valid json to me? matt@matt-dev ~/Downloads/cgminer-master_x86 $ echo '{"command":"summary+stats+pools"}' | nc 192.168.0.107 4028 {"summary":[{"STATUS":[{"STATUS":"S","When":1513826969,"Code":11,"Msg":"Summary","Description":"cgminer 4.10.0"}],"SUMMARY":[{"Elapsed":87733,"GHS 5s":"15679.6","GHS av":15914.88,"Found Blocks":7,"Getworks":6104,"Accepted":" 5.0000","Rejected":" 5.0000","Hardware Errors":1,"Utility":2.53,"Discarded":55693,"Stale":10,"Get Failures":8,"Local Work":439040,"Remote Failures":0,"Network Blocks":2323,"Total MH":1340408191.0000,"Work Utility":227.50,"Difficulty Accepted":332205.02897867,"Difficulty Rejected":452.76107186,"Difficulty Stale":0.00000000,"Best Share":22326097,"Device Hardware%":0.0003,"Device Rejected%":0.1361,"Pool Rejected%":0.1361,"Pool Stale%":0.0000,"Last getwork":1513826969}],"id":1}],"stats":[{"STATUS":[{"STATUS":"S","When":1513826969,"Code":70,"Msg":"CGMiner stats","Description":"cgminer 4.10.0"}],"STATS":[{"CGMiner":"4.10.0","Miner":"1.0.0.9","CompileTime":"Sat Dec 02 22:35:56 CST 2017","Type":"Antminer D3 Blissz v1.1"}{"STATS":0,"ID":"D10","Elapsed":87733,"Calls":0,"Wait":0.000000,"Max":0.000000,"Min":99999999.000000,"GHS 5s":"15679.6","GHS av":15914.88,"miner_count":3,"frequency1":"425","frequency2":"425","frequency3":"425","frequency4":"425","fan_num":2,"fan1":3000,"fan2":3810,"temp_num":3,"temp1":50,"temp2":45,"temp3":44,"temp4":0,"temp2_1":60,"temp2_2":58,"temp2_3":58,"temp2_4":0,"temp_max":50,"Device Hardware%":0.0000,"no_matching_work":1,"chain_acn1":60,"chain_acn2":60,"chain_acn3":60,"chain_acn4":0,"chain_acs1":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooo","chain_acs2":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooo","chain_acs3":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooo","chain_acs4":"","chain_hw1":0,"chain_hw2":1,"chain_hw3":0,"chain_hw4":0,"chain_rate1":"5255.00","chain_rate2":"5241.61","chain_rate3":"5183.00","chain_rate4":""}],"id":1}],"pools":[{"STATUS":[{"STATUS":"S","When":1513826969,"Code":7,"Msg":"5 Pool(s)","Description":"cgminer 4.10.0"}],"POOLS":[{"POOL":0,"URL":"stratum+tcp://x11.mine.zpool.ca:3533","Status":"Alive","Priority":2,"Quota":0,"Long Poll":"N","Getworks":5527,"Accepted":3340,"Rejected":3,"Discarded":53079,"Stale":10,"Get Failures":8,"Remote Failures":0,"User":"12cn3KkiE4dkonSbSzeEBS5AYpKksiXNVt","Last Share Time":"0:02:30","Diff":" 92.0000","Diff1 Shares":2421964,"Proxy Type":"","Proxy":"","Difficulty Accepted":306370.00000000,"Difficulty Rejected":276.00000000,"Difficulty Stale":0.00000000,"Last Share Difficulty":92.00000000,"Has Stratum":true,"Stratum Active":true,"Stratum URL":"x11.mine.zpool.ca","Has GBT":false,"Best Share":" 0.0000","Pool Rejected%":0.0900,"Pool Stale%":0.0000},{"POOL":1,"URL":"stratum+tcp://dash03.p2poolmining.us:7903","Status":"Alive","Priority":3,"Quota":0,"Long Poll":"N","Getworks":95,"Accepted":8,"Rejected":1,"Discarded":808,"Stale":0,"Get Failures":0,"Remote Failures":0,"User":"XoUMzHs7HN4yHsF4gKCbdVJVFqdE7aL5ix","Last Share Time":"0:38:22","Diff":"486.7895","Diff1 Shares":29911,"Proxy Type":"","Proxy":"","Difficulty Accepted":2435.60867919,"Difficulty Rejected":112.76107186,"Difficulty Stale":0.00000000,"Last Share Difficulty":612.80316264,"Has Stratum":true,"Stratum Active":false,"Stratum URL":"","Has GBT":false,"Best Share":" 0.0000","Pool Rejected%":4.4248,"Pool Stale%":0.0000},{"POOL":2,"URL":"stratum+tcp://dash02.p2poolmining.us:7903","Status":"Alive","Priority":4,"Quota":0,"Long Poll":"N","Getworks":20,"Accepted":3,"Rejected":0,"Discarded":135,"Stale":0,"Get Failures":0,"Remote Failures":0,"User":"XoUMzHs7HN4yHsF4gKCbdVJVFqdE7aL5ix","Last Share Time":"11:40:44","Diff":"237.1511","Diff1 Shares":5394,"Proxy Type":"","Proxy":"","Difficulty Accepted":743.42029948,"Difficulty Rejected":0.00000000,"Difficulty Stale":0.00000000,"Last Share Difficulty":322.72365326,"Has Stratum":true,"Stratum Active":false,"Stratum URL":"","Has GBT":false,"Best Share":" 0.0000","Pool Rejected%":0.0000,"Pool Stale%":0.0000},{"POOL":3,"URL":"stratum+tcp://dash.suprnova.cc:9995","Status":"Alive","Priority":0,"Quota":0,"Long Poll":"N","Getworks":27,"Accepted":25,"Rejected":0,"Discarded":117,"Stale":0,"Get Failures":0,"Remote Failures":0,"User":"devFeeMiner.6","Last Share Time":"0:00:36","Diff":" 64.0000","Diff1 Shares":2774,"Proxy Type":"","Proxy":"","Difficulty Accepted":1600.00000000,"Difficulty Rejected":0.00000000,"Difficulty Stale":0.00000000,"Last Share Difficulty":64.00000000,"Has Stratum":true,"Stratum Active":true,"Stratum URL":"dash.suprnova.cc","Has GBT":false,"Best Share":" 0.0000","Pool Rejected%":0.0000,"Pool Stale%":0.0000},{"POOL":4,"URL":"stratum+tcp://dash-eu.coinmine.pl:6099","Status":"Alive","Priority":1,"Quota":0,"Long Poll":"N","Getworks":1,"Accepted":0,"Rejected":0,"Discarded":0,"Stale":0,"Get Failures":0,"Remote Failures":0,"User":"devFeeMiner.1","Last Share Time":"0","Diff":" 20.0000","Diff1 Shares":0,"Proxy Type":"","Proxy":"","Difficulty Accepted":0.00000000,"Difficulty Rejected":0.00000000,"Difficulty Stale":0.00000000,"Last Share Difficulty":0.00000000,"Has Stratum":true,"Stratum Active":false,"Stratum URL":"","Has GBT":false,"Best Share":" 0.0000","Pool Rejected%":0.0000,"Pool Stale%":0.0000}],"id":1}],"id":1}

stangerm2 commented 6 years ago

Oh nm I see where the format is broken in the stats column, I think it's fair to close this.

michelem09 commented 6 years ago

@gnanet thanks yes I know but I did that really quickly I should rewrite something as you suggested.

@nimjox yes your output is bugged like the others so your Minera should work, weird. Could you check the output of "Raw stats" in the right corner of the dashboard? I would suggest to keep only 1/2 miner connected while debugging.

gnanet commented 6 years ago

@nimjox you are not using stock firmware, and the sample sems to contain one compiled on Dec 02, but the latest version seems to be Dec 10

michelem09 commented 5 years ago

@gnanet are you still using Minera? Can I ask to make a test with new pre-release?

gnanet commented 5 years ago

Sorry, but my CEO has sold all the miners, so our project died.

michelem09 commented 5 years ago

I'm sorry for that, btw D3 should work now.