Closed ikerrg closed 10 years ago
Yes, there have been recent changes to the API (and the version wasn't bumped :/), see these three commits. My guess: the interface you are using parses the response sequentially, without regard to what is in the field name.
Simple test: provide a coin
option with some string in your pool configuration. If that shows up in your interface, then the above guess is probably correct.
The coin
option will probably be renamed to description
prior to a numbered release.
Sorry, it does not work. I'm using this config in the first pool:
{
"url" : "stratum+tcp://ltc-eu.give-me-coins.com:3333",
"user" : "xxxxxxx",
"pass" : "xxxxxx",
"coin" : "Litecoin",
"name" : "Give Me Coins"
},
But the web interface still shows no info about the pool.
I paste below the BAMT's file (/opt/bamt/common.pl) where I think it could be the code to get cgminer's info from API (now sgminer). In the line 522 it seems to parse the information, but my perl's knowledge is not good enough to understand these functions. Any idea?
Anyway, I do not understand why these new infos ("name" and "coin") are needed, because many pools already have that info in their url (the coin you are mining and obviously the pools name). I understand that is more beautiful, but it also makes more complex the .conf file.
Thanks in advance.
PD. Sorry for the long text posted. If you like, edit it and delete the file's code when you read it.
EDIT: removed by veox, see below
But the web interface still shows no info about the pool.
OK, then I was wrong here.
I paste below the BAMT's file (/opt/bamt/common.pl) ...
I'll look into it.
Anyway, I do not understand why these new infos ("name" and "coin") are needed, because many pools already have that info in their url (the coin you are mining and obviously the pools name). I understand that is more beautiful, but it also makes more complex the .conf file.
Some multiple-currency pools use a single name and different ports for different currencies. Therefore the need to distinguish them otherwise. (EDIT: and yes, it is also shorter.) coin
(eventually description
) is useful to work around the fact that JSON does not have comments.
The regexp on BAMT's common.pl
needs a very specific match, so this goes back prior to coin
, to name
.
For a temporary workaround, edit api.c
(EDIT: of sgminer) from line 1820 and move "Name" and "Coin" fields to after the "URL" field (or remove them altogether). EDIT: then recompile.
You were totally right!!
I only changed the order of Name and Coin lines in api.c and everything went to normal (see the image). I have moved those lines below the "Status" field because it seems that "Status" is also used by BAMT. The final order is:
root = api_add_int(root, "POOL", &i, false);
root = api_add_escape(root, "URL", pool->rpc_url, false);
root = api_add_string(root, "Status", status, false);
root = api_add_string(root, "Name", pool->name, false);
root = api_add_string(root, "Coin", pool->coin, false);
root = api_add_int(root, "Priority", &(pool->prio), false);
root = api_add_int(root, "Quota", &pool->quota, false);
Is there any problem for other non-BAMT users or can you change the main code for everyone?
Seeing this image it remembers me to an old wish that I always had. Assigning one individual GPU to one pool (pool or worker), to avoid too difficult shares in vardiff pools. But this is a different issue.
One additional question. Why the "dirty" text in the version of the new compilation? 4.1.153-86-gcabb-dirty
Thanks for your amazingly good support!!!
because it seems that "Status" is also used by BAMT.
As you can see from the regexp on common.pl line 550, it's using everything up to "Remote Failures", in that specific order, specific capitalisation.
Moving our new fields after that looks a bit ugly in the code. The way I see this can be solved without breaking compatibility with cgminer is fixing parsing in BAMT's common.pl
to allow any order and any arbitrary fields (which can be ignored if not used).
I'll leave this issue open so others can find it.
P.S. Fixing API issues are low on my personal priority list.
However, other values as Accepted, Rejected, etc. are not affected in the BAMT's WEB interface, even when they are located after the new fields. I assume that only the "URL" value is needed to show the status column in the WEB interface, and maybe the other values are obtained elsewhere. Do you think that moving the new values after "Status" is too ugly for the code? If so, I need help to patch BAMT's common.pl because I don't know the language and I do not feel too confident. What the symbols in "m/|POOL=(\d+),URL=(.+?),Status=(.+?),Priority=(\d+),Quota=(\d+)" mean? Maybe one of the BAMT developers can help. Thanks again.
I have an idea. In the BAMT's WEB interface (see the picture) there is a place where the name of the miner is shown. I think it should be easy to use a different regexp chain if the miner is identified as cgminer or as sgminer, only using an "if" statement. What do you think? EDIT: OK, bad idea. BAMT's code to identify the miner is in /usr/lib/cgi-bin/status.pl file as shown
if ($i == $showgpu)
{
$gsput .= "<tr><td>Status:</td><td>$url</td></tr>";
if ($conf{'gpu'. $i}{cgminer})
{
$gsput .= "<tr><td>Miner:</td><td>cgminer</td></tr>";
}
else
{
$gsput .= "<tr><td>Miner:</td><td>Phoenix</td></tr>";
}
}
As you can see, it is not identifying anything but Phoenix miner (ASIC I suppose) or any GPU miner.
Well, finally I think that the best option for us (users of BAMT) is changing the order of the "Name" and "Coin" lines in api.c (around line 1820) just before compiling a new version of sgminer from GIT. For best compatibility, move those lines after "Remote Failures" line, and BAMT stats will work as expected. The final code should look like this:
root = api_add_int(root, "POOL", &i, false);
root = api_add_escape(root, "URL", pool->rpc_url, false);
root = api_add_string(root, "Status", status, false);
root = api_add_int(root, "Priority", &(pool->prio), false);
root = api_add_int(root, "Quota", &pool->quota, false);
root = api_add_string(root, "Long Poll", lp, false);
root = api_add_uint(root, "Getworks", &(pool->getwork_requested), false);
root = api_add_int(root, "Accepted", &(pool->accepted), false);
root = api_add_int(root, "Rejected", &(pool->rejected), false);
root = api_add_int(root, "Works", &pool->works, false);
root = api_add_uint(root, "Discarded", &(pool->discarded_work), false);
root = api_add_uint(root, "Stale", &(pool->stale_shares), false);
root = api_add_uint(root, "Get Failures", &(pool->getfail_occasions), false);
root = api_add_uint(root, "Remote Failures", &(pool->remotefail_occasions), false);
root = api_add_string(root, "Name", pool->name, false);
root = api_add_string(root, "Coin", pool->coin, false);
root = api_add_escape(root, "User", pool->rpc_user, false);
root = api_add_time(root, "Last Share Time", &(pool->last_share_time), false);
root = api_add_int(root, "Diff1 Shares", &(pool->diff1), false);
I think that the change could be made in the master program because it does not affect other users.
Hope this helps to anybody using BAMT.
Cheers!
BAMT web interface code is extremely breakable. ANY changes to the output break the poorly written regex that gets the data. Its extremely old, and no longer developed.
IMHO, it is extremely poor practice to change the miner to accommodate bad code in a client interface.
If you would like a proper, up-to-date web GUI that is not broken, please give PoolManager a try. https://github.com/starlilyth/Linux-PoolManager
Closing as wontfix.
Hello,
After updating with the last sgminer version in github (https://github.com/veox/sgminer) the pool URL address that was shown inside the BAMT’s web interface http://BAMT_IP/cgi-bin/status.pl (in the Status column near the green tick of each GPU) does not appear anymore. It is a minor cosmetic bug, but it should be easy to fix if somebody knows what sgminer/cgminer API information is being used in that field to show the URL. New sgminer:
Old sgminer:
I’ve been searching for a fix inside BAMT’s code (although the fix should be for sgminer) and the closest thing I found is the Status variable shown in /usr/lib/cgi-bin/status.pl. However, I’m not able to find a relation between sgminer’s api code and BAMT read values. In sgminer’s/cgminer’s api.c file there are several lines that could be related: root = api_add_string(root, "Status", status, false); root = api_add_escape(root, "URL", pool->rpc_url, false);
Anybody knows what could be wrong in latest sgminer? Anything changed in the API?
Thank you and best regards.