getminera / minera

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

Minera remote via VPN #213

Closed guibe80 closed 6 years ago

guibe80 commented 6 years ago

Hi there:

I just installed minera in a Raspberry Pi and I was able to run it. However, my miners are in an external data centre and I'd love to monitor my Antminers L3+. I connected the RasPi to my provider's VPN using openconnect, the IP's obtained from the Antminers are obviously the ones from the VPN network. I tried to scan for the miners in minera but it didn't detect them. I put the address manually, it says "online" when I put the details but then in the dashboard says offline and no data is provided.

I decided to test if my VPN connection can get the status from my Miners. So, I downloaded this project https://github.com/anselal/antminer-monitor and it detects the Antminers giving details of their status.

Do I have to do something extra in minera to make it work in a VPN? Any idea what to do?

Thanks for your help! I hope that I could run it soon, so I can explore the full potential of your app.

Cheers!

gnanet commented 6 years ago

cool combo, i'm also curious about the minera solution

guibe80 commented 6 years ago

Checking the post #194 I followed the instructions of the nc command. It is connected and reporting. Maybe, this error might be related to the same bug.

echo '{"command":"summary+stats+pools"}' | nc 10.161.124.2 4028 {"summary":[{"STATUS":[{"STATUS":"S","When":1517501026,"Code":11,"Msg":"Summary","Description":"cgminer 4.9.0"}],"SUMMARY":[{"Elapsed":51668,"GHS 5s":"504.42","GHS av":500.82,"Found Blocks":2,"Getworks":2965,"Accepted":1304,"Rejected":4,"Hardware Errors":53,"Utility":1.51,"Discarded":30114,"Stale":0,"Get Failures":21,"Local Work":49281,"Remote Failures":0,"Network Blocks":822,"Total MH":25876442.0000,"Work Utility":433645.82,"Difficulty Accepted":372376480.00000000,"Difficulty Rejected":1048576.00000000,"Difficulty Stale":0.00000000,"Best Share":551575370,"Device Hardware%":0.0000,"Device Rejected%":0.2808,"Pool Rejected%":0.2808,"Pool Stale%":0.0000,"Last getwork":1517501025}],"id":1}],"stats":[{"STATUS":[{"STATUS":"S","When":1517501026,"Code":70,"Msg":"CGMiner stats","Description":"cgminer 4.9.0"}],"STATS":[{"CGMiner":"4.9.0","Miner":"1.0.1.1","CompileTime":"Fri Apr 28 20:45:45 CST 2017","Type":"Antminer L3+"}{"STATS":0,"ID":"L30","Elapsed":51668,"Calls":0,"Wait":0.000000,"Max":0.000000,"Min":99999999.000000,"GHS 5s":"504.417","GHS av":500.82,"miner_count":4,"frequency":"384","fan_num":2,"fan1":2460,"fan2":1356,"temp_num":4,"temp1":48,"temp2":44,"temp3":49,"temp4":45,"temp2_1":54,"temp2_2":50,"temp2_3":55,"temp2_4":52,"temp31":0,"temp32":0,"temp33":0,"temp34":0,"temp4_1":0,"temp4_2":0,"temp4_3":0,"temp4_4":0,"temp_max":49,"Device Hardware%":0.0000,"no_matching_work":53,"chain_acn1":72,"chain_acn2":72,"chain_acn3":72,"chain_acn4":72,"chain_acs1":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo","chain_acs2":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo","chain_acs3":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo","chain_acs4":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo","chain_hw1":0,"chain_hw2":24,"chain_hw3":0,"chain_hw4":29,"chain_rate1":"125.89","chain_rate2":"126.35","chain_rate3":"126.14","chain_rate4":"126.03"}],"id":1}],"pools":[{"STATUS":[{"STATUS":"S","When":1517501026,"Code":7,"Msg":"3 Pool(s)","Description":"cgminer 4.9.0"}],"POOLS":[{"POOL":0,"URL":"stratum+tcp://scrypt.eu.nicehash.com:3333","Status":"Alive","Priority":0,"Quota":1,"Long Poll":"N","Getworks":2962,"Accepted":1304,"Rejected":4,"Discarded":30114,"Stale":0,"Get Failures":21,"Remote Failures":0,"User":"xxxxxxxxxxxxxxxxxxxxxx","Last Share Time":"0:01:21","Diff":"262K","Diff1 Shares":1550460,"Proxy Type":"","Proxy":"","Difficulty Accepted":372376480.00000000,"Difficulty Rejected":1048576.00000000,"Difficulty Stale":0.00000000,"Last Share Difficulty":262144.00000000,"Has Stratum":true,"Stratum Active":true,"Stratum URL":"scrypt.eu.nicehash.com","Has GBT":false,"Best Share":551575370,"Pool Rejected%":0.2808,"Pool Stale%":0.0000},{"POOL":1,"URL":"stratum+tcp://stratum-ltc.antpool.com:443","Status":"Alive","Priority":1,"Quota":1,"Long Poll":"N","Getworks":2,"Accepted":0,"Rejected":0,"Discarded":0,"Stale":0,"Get Failures":0,"Remote Failures":0,"User":"guibe80.L3MB1","Last Share Time":"0","Diff":"","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,"Pool Rejected%":0.0000,"Pool Stale%":0.0000},{"POOL":2,"URL":"stratum+tcp://stratum.f2pool.com:8888","Status":"Alive","Priority":2,"Quota":1,"Long Poll":"N","Getworks":1,"Accepted":0,"Rejected":0,"Discarded":0,"Stale":0,"Get Failures":0,"Remote Failures":0,"User":"guibe80.001","Last Share Time":"0","Diff":"8.19K","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,"Pool Rejected%":0.0000,"Pool Stale%":0.0000}],"id":1}],"id":1}

Looking forward for a solution of this issue! Cheers!

michelem09 commented 6 years ago

Yes probably it is, but do you have the 0.9.0 version?

michelem09 commented 6 years ago

And more, you have to select the Antimer option S9/L3/D3 in the network settings.

guibe80 commented 6 years ago

Thank you @michelem09. I thought I was running version 0.9.0 but in reality was 0.80. I did the upgrade of the system and I was able to detect my machines. However, I had to add them manually. The auto-detect didn't work. But now I'm able to see my devices through my VPN. This is great! Cheers!

michelem09 commented 6 years ago

Very good! Indeed versions prior 0.9.0 aren't able to detect new Antminers, so the problem was that. For the "scan network" button, yes you are right, it's totally bugged and I should have to put my hands on it. Closing this, feel free to reopen it if you need.

guibe80 commented 6 years ago

Sorry, @michelem09. I just came across another problem while checking the functionalities of Minera. I'm trying to change the pool of my miners but is not working. I'm getting the following message:

{"STATUS":[{"STATUS":"E","When":1517924929,"Code":45,"Msg":"Access denied to 'switchpool' command","Description":"cgminer 4.9.0"}],"id":1}

I run the command locally and remotely:

echo "switchpool|1" | nc antminer1 4028

And I'm also getting the same response. It's funny because it should work straight with the Antminer L3+. I checked the .conf file in the antminer and is listening and allowing all API calls W:*. Do you have any idea what could be causing this API miscall?

michelem09 commented 6 years ago

mmm weird but probably --api-allow W:* isn't good due to the asterisk, it's better to put the network subnet instead, so for example if Minera and Antminer are in the 192.168.10.0 network, you have to use --api-allow W:192.168.10.0/24 Please try

guibe80 commented 6 years ago

I tried and it didn't work. From my VPN I don't know what IP my Miner is seeing (I thought, it was my public IP). Then, it stopped reporting back in minera. However, it is really weird that the command doesn't work when running from the Antminer via SSH either. Do you think might be related to the api-groups?. I read in this README file the option switchpool was active in another group. Do I have to do something similar? My miner is runinig cgminer 4.9.0. These are the ones by default in the L3+:

"api-groups" : "A:stats:pools:devs:summary:version",
michelem09 commented 6 years ago

If you have group set I think you should use something like this: --api-allow A:192.168.10.0/24 But first of all be sure Minera is requesting data from Antminer by an ip in that subnet (192.168.10.0/24).

guibe80 commented 6 years ago

Hi @michelem09 thank you for your support. Because I'm running via VPN I have two different networks. I have to put the range of addresses that the VPN is assigning me but it doesn't work. I just found a workaround and now is executing remote commands. The factory file of the Antminer L3+ (/config/cgminer.conf) comes as:

"api-allow" : "A:0/0,W:*",

I don't know why but it seems that the group A was overriding the group W which is required to execute privileged commands. The only way that I found to allow Minera to change the pools was removing the A group and leaving just the W group as follows:

"api-allow" : "W:0/0",

Maybe someone running on a local network might be able just to put the addresses range but because I'm using VPN my IP address is dynamic. Therefore, I had to leave open to all addresses. I hope this info helps you if someone else comes with a similar problem. Cheers!