diff --git a/grafana/flexpool-overview.json b/grafana/flexpool-overview.json index 9d442c7..b62a970 100644 --- a/grafana/flexpool-overview.json +++ b/grafana/flexpool-overview.json @@ -33,6 +33,12 @@ "id": "stat", "name": "Stat", "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" } ], "annotations": { @@ -53,7 +59,7 @@ "gnetId": null, "graphTooltip": 0, "id": null, - "iteration": 1614869549332, + "iteration": 1614928977404, "links": [], "panels": [ { @@ -1076,7 +1082,7 @@ "fillGradient": 0, "gridPos": { "h": 8, - "w": 12, + "w": 6, "x": 0, "y": 25 }, @@ -1280,8 +1286,8 @@ }, "gridPos": { "h": 8, - "w": 12, - "x": 12, + "w": 6, + "x": 6, "y": 25 }, "hideTimeOverride": true, @@ -1391,6 +1397,112 @@ "title": "Paid by the pool", "type": "stat" }, + { + "datasource": "${DS_INFLUXDB}", + "fieldConfig": { + "defaults": { + "custom": { + "align": "center" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "amount" + }, + "properties": [ + { + "id": "decimals", + "value": 5 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "amount (fiat)" + }, + "properties": [ + { + "id": "decimals", + "value": 2 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "duration" + }, + "properties": [ + { + "id": "unit", + "value": "dtdurations" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 25 + }, + "id": 64, + "options": { + "showHeader": true + }, + "pluginVersion": "7.0.0", + "targets": [ + { + "groupBy": [], + "measurement": "flexpool_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", + "rawQuery": true, + "refId": "A", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "amount" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "key": "miner", + "operator": "=~", + "value": "/^$miner$/" + } + ] + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Last payments", + "type": "table" + }, { "collapsed": false, "datasource": "${DS_INFLUXDB}", @@ -2882,5 +2994,5 @@ "timezone": "", "title": "Flexpool overview", "uid": "Q3JPASkgz", - "version": 11 + "version": 12 } \ No newline at end of file diff --git a/telegraf/flexpool.conf b/telegraf/flexpool.conf index 947ac35..de0a4bc 100644 --- a/telegraf/flexpool.conf +++ b/telegraf/flexpool.conf @@ -43,3 +43,14 @@ tagexclude = ["url"] [inputs.http.tags] miner = "${MINER_ADDRESS}" + +[[inputs.http]] + name_override = "flexpool_payments" + urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/payments/?page=0"] + data_format = "json" + tagexclude = ["url"] + json_query = "result.data" + json_time_format = "unix" + json_time_key = "timestamp" + [inputs.http.tags] + miner = "${MINER_ADDRESS}"