num = 0 for n in dat3: w = { 'rate': n["KHS"], 'temp': 0, 'watt': 0, 'fan' : 0, 'num' : n["GPU"] } workers[num] = w num = num + 1 for n in workers: w = workers[n] miner.dispatch_worker(w['num'], rigname, cfg['algo'], [w['rate'], w['temp'], w['watt'], w['fan']]) miner.dispatch_miner(miner.get_master(), 'rigpass', rigname, software, cfg['algo'], uptime, pools, cfg['factor'], cfg['units']) except NameError, e: collectd.info('error parsing json for {0}: {1}'.format(cfg['software'], e)) return return def readvals(): for rig in cfg['rigs']: collectd.info('reading: {0} @ {1}'.format(rig['rigname'], rig['url'])) readvals_claymore(rig['url'], rig['rigname']) if __name__ == '__main__': readvals_claymore('localhost:4068', 'miner3')
j = miner.GetData_JsonRpc(url) except ValueError, e: collectd.info('error getting restapi for {0}: {1}'.format(cfg['software'], e)) return try: software = "dstm " + j['version'] uptime = j['uptime'] pool = j['server'] num = 0 num_miners = len(j['result']) miners = j['result'] for x in miners: miner.dispatch_worker(num, rigname, cfg['algo'], [x['avg_sol_ps'], x['temperature'], x['avg_power_usage'], 0]) num = num + 1 miner.dispatch_miner(miner.get_master(), 'rigpass', rigname, software, cfg['algo'], uptime, pool, 1, 'sol') except: collectd.info('error processing for ' + url); print 'error processing' return def readvals(): for rig in cfg['rigs']: collectd.info('reading: {0} @ {1}'.format(rig['rigname'], rig['url'])) readvals_bminer(rig['url'], rig['rigname']) if __name__ == "__main__": print "main" readvals_bminer('http://192.168.50.18:2222', 'miner') sys.exit()
tempfans = j['result'][6].split(';') i = 0 num = 0 for n in tempfans: if i == 0: workers[num]['temp'] = str(n) i = 1 else: workers[num]['fan'] = str(n) i = 0 num = num + 1 for n in workers: w = workers[n] miner.dispatch_worker(w['num'], rigname, cfg['algo'], [w['rate'], w['temp'], w['watt'], w['fan']]) miner.dispatch_miner(miner.get_master(), 'rigpass', rigname, software, cfg['algo'], uptime, pools, 1000, 'hash') except NameError, e: collectd.info('error parsing json for {0}: {1}'.format(cfg['software'], e)) return return def readvals(): for rig in cfg['rigs']: collectd.info('reading: {0} @ {1}'.format(rig['rigname'], rig['url'])) readvals_claymore(rig['url'], rig['rigname']) collectd.register_config(readconf) collectd.register_read(readvals, int(cfg['interval']))
software = j['version'] uptime = j['connection']['uptime'] pool = j['connection']['pool'] num = 0 hashrate = j['hashrate'] for n in hashrate['threads']: rate = n[0] if rate == None: rate = n[1] # collectd.info('dispatching: {0} @ {1}'.format('worker' + str(num), str(rate))) miner.dispatch_worker(num, rigname, cfg['algo'], [str(rate), 0, 0, 0]) num = num + 1 r = requests.post(miner.get_master(), json={ "password": "******", "rigname": rigname, "uptime": uptime, "software": software, "algo": cfg['algo'], "pool": pool, "factor": 1, "unit": 'sol' }) except NameError, e: collectd.info('error parsing json for {0}: {1}'.format( cfg['software'], e)) return
num = 0 w = { 'rate': int(float(rate) * cfg['factor']), 'temp': 0, 'watt': 0, 'fan': 0, 'num': 0 } workers[num] = w num = 1 for n in workers: w = workers[n] miner.dispatch_worker(w['num'], rigname, cfg['algo'], [w['rate'], w['temp'], w['watt'], w['fan']]) miner.dispatch_miner(miner.get_master(), 'rigpass', rigname, software, cfg['algo'], uptime, pools, cfg['factor'], cfg['units']) except NameError, e: # collectd.info('error parsing json for {0}: {1}'.format(cfg['software'], e)) print("err {0}".format(e)) return return def readvals(): for rig in cfg['rigs']: collectd.info('reading: {0} @ {1}'.format(rig['rigname'], rig['url'])) readvals_cmore(rig['url'], rig['rigname'], rig)