From abd852f6c94fb22a97276fab2ec3613da17eaab3 Mon Sep 17 00:00:00 2001 From: zheteng Date: Sun, 1 Feb 2026 01:34:33 +0800 Subject: [PATCH] feat: add Chinese (zh-CN) localization - Add Chinese Grafana dashboards (pool_zh.json, users_zh.json, users_private_zh.json) - Add Chinese README (README_ZH.md) - Translated panel titles, chart titles, legends, and variable labels --- README_ZH.md | 152 ++++ prometheus/grafana/dashboards/pool_zh.json | 843 ++++++++++++++++++ .../grafana/dashboards/users_private_zh.json | 384 ++++++++ prometheus/grafana/dashboards/users_zh.json | 386 ++++++++ 4 files changed, 1765 insertions(+) create mode 100644 README_ZH.md create mode 100644 prometheus/grafana/dashboards/pool_zh.json create mode 100644 prometheus/grafana/dashboards/users_private_zh.json create mode 100644 prometheus/grafana/dashboards/users_zh.json diff --git a/README_ZH.md b/README_ZH.md new file mode 100644 index 0000000..ab67df0 --- /dev/null +++ b/README_ZH.md @@ -0,0 +1,152 @@ +# Hydrapool + +[Hydrapool](https://hydrapool.org) 是一个开源的比特币挖矿池软件,支持独立挖矿(Solo Mining)和 PPLNS 收益分配模式。 + +我们在主网运行了一个实例:[test.hydrapool.org](https://test.hydrapool.org)。但我们希望您能运行自己的矿池。请参阅下方的[如何运行](#运行)部分。目前限制最多 100 个用户(因 coinbase 和区块大小限制),矿机数量取决于您的硬件。 + +## 功能特性 + +1. **私有矿池** — 可运行私有独立矿池或社区 PPLNS 矿池 +2. **Coinbase 直接支付** — 收益直接从 coinbase 支付,矿池运营商不托管任何资金 +3. **透明可验证** — 用户可下载并验证 shares 和收益分配数据 +4. **监控面板** — 基于 Prometheus 和 Grafana 的矿池、用户和矿机监控 +5. **兼容性强** — 支持任何支持 Bitcoin RPC 的节点 +6. **Rust 实现** — 易于扩展,支持自定义分配和支付方案 +7. **开源协议** — AGPLv3 许可证 + + +# 运行自己的 Hydrapool 实例 + +## 使用 Docker 运行 + +我们提供 Dockerfile 和 docker compose 文件,方便快速部署。 + +### 下载 docker compose 和配置文件 + +```bash +curl --proto '=https' --tlsv1.2 -LsSf -o docker-compose.yml https://github.com/256foundation/hydrapool/releases/latest/download/docker-compose.yml +curl --proto '=https' --tlsv1.2 -LsSf -o config.toml https://github.com/256foundation/hydrapool/releases/latest/download/config-example.toml +``` + +### 编辑 config.toml + +根据您的比特币节点配置修改以下参数: +- `bitcoinrpc` — 比特币节点 RPC 地址 +- `zmqpubhashblock` — ZMQ 新区块通知地址 +- `network` — 网络类型(signet/main) +- `bootstrap_address` — 主网需要修改为您的地址 + +### 配置比特币节点 + +需要在 `bitcoin.conf` 中允许 Hydrapool 连接: + +```ini +# 允许所有接口连接 +rpcbind=0.0.0.0 + +# 允许 Docker 网络访问 +rpcallowip=172.16.0.0/12 +``` + +### 启动矿池 + +```bash +docker compose -f docker-compose.yml up +``` + +启动后: +- Stratum 服务端口:`3333` +- 监控面板地址:`http://localhost:3000` + +# 升级 + +```bash +cd + +# 拉取最新镜像 +docker compose pull + +# 重建容器 +docker compose up -d --force-recreate +``` + +> **注意**:从 v1.x.x 升级到 **v2.x.x 或更高版本**时,数据库格式已更改,需要重置: +> ```bash +> docker compose down -v +> docker compose up -d +> ``` + +# 监控面板 + +## 矿池面板 + +显示矿池整体算力、每秒 shares、最高难度、用户和矿机数量、算力分布等。 + +![矿池面板预览](./docs/images/pool_dashboard.png) + +## 用户面板 + +显示指定用户的所有矿机算力和独立矿机算力。 + +![用户面板预览](./docs/images/users_dashboard.png) + +# 安全配置 + +如果对外提供 API 服务,建议配置认证。使用以下命令生成认证令牌: + +```bash +docker compose run --rm hydrapool-cli gen-auth <用户名> <密码> +``` + +将生成的配置复制到 `config.toml` 中的 `auth_user` 和 `auth_token`。 + +# API 服务 + +矿池启动时会同时启动 API 服务器。 + +- 获取 PPLNS Shares:`http://<服务器IP>:/pplns_shares` +- 支持 `start_time` 和 `end_time` 参数过滤时间范围 + +# 从源码构建 + +```bash +git clone https://github.com/256-foundation/Hydra-Pool/ +cargo build --release +``` + +### 系统要求 + +- Rust 1.88.0 或更高版本 +- OpenSSL 开发库 +- libclang + +### 安装依赖(Ubuntu) + +```bash +sudo apt update +sudo apt install libssl-dev pkg-config clang libclang-dev +``` + +### 运行 + +```bash +./target/release/hydrapool --config config.toml +``` + +# 安装预编译二进制 + +```bash +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/256-Foundation/Hydra-Pool/releases/latest/download/hydrapool-installer.sh | sh +``` + +将安装两个二进制文件: +- `hydrapool` — 矿池主程序 +- `hydrapool_cli` — 命令行工具 + +# 许可证 + +本项目使用 [AGPLv3](LICENSE) 许可证。 + +--- + +*[English Version](README.md)* diff --git a/prometheus/grafana/dashboards/pool_zh.json b/prometheus/grafana/dashboards/pool_zh.json new file mode 100644 index 0000000..80ee6bf --- /dev/null +++ b/prometheus/grafana/dashboards/pool_zh.json @@ -0,0 +1,843 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 3, + "links": [], + "panels": [ + { + "fieldConfig": { + "defaults": {}, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 10, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "[矿池统计](/d/ad4559x-zh/pool-zh) | [用户与矿机](/d/adnhx6x-zh/users-zh) | [Hydrapool Github](https://github.com/256-Foundation/Hydra-Pool)\n\n", + "mode": "markdown" + }, + "pluginVersion": "12.2.0", + "title": "导航链接", + "type": "text" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "sishort" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 2 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "expr": "rate(shares_accepted_total[5m])", + "instant": false, + "key": "Q-c238c236-797e-41c6-8283-e14666e6caea-0", + "legendFormat": "矿池算力 (5分钟)", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "expr": "rate(shares_accepted_total[1h])", + "instant": false, + "key": "Q-8109a187-b827-4133-ade2-e87cffe41af4-1", + "legendFormat": "矿池算力 (1小时)", + "range": true, + "refId": "B" + } + ], + "title": "矿池算力", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": false, + "expr": "count((sum by (btcaddress) (rate(worker_shares_valid_total[5m])) > 0))", + "instant": false, + "legendFormat": "用户数", + "range": true, + "refId": "A" + } + ], + "title": "用户数", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 7, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "editorMode": "code", + "exemplar": false, + "expr": "count((sum by (btcaddress, workername) (rate(worker_shares_valid_total[5m])) > 0))", + "instant": false, + "legendFormat": "矿机数", + "range": true, + "refId": "A" + } + ], + "title": "矿机数", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "当前正在挖掘区块的 Coinbase 分配。反映了 PPLNS 计算结果,根据每个用户提交的工作量来分配奖励。同时显示矿池运营商设置的捐赠或费用。", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [] + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 17 + }, + "id": 11, + "options": { + "displayLabels": [], + "legend": { + "displayMode": "list", + "placement": "right", + "showLegend": true, + "values": [ + "value" + ] + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "sort": "desc", + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "editorMode": "builder", + "exemplar": false, + "expr": "coinbase_output", + "format": "time_series", + "instant": true, + "legendFormat": "{{address}}", + "range": false, + "refId": "A" + } + ], + "title": "Coinbase 收益(聪)", + "type": "piechart" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "选定时间段内的算力分布。此分布取决于矿池启动时间和面板顶部选择的时间段。与 Coinbase 收益不同,后者基于 PPLNS 规则计算,不受服务器重启或时间段选择的影响。", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [] + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 17 + }, + "id": 9, + "options": { + "displayLabels": [], + "legend": { + "displayMode": "list", + "placement": "right", + "showLegend": true, + "values": [ + "percent" + ] + }, + "pieType": "donut", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": false + }, + "sort": "desc", + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "editorMode": "code", + "expr": "sum by (btcshort) (\n label_replace(\n worker_shares_valid_total,\n \"btcshort\", \"$1...$2\", \"btcaddress\", \"^(....).*(........)$\"\n )\n)\n", + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "算力分布", + "type": "piechart" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "fieldMinMax": false, + "mappings": [], + "max": 150000000000000, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "sishort" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 6, + "x": 0, + "y": 26 + }, + "id": 4, + "options": { + "minVizHeight": 75, + "minVizWidth": 75, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "sizing": "auto" + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "editorMode": "builder", + "exemplar": false, + "expr": "best_share", + "instant": true, + "legendFormat": "__auto", + "range": false, + "refId": "A" + } + ], + "title": "最佳 Share 难度", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 6, + "x": 6, + "y": 26 + }, + "id": 5, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "editorMode": "builder", + "exemplar": false, + "expr": "time() - start_time_seconds", + "instant": true, + "legendFormat": "运行时间", + "range": false, + "refId": "A" + } + ], + "title": "运行时间", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 26 + }, + "id": 8, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "expr": "rate(shares_accepted_total[$__rate_interval])", + "instant": false, + "interval": "", + "legendFormat": "每秒接收 Shares", + "range": true, + "refId": "A" + } + ], + "title": "每秒接收 Shares", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 36 + }, + "id": 12, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "expr": "rate(shares_rejected_total[$__rate_interval])", + "instant": false, + "legendFormat": "每秒拒绝 Shares", + "range": true, + "refId": "A" + } + ], + "title": "每秒拒绝 Shares", + "type": "timeseries" + } + ], + "preload": false, + "schemaVersion": 42, + "tags": ["chinese", "中文"], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "矿池统计", + "uid": "ad4559x-zh", + "version": 1 +} diff --git a/prometheus/grafana/dashboards/users_private_zh.json b/prometheus/grafana/dashboards/users_private_zh.json new file mode 100644 index 0000000..0e78bc5 --- /dev/null +++ b/prometheus/grafana/dashboards/users_private_zh.json @@ -0,0 +1,384 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 3, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "sishort" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "exemplar": false, + "expr": "sum by(btcaddress) (rate(worker_shares_valid_total{btcaddress=\"$user_address\"}[5m]))", + "instant": false, + "legendFormat": "算力 (5分钟)", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "expr": "sum by(btcaddress) (rate(worker_shares_valid_total{btcaddress=\"$user_address\"}[1h]))", + "hide": false, + "instant": false, + "legendFormat": "算力 (1小时)", + "range": true, + "refId": "B" + } + ], + "title": "用户算力", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "sishort" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "repeat": "workername", + "repeatDirection": "h", + "targets": [ + { + "editorMode": "builder", + "expr": "rate(worker_shares_valid_total{btcaddress=\"$user_address\", workername=\"$workername\"}[5m])", + "instant": false, + "legendFormat": "{{workername}} (5分钟)", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "exemplar": false, + "expr": "rate(worker_shares_valid_total{btcaddress=\"$user_address\", workername=\"$workername\"}[1h])", + "hide": false, + "instant": false, + "interval": "", + "legendFormat": "{{workername}} (1小时)", + "range": true, + "refId": "B" + } + ], + "title": "矿机算力", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "sishort" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 19 + }, + "id": 3, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "12.2.0", + "repeat": "workername", + "repeatDirection": "h", + "targets": [ + { + "editorMode": "builder", + "exemplar": false, + "expr": "worker_best_share_ever{btcaddress=\"$user_address\", workername=\"$workername\"}", + "format": "time_series", + "instant": true, + "legendFormat": "{{workername}}", + "range": false, + "refId": "A" + } + ], + "title": "最高难度", + "type": "stat" + } + ], + "preload": false, + "schemaVersion": 42, + "tags": [ + "chinese", + "中文" + ], + "templating": { + "list": [ + { + "current": { + "text": "", + "value": "" + }, + "description": "用户的比特币地址,用于搜索矿机", + "label": "用户 BTC 地址", + "name": "user_address", + "options": [ + { + "selected": true, + "text": "", + "value": "" + } + ], + "query": "", + "type": "textbox" + }, + { + "allowCustomValue": false, + "current": { + "text": "All", + "value": [ + "$__all" + ] + }, + "definition": "label_values(worker_shares_valid_total{btcaddress=\"$user_address\"},workername)", + "description": "矿机名称", + "includeAll": true, + "label": "矿机名称", + "multi": true, + "name": "workername", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(worker_shares_valid_total{btcaddress=\"$user_address\"},workername)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "sort": 5, + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "用户与矿机(私有)", + "uid": "adnhx6y-zh", + "version": 1 +} \ No newline at end of file diff --git a/prometheus/grafana/dashboards/users_zh.json b/prometheus/grafana/dashboards/users_zh.json new file mode 100644 index 0000000..3e5324b --- /dev/null +++ b/prometheus/grafana/dashboards/users_zh.json @@ -0,0 +1,386 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 4, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "sishort" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "exemplar": false, + "expr": "sum by(btcaddress) (rate(worker_shares_valid_total{btcaddress=\"$user_address\"}[5m]))", + "instant": false, + "legendFormat": "算力 (5分钟)", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "expr": "sum by(btcaddress) (rate(worker_shares_valid_total{btcaddress=\"$user_address\"}[1h]))", + "hide": false, + "instant": false, + "legendFormat": "算力 (1小时)", + "range": true, + "refId": "B" + } + ], + "title": "用户算力", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "sishort" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "repeat": "workername", + "repeatDirection": "h", + "targets": [ + { + "editorMode": "builder", + "expr": "rate(worker_shares_valid_total{btcaddress=\"$user_address\", workername=\"$workername\"}[5m])", + "instant": false, + "legendFormat": "{{workername}} (5分钟)", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "builder", + "exemplar": false, + "expr": "rate(worker_shares_valid_total{btcaddress=\"$user_address\", workername=\"$workername\"}[1h])", + "hide": false, + "instant": false, + "interval": "", + "legendFormat": "{{workername}} (1小时)", + "range": true, + "refId": "B" + } + ], + "title": "矿机算力", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "sishort" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 19 + }, + "id": 3, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "value_and_name", + "wideLayout": true + }, + "pluginVersion": "12.2.0", + "repeat": "workername", + "repeatDirection": "h", + "targets": [ + { + "editorMode": "builder", + "exemplar": false, + "expr": "worker_best_share_ever{btcaddress=\"$user_address\", workername=\"$workername\"}", + "format": "time_series", + "instant": true, + "legendFormat": "{{workername}}", + "range": false, + "refId": "A" + } + ], + "title": "最高难度", + "type": "stat" + } + ], + "preload": false, + "schemaVersion": 42, + "tags": [ + "chinese", + "中文" + ], + "templating": { + "list": [ + { + "allowCustomValue": false, + "current": { + "text": "bc1qu784gk8czv5kwm9pwssk53e0q9trpkec85r0t2", + "value": "bc1qu784gk8czv5kwm9pwssk53e0q9trpkec85r0t2" + }, + "definition": "label_values(worker_shares_valid_total,btcaddress)", + "label": "用户 BTC 地址", + "name": "user_address", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(worker_shares_valid_total,btcaddress)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "sort": 5, + "type": "query" + }, + { + "allowCustomValue": false, + "current": { + "text": "All", + "value": [ + "$__all" + ] + }, + "definition": "label_values(worker_shares_valid_total{btcaddress=\"$user_address\"},workername)", + "description": "矿机名称", + "includeAll": true, + "label": "矿机名称", + "multi": true, + "name": "workername", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(worker_shares_valid_total{btcaddress=\"$user_address\"},workername)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "sort": 5, + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "用户与矿机", + "uid": "adnhx6x-zh", + "version": 1 +} \ No newline at end of file