Miner conf
supernoveau opened this issue · 23 comments
I'm trying to pick up the miners on my local network (Antminer Z9 and Innosilicon ZMaster).
I updated the miners.conf
with the IPs of the machine however when I run fcmsimple
the new conf isn't picked up by the system (it shows 1 new machine only plus a S9105 that I haven't configured in the conf.
How do I reset the cache?
What is the clientid
, networkid
and minerid
in the conf? I have these empty.
Will the system pick up miners on port 22, 80 or another port? Z9s are only open on 22 and 80 by default, ZMasters are also open by default on 8001.
I found fcmpurge
which allows it to pick up my conf.
Calling fcmsimple
I get:
Failed to call miner stats api: Expecting value: line 1 column 1 (char0)
.
Any help regarding the port and miner.conf would be a real help. Thanks
S9105 is my test machine. It is just a friendly name.
clientid, networkid, and minerid can be blank. I will write up some help documents for those values.
The port in miner.conf should be the miner api port. Usually 4028 by default.
I will check what the setting should be for Z9.
It looks like I have some work to do to automatically configure Innosilicon Zmaster. I will work on that soon.
Please try to enable api on the zmaster using the instructions at the bottom of the following page.
https://support.awesomeminer.com/support/solutions/articles/35000085990-configure-api-access-for-innosilicon-asic-miners
Note: I do not suggest allowing W:0/0 like the example shows, but try it first to get it to work and then try a setting that is more secure.
On the ZMaster I can enable that API following that guide, however I can't access the cgminer API.
Running netstat -l
on the miner I see a process listening on 0.0.0.0:4028
. However, when I use nmap
to the IP, only port 22, 80 and 8001 are open. Running fcmsimple
I get [Errno 111] Connection refused
.
Do you know how I open port 4028 on the miner?
Sending to the cgminer API echo '{"command":"stats"}' | nc x.x.x.x 4028
I get the response {"STATUS":[{"STATUS":"S" ....
so it seems this is working at the cgminer end?
I presume this is an unrestricted API call.
I removed the api-allow
key in /config/cgminer.conf
so there can't be a conflict with the systemctl init, and it may have enabled it.
Running fcmsimple
then gives
1 api calls in 13ms
[stacktrace]
ZeroDivisionError: division by zero
To confirm, I used the API directly and I do have privileged access enabled, so the fcmsimple
isn't working if I'm not mistaken?
Request:
echo '{"command":"privileged"}' | nc xx.xx.xx.xx 4028 >> ~/Desktop/output.txt
Response:
{"STATUS":[{"STATUS":"S","When":1542018669,"Code":46,"Msg":"Privileged access OK","Description":"sgminer 4.4.2"}],"id":1}�
I presume this is an unrestricted API call.
I removed the
api-allow
key in/config/cgminer.conf
so there can't be a conflict with the systemctl init, and it may have enabled it.Running
fcmsimple
then gives1 api calls in 13ms [stacktrace] ZeroDivisionError: division by zero
Thank you for your help to diagnose this!
There must be a programming error on my side that is doing a division by zero. I will check the code.
In the mean time, does the stack trace tell you the line number for the ZeroDivisionError?
Or, if you can send me you output of the stats command then I can parse it to debug.
Sending to the cgminer API
echo '{"command":"stats"}' | nc x.x.x.x 4028
I get the response{"STATUS":[{"STATUS":"S" ....
so it seems this is working at the cgminer end?
Can you send me the full contents of the output of stats command?
There must be some contents that I have not encountered before and it is throwing an error in my programming.
This is the full response to the stats command - https://gist.github.com/almccann/a44351ec8bafc17ab000a8a70c575d24
So to help with debug, with cgminer API configured with privileged access (according to response above), fcmsimple
full stack trace is:
Starting...
2018-11-13 09:54:43: Starting FCM Init
2018-11-13 09:54:43: Starting FCM Configuration
Starting FCM Cache
2018-11-13 09:54:43: started app. getting known miners
2018-11-13 09:54:43: 1 miners configured
Failed to call miner stats api: 'Description'
Traceback (most recent call last):
File "/home/pi/fullcycle/fullcyclepy/helpers/antminerhelper.py", line 56, in stats
minerinfo = parse_minerinfo(status)
File "/home/pi/fullcycle/fullcyclepy/helpers/antminerhelper.py", line 124, in parse_minerinfo
if status['Description'].startswith('cgminer'):
KeyError: 'Description'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/fullcycle/fullcyclepy/backend/simplemonitor.py", line 113, in <module>
LOOP.run_until_complete(run_tasks(CUTOR, MINERS))
File "/usr/lib/python3.5/asyncio/base_events.py", line 466, in run_until_complete
return future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/home/pi/fullcycle/fullcyclepy/backend/simplemonitor.py", line 94, in run_tasks
results = await fut
File "/usr/lib/python3.5/asyncio/tasks.py", line 500, in _wait_for_one
return f.result() # May raise f.exception().
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/pi/fullcycle/fullcyclepy/backend/simplemonitor.py", line 21, in getstats
minerstats, minerinfo, statspolling, minerpool = antminerhelper.stats(miner)
File "/home/pi/fullcycle/fullcyclepy/helpers/antminerhelper.py", line 65, in stats
raise MinerMonitorException(ex)
helpers.antminerhelper.MinerMonitorException: 'Description'
-
Should be
status = jstats['STATUS'][0]
?
-
With that change no
miner_count
,GHS 5s
,GHS av
,frequency
norcontrollertemps
in this json. Have commented out this lines in my local version.
-
Change to list index and sgminer
if status[0]['Description'].startswith('sgminer'):
?
With these amendments fcmsimple
returns:
Starting...
2018-11-13 17:19:39: Starting FCM Init
2018-11-13 17:19:39: Starting FCM Configuration
Starting FCM Cache
2018-11-13 17:19:39: started app. getting known miners
2018-11-13 17:19:39: 1 miners configured
zmaster1 mining at Antpool ZCash 8899
2018-11-13 17:19:40 zmaster1 offline 0 0 temp=0 0d2h47m 1054ms
1 api calls in 1072ms. Avg=1072.0ms
Concurrency saved 1054.8569099996712ms - 1072ms = -17.14309000032881ms (-1%)
Shutting down fcm app...
You're almost there. The temps need to be parsed correctly.
I will work on a pull request today.
This is the full response to the stats command - https://gist.github.com/almccann/a44351ec8bafc17ab000a8a70c575d24
These stats are quite a bit different than what i have seen before.
Basically, I need to get hash from 'MHS av'
and temp from 'Temp'
If I can pull those out then you can get basic monitoring and run rules on them.
Is this the sgminer API compared to cgminer? That json is the ZMaster.
If you check the type of API - sgminer or cgminer - can them call the different parsers accordingly and handle both machines?
Is this the sgminer API compared to cgminer? That json is the ZMaster.
There is no official standard for the output of each api command. Each miner manufacturer produces different output, especially for the stats command. So yes, this is a difference in format between the different mining software.
If you check the type of API - sgminer or cgminer - can them call the different parsers accordingly and handle both machines?
Yes, this is exactly what I am going to do.
Later I will improve the code and make it easier to notify me when a new miner comes out so I can get it fixed sooner.
Make a backup of ~/fullcycle/fullcyclepy/backend/config/*
Update the app with the following command
fcmupdate
That will stop services, backup config, get new version then restore config and restart services.
Then let me know if simplemonitor runs.
My debugging to get fcmsimple
to return
-
Key needs to be lowercase:
-
This isn't used and errors:
-
Just needs the function doesn't pick up the module
-
Needs conditional on
max
if empty or at least its not parsing these for me
-
This line just needs to come back four spaces outside the if else
Sorry probably could just have made a PR..
To help with the Elapsed
and Temp
, this is the content of jsonstats
that is passed to parse_statistics_inno
: https://gist.github.com/almccann/101eb5aa52b4d7c5b38466303384e094
Actually if line 54 is like this then the Elapsed and Temp is plucked:
jstats = stats_and_pool['stats'][0]['STATS']
Probably brittle but that does get it.
Any idea on the currenthash - the calc from the API gives a hash of 2862500 whereas the web admin gives around 50000 sol/s?
Is the controllertemp and average of the hashboards? Also regarding the rules.conf, I see the controllertemp is this value, what is the boardtemp? Is that coming from Z9 which has a chip and PCB temp but here with this API not applicable?
It was a little hard for me to interpret the stats output without being able to compare it with anything.
In the stats output there was 3 'MHS av' values. Normally that is the hash for each board, so I summed them.
How many hashing boards does the Z9 have? Do you have the Antminer Z9 or the innosilicon A9 zmaster?
I dug into their web code and it uses another API call - I don't know why its accurate for hashrates - a lot of the info is duplicated. Anyway I opened a PR with the changes that got that going for the ZMasters.
I will look into the temperatures. Is the rules.conf working to shutdown - would I need to amend anything for ZMasters?
I do have Z9s as well but they're at another location and I'm working on getting the ZMasters set up first.
Thanks for the PR. I will review it.
Once you get the hash and temp into my Miner object then it should work fine for the rules.conf.
You may have to modify when_runrules.py to suit your situation.