From e8ba07a1b7be5e8fcd57422b6531b2b0d0f548d4 Mon Sep 17 00:00:00 2001 From: Julien Riou Date: Sun, 28 Mar 2021 16:26:32 +0200 Subject: [PATCH] Rename Flexpool miner measurements Procedure to migrate: Stop telegraf container: ``` docker-compose -f docker-compose.yml stop telegraf ``` Rename all measurements: ``` docker exec -it influxdb influx -unsafeSsl -ssl -database '$INFLUXDB_DB' select * into flexpool_miner_balance from flexpool_balance group by *; drop measurement flexpool_balance; select * into flexpool_miner_stats from flexpool_stats group by *; drop measurement flexpool_stats; select * into flexpool_miner_workers from flexpool_workers group by *; drop measurement flexpool_workers; select * into flexpool_miner_paid from flexpool_paid group by *; drop measurement flexpool_paid; select * into flexpool_miner_daily_revenue_estimation from flexpool_daily_revenue_estimation group by *; drop measurement flexpool_daily_revenue_estimation; select * into flexpool_miner_payments from flexpool_payments group by *; drop measurement flexpool_payments; ``` Update telegraf configuration. Start telegraf: ``` docker-compose -f docker-compose.yml start telegraf ``` Re-import the `grafana/flexpool-overview.json` graph. Signed-off-by: Julien Riou --- grafana/flexpool-overview.json | 78 +++++++++++++++++----------------- grafana/flexpool-workers.json | 10 ++--- telegraf/flexpool-miner.conf | 12 +++--- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/grafana/flexpool-overview.json b/grafana/flexpool-overview.json index 0693f04..625fc1e 100644 --- a/grafana/flexpool-overview.json +++ b/grafana/flexpool-overview.json @@ -142,10 +142,10 @@ "type": "time" } ], - "measurement": "flexpool_balance", + "measurement": "flexpool_miner_balance", "orderByTime": "ASC", "policy": "default", - "query": "SELECT sum(balance_increase)/1000000000000000000 FROM (select non_negative_difference(\"result\") AS balance_increase FROM \"flexpool_balance\" WHERE \"miner\" =~ /^$miner$/ AND $timeFilter) GROUP BY time(1d) TZ('$timezone');", + "query": "SELECT sum(balance_increase)/1000000000000000000 FROM (select non_negative_difference(\"result\") AS balance_increase FROM \"flexpool_miner_balance\" WHERE \"miner\" =~ /^$miner$/ AND $timeFilter) GROUP BY time(1d) TZ('$timezone');", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -201,7 +201,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT sum(balance_increase)/1000000000000000000*$exchange_rate FROM (select non_negative_difference(\"result\") AS balance_increase FROM \"flexpool_balance\" WHERE \"miner\" =~ /^$miner$/ AND $timeFilter) GROUP BY time(1d) TZ('$timezone');", + "query": "SELECT sum(balance_increase)/1000000000000000000*$exchange_rate FROM (select non_negative_difference(\"result\") AS balance_increase FROM \"flexpool_miner_balance\" WHERE \"miner\" =~ /^$miner$/ AND $timeFilter) GROUP BY time(1d) TZ('$timezone');", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -466,10 +466,10 @@ "type": "time" } ], - "measurement": "flexpool_balance", + "measurement": "flexpool_miner_balance", "orderByTime": "ASC", "policy": "default", - "query": "SELECT sum(balance_increase)/1000000000000000000 FROM (select non_negative_difference(\"result\") AS balance_increase FROM \"flexpool_balance\" WHERE \"miner\" =~ /^$miner$/ AND $timeFilter) GROUP BY time(31d) TZ('$timezone');", + "query": "SELECT sum(balance_increase)/1000000000000000000 FROM (select non_negative_difference(\"result\") AS balance_increase FROM \"flexpool_miner_balance\" WHERE \"miner\" =~ /^$miner$/ AND $timeFilter) GROUP BY time(31d) TZ('$timezone');", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -525,7 +525,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT sum(balance_increase)/1000000000000000000*$exchange_rate FROM (select non_negative_difference(\"result\") AS balance_increase FROM \"flexpool_balance\" WHERE \"miner\" =~ /^$miner$/ AND $timeFilter) GROUP BY time(31d) TZ('$timezone');", + "query": "SELECT sum(balance_increase)/1000000000000000000*$exchange_rate FROM (select non_negative_difference(\"result\") AS balance_increase FROM \"flexpool_miner_balance\" WHERE \"miner\" =~ /^$miner$/ AND $timeFilter) GROUP BY time(31d) TZ('$timezone');", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -796,10 +796,10 @@ "type": "fill" } ], - "measurement": "flexpool_balance", + "measurement": "flexpool_miner_balance", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_balance\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_miner_balance\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -843,7 +843,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_balance\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_miner_balance\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -981,10 +981,10 @@ "type": "fill" } ], - "measurement": "flexpool_balance", + "measurement": "flexpool_miner_balance", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_balance\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_miner_balance\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1028,7 +1028,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_balance\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_miner_balance\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1119,10 +1119,10 @@ "type": "fill" } ], - "measurement": "flexpool_daily_revenue_estimation", + "measurement": "flexpool_miner_daily_revenue_estimation", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_daily_revenue_estimation\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_miner_daily_revenue_estimation\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1267,10 +1267,10 @@ "type": "fill" } ], - "measurement": "flexpool_daily_revenue_estimation", + "measurement": "flexpool_miner_daily_revenue_estimation", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_daily_revenue_estimation\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_miner_daily_revenue_estimation\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1314,7 +1314,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_daily_revenue_estimation\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_miner_daily_revenue_estimation\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1412,10 +1412,10 @@ "type": "fill" } ], - "measurement": "flexpool_paid", + "measurement": "flexpool_miner_paid", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_paid\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_miner_paid\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1459,7 +1459,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_paid\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_miner_paid\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1599,10 +1599,10 @@ "type": "fill" } ], - "measurement": "flexpool_paid", + "measurement": "flexpool_miner_paid", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_paid\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000 FROM \"flexpool_miner_paid\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1646,7 +1646,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_paid\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "query": "SELECT mean(\"result\")/1000000000000000000*$exchange_rate FROM \"flexpool_miner_paid\" WHERE (\"miner\" =~ /^$miner$/) AND $timeFilter GROUP BY time($__interval) fill(null)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1753,10 +1753,10 @@ "targets": [ { "groupBy": [], - "measurement": "flexpool_payments", + "measurement": "flexpool_miner_payments", "orderByTime": "ASC", "policy": "default", - "query": "SELECT \"amount\"/1000000000000000000, \"amount\"/1000000000000000000*$exchange_rate as \"amount (fiat)\", \"duration\" FROM \"flexpool_payments\" WHERE (\"miner\" =~ /^$miner$/) order by time desc limit 6", + "query": "SELECT \"amount\"/1000000000000000000, \"amount\"/1000000000000000000*$exchange_rate as \"amount (fiat)\", \"duration\" FROM \"flexpool_miner_payments\" WHERE (\"miner\" =~ /^$miner$/) order by time desc limit 6", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -1878,7 +1878,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -1921,7 +1921,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "B", @@ -1964,7 +1964,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "C", @@ -2098,7 +2098,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -2141,7 +2141,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "B", @@ -2184,7 +2184,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "C", @@ -2310,7 +2310,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -2353,7 +2353,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "B", @@ -2396,7 +2396,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "C", @@ -2521,7 +2521,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -2619,7 +2619,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -2718,7 +2718,7 @@ "type": "fill" } ], - "measurement": "flexpool_stats", + "measurement": "flexpool_miner_stats", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -2772,7 +2772,7 @@ "multi": false, "name": "miner", "options": [], - "query": "SHOW TAG VALUES WITH KEY = \"miner\"", + "query": "SHOW TAG VALUES FROM flexpool_miner_stats WITH KEY = \"miner\"", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -2977,4 +2977,4 @@ "title": "Flexpool overview", "uid": "Q3JPASkgz", "version": 11 -} \ No newline at end of file +} diff --git a/grafana/flexpool-workers.json b/grafana/flexpool-workers.json index 2a1b333..fc4fb4f 100644 --- a/grafana/flexpool-workers.json +++ b/grafana/flexpool-workers.json @@ -1062,7 +1062,7 @@ "allValue": null, "current": {}, "datasource": "${DS_INFLUXDB}", - "definition": "SHOW TAG VALUES WITH KEY = \"miner\"", + "definition": "SHOW TAG VALUES FROM flexpool_miner_stats WITH KEY = \"miner\"", "error": null, "hide": 0, "includeAll": false, @@ -1070,7 +1070,7 @@ "multi": false, "name": "miner", "options": [], - "query": "SHOW TAG VALUES WITH KEY = \"miner\"", + "query": "SHOW TAG VALUES FROM flexpool_miner_stats WITH KEY = \"miner\"", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1085,7 +1085,7 @@ "allValue": null, "current": {}, "datasource": "${DS_INFLUXDB}", - "definition": "SHOW TAG VALUES WITH KEY = \"name\" WHERE miner =~ /^$miner$/", + "definition": "SHOW TAG VALUES FROM flexpool_miner_stats WITH KEY = \"name\" WHERE miner =~ /^$miner$/", "error": null, "hide": 0, "includeAll": false, @@ -1093,7 +1093,7 @@ "multi": false, "name": "worker", "options": [], - "query": "SHOW TAG VALUES WITH KEY = \"name\" WHERE miner =~ /^$miner$/", + "query": "SHOW TAG VALUES FROM flexpool_miner_stats WITH KEY = \"name\" WHERE miner =~ /^$miner$/", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1127,4 +1127,4 @@ "title": "Flexpool workers", "uid": "slcUBSzgz", "version": 2 -} \ No newline at end of file +} diff --git a/telegraf/flexpool-miner.conf b/telegraf/flexpool-miner.conf index 8393a8f..d56920a 100644 --- a/telegraf/flexpool-miner.conf +++ b/telegraf/flexpool-miner.conf @@ -1,5 +1,5 @@ [[inputs.http]] - name_override = "flexpool_balance" + name_override = "flexpool_miner_balance" urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/balance"] data_format = "json" tagexclude = ["url"] @@ -7,7 +7,7 @@ miner = "${MINER_ADDRESS}" [[inputs.http]] - name_override = "flexpool_stats" + name_override = "flexpool_miner_stats" urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/stats"] data_format = "json" fieldpass = ["*hashrate", "*shares"] @@ -17,7 +17,7 @@ miner = "${MINER_ADDRESS}" [[inputs.http]] - name_override = "flexpool_workers" + name_override = "flexpool_miner_workers" urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/workers"] data_format = "json" tagexclude = ["url"] @@ -28,7 +28,7 @@ miner = "${MINER_ADDRESS}" [[inputs.http]] - name_override = "flexpool_paid" + name_override = "flexpool_miner_paid" urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/totalPaid"] data_format = "json" tagexclude = ["url"] @@ -36,7 +36,7 @@ miner = "${MINER_ADDRESS}" [[inputs.http]] - name_override = "flexpool_daily_revenue_estimation" + name_override = "flexpool_miner_daily_revenue_estimation" urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/estimatedDailyRevenue"] data_format = "json" tagexclude = ["url"] @@ -44,7 +44,7 @@ miner = "${MINER_ADDRESS}" [[inputs.http]] - name_override = "flexpool_payments" + name_override = "flexpool_miner_payments" urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/payments/?page=0"] data_format = "json" tagexclude = ["url"]