diff --git a/docker-compose/statistics/app/p2pool_statistics.py b/docker-compose/statistics/app/p2pool_statistics.py index 2e847e6..9ca8d7d 100755 --- a/docker-compose/statistics/app/p2pool_statistics.py +++ b/docker-compose/statistics/app/p2pool_statistics.py @@ -60,6 +60,16 @@ def render(): network_stats = json.loads(reader.read()) with open("/data/local/stratum", "r") as reader: local_stats = json.loads(reader.read()) + workers = local_stats["workers"][:30] # limit workers output list + workers_concat = [] + for w in workers: + w_list = w.split(",") + w_list[1] = humanfriendly.format_timespan(int(w_list[1])) + w_list[2] = human_numbers(int(w_list[2])) + workers_concat.append(w_list) + workers_concat = sorted(workers_concat, key=lambda x: int(x[3]), reverse=True) + for w in workers_concat: + w[3] = human_numbers(int(w[3])) return render_template( "index.html", my_bday=my_bday, @@ -67,6 +77,7 @@ def render(): pool_stats=pool_stats, network_stats=network_stats, local_stats=local_stats, + workers=workers_concat, ) except Exception as e: return render_template("oops.html", error=str(e)) diff --git a/docker-compose/statistics/app/templates/index.html b/docker-compose/statistics/app/templates/index.html index a62cd3b..aacab50 100644 --- a/docker-compose/statistics/app/templates/index.html +++ b/docker-compose/statistics/app/templates/index.html @@ -64,6 +64,29 @@ Block reward share {{ local_stats["block_reward_share_percent"] }}% + + Workers +
(note: limited to the first 30 workers)
+ + + + + + + + + + + {% for w in workers %} + + {% for w_detail in w %} + + {% endfor %} + + {% endfor %} +
IP:PortUptimeDifficultyHashrateName
{{ w_detail }}
+ +