develsoftware / GMinerRelease

Ethash, ProgPoW, Equihash, CuckooCycle GPU Miner
https://bitcointalk.org/index.php?topic=5034735.0
1.96k stars 330 forks source link

Classic API connection possible? #11

Open Angel996 opened 5 years ago

Angel996 commented 5 years ago

Hello.

Is it possible to have a "classic" TCP API connection to read miner stats, hashrate, for example? Claymore miner style, JSON, or anything? This miner only has http interface and it's updated dynamically, I can't read anything from that...

thank you.

ntminer commented 5 years ago

NTMiner read miner hashrate, accept/reject share from logfile,because not every miner have a api,but it must output log Total Speed: (?[\d.]+) (?.+/s) Shares Accepted: (?\d+) Rejected: (?\d+) GPU(?\d+) (?[\d.]+) (?.+?/s)

UselessGuru commented 5 years ago

@Angel996

In powershell you can read from the API just fine:

        $Server = "localhost"
        $Timeout = 5 #seconds

        $Request = ""
        $Response = ""

        $HashRate = [PSCustomObject]@{}

        try {
            $Response = Invoke-WebRequest "http://$($Server):$($this.Port)/stat" -UseBasicParsing -TimeoutSec $Timeout -ErrorAction Stop
            $Data = $Response | ConvertFrom-Json -ErrorAction Stop
        }
        catch {
            return @($Request, $Response)
        }

        $HashRate_Name = [String]($this.Algorithm | Select-Object -Index 0)

Code snipped taken from https://github.com/UselessGuru/MultiPoolMiner/blob/master/MultiPoolMiner/APIs/Gminer.ps1

MrClappy commented 3 years ago

Anyone attempt something similar in Linux? Curl & wget also return empty, would be nice if there was an actual API behind the web interface.

MrClappy commented 3 years ago

In case anyone stumbles on this in the future, I was able to get some content pulled from the web interface using BeautifulSoup in Python3. Code & context available here.