mirror of https://github.com/0xERR0R/blocky.git
New Grafana Dashboard for database queries (#265)
This commit is contained in:
parent
807480d32a
commit
af3a9507e9
|
@ -16,6 +16,12 @@
|
||||||
"name": "Bar chart",
|
"name": "Bar chart",
|
||||||
"version": ""
|
"version": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "panel",
|
||||||
|
"id": "bargauge",
|
||||||
|
"name": "Bar gauge",
|
||||||
|
"version": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "grafana",
|
"type": "grafana",
|
||||||
"id": "grafana",
|
"id": "grafana",
|
||||||
|
@ -70,7 +76,7 @@
|
||||||
"gnetId": null,
|
"gnetId": null,
|
||||||
"graphTooltip": 0,
|
"graphTooltip": 0,
|
||||||
"id": null,
|
"id": null,
|
||||||
"iteration": 1630959566500,
|
"iteration": 1631130053746,
|
||||||
"links": [],
|
"links": [],
|
||||||
"panels": [
|
"panels": [
|
||||||
{
|
{
|
||||||
|
@ -97,7 +103,7 @@
|
||||||
},
|
},
|
||||||
"gridPos": {
|
"gridPos": {
|
||||||
"h": 8,
|
"h": 8,
|
||||||
"w": 12,
|
"w": 6,
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0
|
"y": 0
|
||||||
},
|
},
|
||||||
|
@ -105,9 +111,7 @@
|
||||||
"interval": null,
|
"interval": null,
|
||||||
"links": [],
|
"links": [],
|
||||||
"options": {
|
"options": {
|
||||||
"displayLabels": [
|
"displayLabels": [],
|
||||||
"value"
|
|
||||||
],
|
|
||||||
"legend": {
|
"legend": {
|
||||||
"displayMode": "table",
|
"displayMode": "table",
|
||||||
"placement": "right",
|
"placement": "right",
|
||||||
|
@ -135,7 +139,7 @@
|
||||||
"group": [],
|
"group": [],
|
||||||
"metricColumn": "none",
|
"metricColumn": "none",
|
||||||
"rawQuery": true,
|
"rawQuery": true,
|
||||||
"rawSql": "SELECT t.response_type, t.request_Ts as time, count(*) as cnt from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n ($client_name = '*' or t.client_name = $client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\n group by t.response_type\n order by t.request_Ts",
|
"rawSql": "SELECT t.response_type, t.request_Ts as time, count(*) as cnt from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\n group by t.response_type\n order by t.request_Ts",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"select": [
|
"select": [
|
||||||
[
|
[
|
||||||
|
@ -164,9 +168,7 @@
|
||||||
"type": "piechart"
|
"type": "piechart"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cacheTimeout": null,
|
|
||||||
"datasource": "${DS_MYSQL}",
|
"datasource": "${DS_MYSQL}",
|
||||||
"description": "",
|
|
||||||
"fieldConfig": {
|
"fieldConfig": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"color": {
|
"color": {
|
||||||
|
@ -179,8 +181,90 @@
|
||||||
"viz": false
|
"viz": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"displayName": "${__field.labels.client_name}",
|
"mappings": []
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 6,
|
||||||
|
"x": 6,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 16,
|
||||||
|
"options": {
|
||||||
|
"displayLabels": [],
|
||||||
|
"legend": {
|
||||||
|
"displayMode": "table",
|
||||||
|
"placement": "right",
|
||||||
|
"values": [
|
||||||
|
"value"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pieType": "pie",
|
||||||
|
"reduceOptions": {
|
||||||
|
"calcs": [
|
||||||
|
"lastNotNull"
|
||||||
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"format": "time_series",
|
||||||
|
"group": [],
|
||||||
|
"metricColumn": "none",
|
||||||
|
"rawQuery": true,
|
||||||
|
"rawSql": "SELECT t.request_ts AS time,\n case when t.reason like 'BLOCKED%' then SUBSTRING_INDEX(SUBSTRING_INDEX(t.reason,'(',-1), ')',1) else '' end AS metric,\n count(t.reason) AS cnt\nFROM log_entries t\nWHERE t.response_type ='BLOCKED'\n AND $__timeFilter(t.request_Ts)\n AND t.client_name in ($client_name)\n AND (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\nGROUP BY 2\nORDER BY time",
|
||||||
|
"refId": "A",
|
||||||
|
"select": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"params": [
|
||||||
|
"duration_ms"
|
||||||
|
],
|
||||||
|
"type": "column"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"table": "log_entries",
|
||||||
|
"timeColumn": "request_ts",
|
||||||
|
"timeColumnType": "timestamp",
|
||||||
|
"where": [
|
||||||
|
{
|
||||||
|
"name": "$__timeFilter",
|
||||||
|
"params": [],
|
||||||
|
"type": "macro"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Blocked by Blacklist",
|
||||||
|
"type": "piechart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cacheTimeout": null,
|
||||||
|
"datasource": "${DS_MYSQL}",
|
||||||
|
"description": "",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
"mappings": [],
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"unit": "short"
|
"unit": "short"
|
||||||
},
|
},
|
||||||
"overrides": []
|
"overrides": []
|
||||||
|
@ -195,37 +279,27 @@
|
||||||
"interval": null,
|
"interval": null,
|
||||||
"links": [],
|
"links": [],
|
||||||
"options": {
|
"options": {
|
||||||
"displayLabels": [
|
"displayMode": "gradient",
|
||||||
"value"
|
"orientation": "horizontal",
|
||||||
],
|
|
||||||
"legend": {
|
|
||||||
"displayMode": "table",
|
|
||||||
"placement": "right",
|
|
||||||
"values": [
|
|
||||||
"value"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"pieType": "pie",
|
|
||||||
"reduceOptions": {
|
"reduceOptions": {
|
||||||
"calcs": [
|
"calcs": [
|
||||||
"sum"
|
"lastNotNull"
|
||||||
],
|
],
|
||||||
"fields": "",
|
"fields": "",
|
||||||
"values": false
|
"values": true
|
||||||
},
|
},
|
||||||
"tooltip": {
|
"showUnfilled": true,
|
||||||
"mode": "single"
|
"text": {}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"pluginVersion": "8.1.2",
|
"pluginVersion": "8.1.2",
|
||||||
"repeatDirection": "v",
|
"repeatDirection": "v",
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"format": "time_series",
|
"format": "table",
|
||||||
"group": [],
|
"group": [],
|
||||||
"metricColumn": "none",
|
"metricColumn": "none",
|
||||||
"rawQuery": true,
|
"rawQuery": true,
|
||||||
"rawSql": "SELECT t.client_name, t.request_Ts as time, count(*) as cnt from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n ($client_name = '*' or t.client_name = $client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\n group by t.client_name\n order by t.request_Ts",
|
"rawSql": "SELECT t.request_Ts as time, t.client_name as metric, count(*) as cnt from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\n group by t.client_name\n order by 3 desc",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"select": [
|
"select": [
|
||||||
[
|
[
|
||||||
|
@ -251,109 +325,7 @@
|
||||||
"timeShift": null,
|
"timeShift": null,
|
||||||
"title": "Query count by client",
|
"title": "Query count by client",
|
||||||
"transformations": [],
|
"transformations": [],
|
||||||
"type": "piechart"
|
"type": "bargauge"
|
||||||
},
|
|
||||||
{
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"color": {
|
|
||||||
"mode": "palette-classic"
|
|
||||||
},
|
|
||||||
"custom": {
|
|
||||||
"axisLabel": "",
|
|
||||||
"axisPlacement": "auto",
|
|
||||||
"barAlignment": -1,
|
|
||||||
"drawStyle": "bars",
|
|
||||||
"fillOpacity": 0,
|
|
||||||
"gradientMode": "none",
|
|
||||||
"hideFrom": {
|
|
||||||
"legend": false,
|
|
||||||
"tooltip": false,
|
|
||||||
"viz": false
|
|
||||||
},
|
|
||||||
"lineInterpolation": "stepBefore",
|
|
||||||
"lineStyle": {
|
|
||||||
"fill": "solid"
|
|
||||||
},
|
|
||||||
"lineWidth": 1,
|
|
||||||
"pointSize": 5,
|
|
||||||
"scaleDistribution": {
|
|
||||||
"type": "linear"
|
|
||||||
},
|
|
||||||
"showPoints": "auto",
|
|
||||||
"spanNulls": true,
|
|
||||||
"stacking": {
|
|
||||||
"group": "A",
|
|
||||||
"mode": "none"
|
|
||||||
},
|
|
||||||
"thresholdsStyle": {
|
|
||||||
"mode": "line"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mappings": [],
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"unit": "dtdurationms"
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 8,
|
|
||||||
"w": 24,
|
|
||||||
"x": 0,
|
|
||||||
"y": 8
|
|
||||||
},
|
|
||||||
"id": 10,
|
|
||||||
"options": {
|
|
||||||
"legend": {
|
|
||||||
"calcs": [],
|
|
||||||
"displayMode": "hidden",
|
|
||||||
"placement": "bottom"
|
|
||||||
},
|
|
||||||
"tooltip": {
|
|
||||||
"mode": "single"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"format": "time_series",
|
|
||||||
"group": [],
|
|
||||||
"metricColumn": "none",
|
|
||||||
"rawQuery": true,
|
|
||||||
"rawSql": "SELECT\n UNIX_TIMESTAMP(t.request_Ts) as time,\n t.duration_ms\nFROM log_entries t\nWHERE\n $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n ($client_name = '*' or t.client_name = $client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\nORDER BY request_ts",
|
|
||||||
"refId": "A",
|
|
||||||
"select": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
"duration_ms"
|
|
||||||
],
|
|
||||||
"type": "column"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"table": "log_entries",
|
|
||||||
"timeColumn": "request_ts",
|
|
||||||
"timeColumnType": "timestamp",
|
|
||||||
"where": [
|
|
||||||
{
|
|
||||||
"name": "$__timeFilter",
|
|
||||||
"params": [],
|
|
||||||
"type": "macro"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title": "Query duration",
|
|
||||||
"type": "timeseries"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"datasource": "${DS_MYSQL}",
|
"datasource": "${DS_MYSQL}",
|
||||||
|
@ -395,7 +367,7 @@
|
||||||
"h": 8,
|
"h": 8,
|
||||||
"w": 12,
|
"w": 12,
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 16
|
"y": 8
|
||||||
},
|
},
|
||||||
"id": 11,
|
"id": 11,
|
||||||
"options": {
|
"options": {
|
||||||
|
@ -423,7 +395,7 @@
|
||||||
"hide": false,
|
"hide": false,
|
||||||
"metricColumn": "question_name",
|
"metricColumn": "question_name",
|
||||||
"rawQuery": true,
|
"rawQuery": true,
|
||||||
"rawSql": "SELECT t.effective_tldp as metric, count(*) as value from log_entries t \nWHERE $__timeFilter(t.request_Ts) \n and t.response_type in ($response_type) \n and ($client_name = '*' or t.client_name = $client_name) \n and (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0) \n group by t.effective_tldp order by count(*) desc limit 20",
|
"rawSql": "SELECT t.effective_tldp as metric, count(*) as value from log_entries t \nWHERE $__timeFilter(t.request_Ts) \n and t.response_type in ($response_type) \n and t.client_name in ($client_name) \n and (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0) \n group by t.effective_tldp order by count(*) desc limit 20",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"select": [
|
"select": [
|
||||||
[
|
[
|
||||||
|
@ -483,7 +455,7 @@
|
||||||
"h": 8,
|
"h": 8,
|
||||||
"w": 12,
|
"w": 12,
|
||||||
"x": 12,
|
"x": 12,
|
||||||
"y": 16
|
"y": 8
|
||||||
},
|
},
|
||||||
"id": 8,
|
"id": 8,
|
||||||
"options": {
|
"options": {
|
||||||
|
@ -511,7 +483,7 @@
|
||||||
"hide": false,
|
"hide": false,
|
||||||
"metricColumn": "question_name",
|
"metricColumn": "question_name",
|
||||||
"rawQuery": true,
|
"rawQuery": true,
|
||||||
"rawSql": "SELECT t.question_name as metric, count(*) as value from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n ($client_name = '*' or t.client_name = $client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0) \n group by t.question_name order by count(*) desc limit 20",
|
"rawSql": "SELECT t.question_name as metric, count(*) as value from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0) \n group by t.question_name order by count(*) desc limit 20",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"select": [
|
"select": [
|
||||||
[
|
[
|
||||||
|
@ -592,7 +564,7 @@
|
||||||
"h": 7,
|
"h": 7,
|
||||||
"w": 24,
|
"w": 24,
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 24
|
"y": 16
|
||||||
},
|
},
|
||||||
"id": 12,
|
"id": 12,
|
||||||
"options": {
|
"options": {
|
||||||
|
@ -612,7 +584,7 @@
|
||||||
"group": [],
|
"group": [],
|
||||||
"metricColumn": "none",
|
"metricColumn": "none",
|
||||||
"rawQuery": true,
|
"rawQuery": true,
|
||||||
"rawSql": "SELECT\n $__timeGroupAlias(t.request_Ts, '30m'),\n t.client_name,\n count(*) as c\nFROM log_entries t\nWHERE\n $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n ($client_name = '*' or t.client_name = $client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\nGROUP BY 1,2\nORDER BY 1",
|
"rawSql": "SELECT\n $__timeGroupAlias(t.request_Ts, '30m'),\n t.client_name,\n count(*) as c\nFROM log_entries t\nWHERE\n $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\nGROUP BY 1,2\nORDER BY 1",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"select": [
|
"select": [
|
||||||
[
|
[
|
||||||
|
@ -639,6 +611,108 @@
|
||||||
"title": "Queries number per client (30m)",
|
"title": "Queries number per client (30m)",
|
||||||
"type": "timeseries"
|
"type": "timeseries"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"datasource": "${DS_MYSQL}",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "palette-classic"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"axisLabel": "",
|
||||||
|
"axisPlacement": "auto",
|
||||||
|
"barAlignment": -1,
|
||||||
|
"drawStyle": "bars",
|
||||||
|
"fillOpacity": 0,
|
||||||
|
"gradientMode": "none",
|
||||||
|
"hideFrom": {
|
||||||
|
"legend": false,
|
||||||
|
"tooltip": false,
|
||||||
|
"viz": false
|
||||||
|
},
|
||||||
|
"lineInterpolation": "stepBefore",
|
||||||
|
"lineStyle": {
|
||||||
|
"fill": "solid"
|
||||||
|
},
|
||||||
|
"lineWidth": 1,
|
||||||
|
"pointSize": 5,
|
||||||
|
"scaleDistribution": {
|
||||||
|
"type": "linear"
|
||||||
|
},
|
||||||
|
"showPoints": "auto",
|
||||||
|
"spanNulls": true,
|
||||||
|
"stacking": {
|
||||||
|
"group": "A",
|
||||||
|
"mode": "none"
|
||||||
|
},
|
||||||
|
"thresholdsStyle": {
|
||||||
|
"mode": "line"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "dtdurationms"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 24,
|
||||||
|
"x": 0,
|
||||||
|
"y": 23
|
||||||
|
},
|
||||||
|
"id": 10,
|
||||||
|
"options": {
|
||||||
|
"legend": {
|
||||||
|
"calcs": [],
|
||||||
|
"displayMode": "hidden",
|
||||||
|
"placement": "bottom"
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"mode": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"format": "time_series",
|
||||||
|
"group": [],
|
||||||
|
"metricColumn": "none",
|
||||||
|
"rawQuery": true,
|
||||||
|
"rawSql": "SELECT\n UNIX_TIMESTAMP(t.request_Ts) as time,\n t.duration_ms\nFROM log_entries t\nWHERE\n $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\nORDER BY request_ts",
|
||||||
|
"refId": "A",
|
||||||
|
"select": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"params": [
|
||||||
|
"duration_ms"
|
||||||
|
],
|
||||||
|
"type": "column"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"table": "log_entries",
|
||||||
|
"timeColumn": "request_ts",
|
||||||
|
"timeColumnType": "timestamp",
|
||||||
|
"where": [
|
||||||
|
{
|
||||||
|
"name": "$__timeFilter",
|
||||||
|
"params": [],
|
||||||
|
"type": "macro"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Query duration",
|
||||||
|
"type": "timeseries"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"datasource": "${DS_MYSQL}",
|
"datasource": "${DS_MYSQL}",
|
||||||
"description": "Last 100 queries, newest on top",
|
"description": "Last 100 queries, newest on top",
|
||||||
|
@ -692,7 +766,7 @@
|
||||||
"group": [],
|
"group": [],
|
||||||
"metricColumn": "none",
|
"metricColumn": "none",
|
||||||
"rawQuery": true,
|
"rawQuery": true,
|
||||||
"rawSql": "SELECT UNIX_TIMESTAMP(t.request_Ts) as \"time\", \n t.client_ip as \"client IP\", \n t.client_name as \"client name\", \n t.duration_ms as \"duration in ms\", \n t.response_type as \"response type\", \n t.question_type as \"question type\", \n t.question_name as \"question name\", \n t.effective_tldp as \"effective TLD+1\", \n t.answer as \"answer\" from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n ($client_name = '*' or t.client_name = $client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0) \n order by t.request_Ts desc limit 100",
|
"rawSql": "SELECT UNIX_TIMESTAMP(t.request_Ts) as \"time\", \n t.client_ip as \"client IP\", \n t.client_name as \"client name\", \n t.duration_ms as \"duration in ms\", \n t.response_type as \"response type\", \n t.question_type as \"question type\", \n t.question_name as \"question name\", \n t.effective_tldp as \"effective TLD+1\", \n t.answer as \"answer\" from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0) \n order by t.request_Ts desc limit 100",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"select": [
|
"select": [
|
||||||
[
|
[
|
||||||
|
@ -727,7 +801,7 @@
|
||||||
"templating": {
|
"templating": {
|
||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"allValue": "'*'",
|
"allValue": "",
|
||||||
"current": {},
|
"current": {},
|
||||||
"datasource": "${DS_MYSQL}",
|
"datasource": "${DS_MYSQL}",
|
||||||
"definition": "select distinct client_name from log_entries",
|
"definition": "select distinct client_name from log_entries",
|
||||||
|
@ -736,7 +810,7 @@
|
||||||
"hide": 0,
|
"hide": 0,
|
||||||
"includeAll": true,
|
"includeAll": true,
|
||||||
"label": "Client name",
|
"label": "Client name",
|
||||||
"multi": false,
|
"multi": true,
|
||||||
"name": "client_name",
|
"name": "client_name",
|
||||||
"options": [],
|
"options": [],
|
||||||
"query": "select distinct client_name from log_entries",
|
"query": "select distinct client_name from log_entries",
|
||||||
|
@ -803,6 +877,6 @@
|
||||||
"timepicker": {},
|
"timepicker": {},
|
||||||
"timezone": "",
|
"timezone": "",
|
||||||
"title": "Blocky query",
|
"title": "Blocky query",
|
||||||
"uid": "No2u6DmRz",
|
"uid": "AVmWSVWgz",
|
||||||
"version": 47
|
"version": 3
|
||||||
}
|
}
|
|
@ -1,887 +0,0 @@
|
||||||
{
|
|
||||||
"__inputs": [
|
|
||||||
{
|
|
||||||
"name": "DS_MYSQL",
|
|
||||||
"label": "MySQL",
|
|
||||||
"description": "",
|
|
||||||
"type": "datasource",
|
|
||||||
"pluginId": "mysql",
|
|
||||||
"pluginName": "MySQL"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"__requires": [
|
|
||||||
{
|
|
||||||
"type": "panel",
|
|
||||||
"id": "barchart",
|
|
||||||
"name": "Bar chart",
|
|
||||||
"version": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "grafana",
|
|
||||||
"id": "grafana",
|
|
||||||
"name": "Grafana",
|
|
||||||
"version": "8.1.2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "datasource",
|
|
||||||
"id": "mysql",
|
|
||||||
"name": "MySQL",
|
|
||||||
"version": "1.0.0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "panel",
|
|
||||||
"id": "piechart",
|
|
||||||
"name": "Pie chart",
|
|
||||||
"version": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "panel",
|
|
||||||
"id": "table",
|
|
||||||
"name": "Table",
|
|
||||||
"version": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "panel",
|
|
||||||
"id": "timeseries",
|
|
||||||
"name": "Time series",
|
|
||||||
"version": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"annotations": {
|
|
||||||
"list": [
|
|
||||||
{
|
|
||||||
"builtIn": 1,
|
|
||||||
"datasource": "-- Grafana --",
|
|
||||||
"enable": true,
|
|
||||||
"hide": true,
|
|
||||||
"iconColor": "rgba(0, 211, 255, 1)",
|
|
||||||
"name": "Annotations & Alerts",
|
|
||||||
"target": {
|
|
||||||
"limit": 100,
|
|
||||||
"matchAny": false,
|
|
||||||
"tags": [],
|
|
||||||
"type": "dashboard"
|
|
||||||
},
|
|
||||||
"type": "dashboard"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"editable": true,
|
|
||||||
"gnetId": null,
|
|
||||||
"graphTooltip": 0,
|
|
||||||
"id": 27,
|
|
||||||
"iteration": 1631047755590,
|
|
||||||
"links": [],
|
|
||||||
"liveNow": false,
|
|
||||||
"panels": [
|
|
||||||
{
|
|
||||||
"cacheTimeout": null,
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"description": "",
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"color": {
|
|
||||||
"mode": "palette-classic"
|
|
||||||
},
|
|
||||||
"custom": {
|
|
||||||
"hideFrom": {
|
|
||||||
"legend": false,
|
|
||||||
"tooltip": false,
|
|
||||||
"viz": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"displayName": "${__field.labels.response_type}",
|
|
||||||
"mappings": [],
|
|
||||||
"unit": "short"
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 8,
|
|
||||||
"w": 6,
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"id": 14,
|
|
||||||
"interval": null,
|
|
||||||
"links": [],
|
|
||||||
"options": {
|
|
||||||
"displayLabels": [
|
|
||||||
"value"
|
|
||||||
],
|
|
||||||
"legend": {
|
|
||||||
"displayMode": "table",
|
|
||||||
"placement": "right",
|
|
||||||
"values": [
|
|
||||||
"value"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"pieType": "pie",
|
|
||||||
"reduceOptions": {
|
|
||||||
"calcs": [
|
|
||||||
"sum"
|
|
||||||
],
|
|
||||||
"fields": "",
|
|
||||||
"values": false
|
|
||||||
},
|
|
||||||
"tooltip": {
|
|
||||||
"mode": "single"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pluginVersion": "8.1.2",
|
|
||||||
"repeatDirection": "v",
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"format": "time_series",
|
|
||||||
"group": [],
|
|
||||||
"metricColumn": "none",
|
|
||||||
"rawQuery": true,
|
|
||||||
"rawSql": "SELECT t.response_type, t.request_Ts as time, count(*) as cnt from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\n group by t.response_type\n order by t.request_Ts",
|
|
||||||
"refId": "A",
|
|
||||||
"select": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
"value"
|
|
||||||
],
|
|
||||||
"type": "column"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"timeColumn": "time",
|
|
||||||
"where": [
|
|
||||||
{
|
|
||||||
"name": "$__timeFilter",
|
|
||||||
"params": [],
|
|
||||||
"type": "macro"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"timeFrom": null,
|
|
||||||
"timeShift": null,
|
|
||||||
"title": "Query count by response type",
|
|
||||||
"transformations": [],
|
|
||||||
"type": "piechart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"color": {
|
|
||||||
"mode": "palette-classic"
|
|
||||||
},
|
|
||||||
"custom": {
|
|
||||||
"hideFrom": {
|
|
||||||
"legend": false,
|
|
||||||
"tooltip": false,
|
|
||||||
"viz": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mappings": []
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 8,
|
|
||||||
"w": 6,
|
|
||||||
"x": 6,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"id": 16,
|
|
||||||
"options": {
|
|
||||||
"displayLabels": [],
|
|
||||||
"legend": {
|
|
||||||
"displayMode": "table",
|
|
||||||
"placement": "right",
|
|
||||||
"values": [
|
|
||||||
"value"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"pieType": "pie",
|
|
||||||
"reduceOptions": {
|
|
||||||
"calcs": [
|
|
||||||
"lastNotNull"
|
|
||||||
],
|
|
||||||
"fields": "",
|
|
||||||
"values": false
|
|
||||||
},
|
|
||||||
"tooltip": {
|
|
||||||
"mode": "single"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"format": "time_series",
|
|
||||||
"group": [],
|
|
||||||
"metricColumn": "none",
|
|
||||||
"rawQuery": true,
|
|
||||||
"rawSql": "SELECT t.request_ts AS time,\n case when t.reason like 'BLOCKED%' then SUBSTRING_INDEX(SUBSTRING_INDEX(t.reason,'(',-1), ')',1) else '' end AS metric,\n count(t.reason) AS cnt\nFROM log_entries t\nWHERE t.response_type ='BLOCKED'\n AND $__timeFilter(t.request_Ts)\n AND t.client_name in ($client_name)\n AND (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\nGROUP BY 2\nORDER BY time",
|
|
||||||
"refId": "A",
|
|
||||||
"select": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
"duration_ms"
|
|
||||||
],
|
|
||||||
"type": "column"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"table": "log_entries",
|
|
||||||
"timeColumn": "request_ts",
|
|
||||||
"timeColumnType": "timestamp",
|
|
||||||
"where": [
|
|
||||||
{
|
|
||||||
"name": "$__timeFilter",
|
|
||||||
"params": [],
|
|
||||||
"type": "macro"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title": "Blocked by Blacklist",
|
|
||||||
"type": "piechart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cacheTimeout": null,
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"description": "",
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"color": {
|
|
||||||
"mode": "thresholds"
|
|
||||||
},
|
|
||||||
"mappings": [],
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"unit": "short"
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 8,
|
|
||||||
"w": 12,
|
|
||||||
"x": 12,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"id": 13,
|
|
||||||
"interval": null,
|
|
||||||
"links": [],
|
|
||||||
"options": {
|
|
||||||
"displayMode": "gradient",
|
|
||||||
"orientation": "horizontal",
|
|
||||||
"reduceOptions": {
|
|
||||||
"calcs": [
|
|
||||||
"lastNotNull"
|
|
||||||
],
|
|
||||||
"fields": "",
|
|
||||||
"values": true
|
|
||||||
},
|
|
||||||
"showUnfilled": true,
|
|
||||||
"text": {}
|
|
||||||
},
|
|
||||||
"pluginVersion": "8.2.0-32599pre",
|
|
||||||
"repeatDirection": "v",
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"format": "table",
|
|
||||||
"group": [],
|
|
||||||
"metricColumn": "none",
|
|
||||||
"rawQuery": true,
|
|
||||||
"rawSql": "SELECT t.request_Ts as time, t.client_name as metric, count(*) as cnt from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\n group by t.client_name\n order by 3 desc",
|
|
||||||
"refId": "A",
|
|
||||||
"select": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
"value"
|
|
||||||
],
|
|
||||||
"type": "column"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"timeColumn": "time",
|
|
||||||
"where": [
|
|
||||||
{
|
|
||||||
"name": "$__timeFilter",
|
|
||||||
"params": [],
|
|
||||||
"type": "macro"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"timeFrom": null,
|
|
||||||
"timeShift": null,
|
|
||||||
"title": "Query count by client",
|
|
||||||
"transformations": [],
|
|
||||||
"type": "bargauge"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"description": "Top 20 effective top level domain plus one more label",
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"color": {
|
|
||||||
"mode": "palette-classic"
|
|
||||||
},
|
|
||||||
"custom": {
|
|
||||||
"axisLabel": "",
|
|
||||||
"axisPlacement": "auto",
|
|
||||||
"axisSoftMin": 0,
|
|
||||||
"fillOpacity": 67,
|
|
||||||
"gradientMode": "none",
|
|
||||||
"hideFrom": {
|
|
||||||
"legend": false,
|
|
||||||
"tooltip": false,
|
|
||||||
"viz": false
|
|
||||||
},
|
|
||||||
"lineWidth": 2
|
|
||||||
},
|
|
||||||
"displayName": "count",
|
|
||||||
"mappings": [],
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"unit": "short"
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 8,
|
|
||||||
"w": 12,
|
|
||||||
"x": 0,
|
|
||||||
"y": 8
|
|
||||||
},
|
|
||||||
"id": 11,
|
|
||||||
"options": {
|
|
||||||
"barWidth": 0.26,
|
|
||||||
"groupWidth": 0.7,
|
|
||||||
"legend": {
|
|
||||||
"calcs": [],
|
|
||||||
"displayMode": "hidden",
|
|
||||||
"placement": "bottom"
|
|
||||||
},
|
|
||||||
"orientation": "horizontal",
|
|
||||||
"showValue": "never",
|
|
||||||
"stacking": "none",
|
|
||||||
"text": {
|
|
||||||
"valueSize": 10
|
|
||||||
},
|
|
||||||
"tooltip": {
|
|
||||||
"mode": "single"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"format": "table",
|
|
||||||
"group": [],
|
|
||||||
"hide": false,
|
|
||||||
"metricColumn": "question_name",
|
|
||||||
"rawQuery": true,
|
|
||||||
"rawSql": "SELECT t.effective_tldp as metric, count(*) as value from log_entries t \nWHERE $__timeFilter(t.request_Ts) \n and t.response_type in ($response_type) \n and t.client_name in ($client_name) \n and (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0) \n group by t.effective_tldp order by count(*) desc limit 20",
|
|
||||||
"refId": "A",
|
|
||||||
"select": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
"value"
|
|
||||||
],
|
|
||||||
"type": "column"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"table": "log_entries",
|
|
||||||
"timeColumn": "request_ts",
|
|
||||||
"where": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title": "Top 20 effective TLD+1",
|
|
||||||
"type": "barchart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"description": "",
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"color": {
|
|
||||||
"mode": "palette-classic"
|
|
||||||
},
|
|
||||||
"custom": {
|
|
||||||
"axisLabel": "",
|
|
||||||
"axisPlacement": "auto",
|
|
||||||
"axisSoftMin": 0,
|
|
||||||
"fillOpacity": 67,
|
|
||||||
"gradientMode": "none",
|
|
||||||
"hideFrom": {
|
|
||||||
"legend": false,
|
|
||||||
"tooltip": false,
|
|
||||||
"viz": false
|
|
||||||
},
|
|
||||||
"lineWidth": 2
|
|
||||||
},
|
|
||||||
"displayName": "count",
|
|
||||||
"mappings": [],
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"unit": "short"
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 8,
|
|
||||||
"w": 12,
|
|
||||||
"x": 12,
|
|
||||||
"y": 8
|
|
||||||
},
|
|
||||||
"id": 8,
|
|
||||||
"options": {
|
|
||||||
"barWidth": 0.26,
|
|
||||||
"groupWidth": 0.7,
|
|
||||||
"legend": {
|
|
||||||
"calcs": [],
|
|
||||||
"displayMode": "hidden",
|
|
||||||
"placement": "bottom"
|
|
||||||
},
|
|
||||||
"orientation": "horizontal",
|
|
||||||
"showValue": "never",
|
|
||||||
"stacking": "none",
|
|
||||||
"text": {
|
|
||||||
"valueSize": 10
|
|
||||||
},
|
|
||||||
"tooltip": {
|
|
||||||
"mode": "single"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"format": "table",
|
|
||||||
"group": [],
|
|
||||||
"hide": false,
|
|
||||||
"metricColumn": "question_name",
|
|
||||||
"rawQuery": true,
|
|
||||||
"rawSql": "SELECT t.question_name as metric, count(*) as value from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0) \n group by t.question_name order by count(*) desc limit 20",
|
|
||||||
"refId": "A",
|
|
||||||
"select": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
"value"
|
|
||||||
],
|
|
||||||
"type": "column"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"table": "log_entries",
|
|
||||||
"timeColumn": "request_ts",
|
|
||||||
"where": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title": "Top 20 queried domains",
|
|
||||||
"type": "barchart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"description": "",
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"color": {
|
|
||||||
"mode": "palette-classic"
|
|
||||||
},
|
|
||||||
"custom": {
|
|
||||||
"axisLabel": "queries count",
|
|
||||||
"axisPlacement": "auto",
|
|
||||||
"barAlignment": 0,
|
|
||||||
"drawStyle": "bars",
|
|
||||||
"fillOpacity": 35,
|
|
||||||
"gradientMode": "hue",
|
|
||||||
"hideFrom": {
|
|
||||||
"legend": false,
|
|
||||||
"tooltip": false,
|
|
||||||
"viz": false
|
|
||||||
},
|
|
||||||
"lineInterpolation": "linear",
|
|
||||||
"lineStyle": {
|
|
||||||
"fill": "solid"
|
|
||||||
},
|
|
||||||
"lineWidth": 1,
|
|
||||||
"pointSize": 12,
|
|
||||||
"scaleDistribution": {
|
|
||||||
"type": "linear"
|
|
||||||
},
|
|
||||||
"showPoints": "never",
|
|
||||||
"spanNulls": 3600000,
|
|
||||||
"stacking": {
|
|
||||||
"group": "A",
|
|
||||||
"mode": "none"
|
|
||||||
},
|
|
||||||
"thresholdsStyle": {
|
|
||||||
"mode": "off"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"displayName": "${__field.labels.client_name}",
|
|
||||||
"mappings": [],
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"color": "red",
|
|
||||||
"value": 80
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 7,
|
|
||||||
"w": 24,
|
|
||||||
"x": 0,
|
|
||||||
"y": 16
|
|
||||||
},
|
|
||||||
"id": 12,
|
|
||||||
"options": {
|
|
||||||
"legend": {
|
|
||||||
"calcs": [],
|
|
||||||
"displayMode": "list",
|
|
||||||
"placement": "right"
|
|
||||||
},
|
|
||||||
"tooltip": {
|
|
||||||
"mode": "single"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pluginVersion": "8.1.2",
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"format": "time_series",
|
|
||||||
"group": [],
|
|
||||||
"metricColumn": "none",
|
|
||||||
"rawQuery": true,
|
|
||||||
"rawSql": "SELECT\n $__timeGroupAlias(t.request_Ts, '30m'),\n t.client_name,\n count(*) as c\nFROM log_entries t\nWHERE\n $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\nGROUP BY 1,2\nORDER BY 1",
|
|
||||||
"refId": "A",
|
|
||||||
"select": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
"duration_ms"
|
|
||||||
],
|
|
||||||
"type": "column"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"table": "log_entries",
|
|
||||||
"timeColumn": "request_ts",
|
|
||||||
"timeColumnType": "timestamp",
|
|
||||||
"where": [
|
|
||||||
{
|
|
||||||
"name": "$__timeFilter",
|
|
||||||
"params": [],
|
|
||||||
"type": "macro"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title": "Queries number per client (30m)",
|
|
||||||
"type": "timeseries"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"color": {
|
|
||||||
"mode": "palette-classic"
|
|
||||||
},
|
|
||||||
"custom": {
|
|
||||||
"axisLabel": "",
|
|
||||||
"axisPlacement": "auto",
|
|
||||||
"barAlignment": -1,
|
|
||||||
"drawStyle": "bars",
|
|
||||||
"fillOpacity": 0,
|
|
||||||
"gradientMode": "none",
|
|
||||||
"hideFrom": {
|
|
||||||
"legend": false,
|
|
||||||
"tooltip": false,
|
|
||||||
"viz": false
|
|
||||||
},
|
|
||||||
"lineInterpolation": "stepBefore",
|
|
||||||
"lineStyle": {
|
|
||||||
"fill": "solid"
|
|
||||||
},
|
|
||||||
"lineWidth": 1,
|
|
||||||
"pointSize": 5,
|
|
||||||
"scaleDistribution": {
|
|
||||||
"type": "linear"
|
|
||||||
},
|
|
||||||
"showPoints": "auto",
|
|
||||||
"spanNulls": true,
|
|
||||||
"stacking": {
|
|
||||||
"group": "A",
|
|
||||||
"mode": "none"
|
|
||||||
},
|
|
||||||
"thresholdsStyle": {
|
|
||||||
"mode": "line"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mappings": [],
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"unit": "dtdurationms"
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 8,
|
|
||||||
"w": 24,
|
|
||||||
"x": 0,
|
|
||||||
"y": 23
|
|
||||||
},
|
|
||||||
"id": 10,
|
|
||||||
"options": {
|
|
||||||
"legend": {
|
|
||||||
"calcs": [],
|
|
||||||
"displayMode": "hidden",
|
|
||||||
"placement": "bottom"
|
|
||||||
},
|
|
||||||
"tooltip": {
|
|
||||||
"mode": "single"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"format": "time_series",
|
|
||||||
"group": [],
|
|
||||||
"metricColumn": "none",
|
|
||||||
"rawQuery": true,
|
|
||||||
"rawSql": "SELECT\n UNIX_TIMESTAMP(t.request_Ts) as time,\n t.duration_ms\nFROM log_entries t\nWHERE\n $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0)\nORDER BY request_ts",
|
|
||||||
"refId": "A",
|
|
||||||
"select": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
"duration_ms"
|
|
||||||
],
|
|
||||||
"type": "column"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"table": "log_entries",
|
|
||||||
"timeColumn": "request_ts",
|
|
||||||
"timeColumnType": "timestamp",
|
|
||||||
"where": [
|
|
||||||
{
|
|
||||||
"name": "$__timeFilter",
|
|
||||||
"params": [],
|
|
||||||
"type": "macro"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title": "Query duration",
|
|
||||||
"type": "timeseries"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"description": "Last 100 queries, newest on top",
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"custom": {
|
|
||||||
"align": null,
|
|
||||||
"displayMode": "auto",
|
|
||||||
"filterable": false
|
|
||||||
},
|
|
||||||
"mappings": [],
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"matcher": {
|
|
||||||
"id": "byName",
|
|
||||||
"options": "time"
|
|
||||||
},
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"id": "unit",
|
|
||||||
"value": "dateTimeAsIsoNoDateIfToday"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 8,
|
|
||||||
"w": 24,
|
|
||||||
"x": 0,
|
|
||||||
"y": 31
|
|
||||||
},
|
|
||||||
"id": 4,
|
|
||||||
"options": {
|
|
||||||
"showHeader": true
|
|
||||||
},
|
|
||||||
"pluginVersion": "8.2.0-32599pre",
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"format": "table",
|
|
||||||
"group": [],
|
|
||||||
"metricColumn": "none",
|
|
||||||
"rawQuery": true,
|
|
||||||
"rawSql": "SELECT UNIX_TIMESTAMP(t.request_Ts) as \"time\", \n t.client_ip as \"client IP\", \n t.client_name as \"client name\", \n t.duration_ms as \"duration in ms\", \n t.response_type as \"response type\", \n t.question_type as \"question type\", \n t.question_name as \"question name\", \n t.effective_tldp as \"effective TLD+1\", \n t.answer as \"answer\" from log_entries t \n WHERE $__timeFilter(t.request_Ts) and \n t.response_type in ($response_type) and \n t.client_name in ($client_name) and \n (length('$question') = 0 or INSTR(t.question_name, lower('$question')) > 0) \n order by t.request_Ts desc limit 100",
|
|
||||||
"refId": "A",
|
|
||||||
"select": [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"params": [
|
|
||||||
"value"
|
|
||||||
],
|
|
||||||
"type": "column"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"timeColumn": "time",
|
|
||||||
"where": [
|
|
||||||
{
|
|
||||||
"name": "$__timeFilter",
|
|
||||||
"params": [],
|
|
||||||
"type": "macro"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"timeFrom": null,
|
|
||||||
"timeShift": null,
|
|
||||||
"title": "Last queries",
|
|
||||||
"type": "table"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"refresh": "",
|
|
||||||
"schemaVersion": 30,
|
|
||||||
"style": "dark",
|
|
||||||
"tags": [],
|
|
||||||
"templating": {
|
|
||||||
"list": [
|
|
||||||
{
|
|
||||||
"allValue": "",
|
|
||||||
"current": {
|
|
||||||
"selected": false,
|
|
||||||
"text": "All",
|
|
||||||
"value": "$__all"
|
|
||||||
},
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"definition": "select distinct client_name from log_entries",
|
|
||||||
"description": null,
|
|
||||||
"error": null,
|
|
||||||
"hide": 0,
|
|
||||||
"includeAll": true,
|
|
||||||
"label": "Client name",
|
|
||||||
"multi": true,
|
|
||||||
"name": "client_name",
|
|
||||||
"options": [],
|
|
||||||
"query": "select distinct client_name from log_entries",
|
|
||||||
"refresh": 2,
|
|
||||||
"regex": "",
|
|
||||||
"skipUrlSync": false,
|
|
||||||
"sort": 1,
|
|
||||||
"tagValuesQuery": "",
|
|
||||||
"tagsQuery": "",
|
|
||||||
"type": "query",
|
|
||||||
"useTags": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allValue": null,
|
|
||||||
"current": {
|
|
||||||
"selected": false,
|
|
||||||
"text": "All",
|
|
||||||
"value": "$__all"
|
|
||||||
},
|
|
||||||
"datasource": "${DS_MYSQL}",
|
|
||||||
"definition": "select distinct response_type from log_entries",
|
|
||||||
"description": null,
|
|
||||||
"error": null,
|
|
||||||
"hide": 0,
|
|
||||||
"includeAll": true,
|
|
||||||
"label": "Response type",
|
|
||||||
"multi": true,
|
|
||||||
"name": "response_type",
|
|
||||||
"options": [],
|
|
||||||
"query": "select distinct response_type from log_entries",
|
|
||||||
"refresh": 2,
|
|
||||||
"regex": "",
|
|
||||||
"skipUrlSync": false,
|
|
||||||
"sort": 1,
|
|
||||||
"tagValuesQuery": "",
|
|
||||||
"tagsQuery": "",
|
|
||||||
"type": "query",
|
|
||||||
"useTags": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"current": {
|
|
||||||
"selected": false,
|
|
||||||
"text": "",
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"description": null,
|
|
||||||
"error": null,
|
|
||||||
"hide": 0,
|
|
||||||
"label": "Domain (contains)",
|
|
||||||
"name": "question",
|
|
||||||
"options": [
|
|
||||||
{
|
|
||||||
"selected": true,
|
|
||||||
"text": "",
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"query": "",
|
|
||||||
"skipUrlSync": false,
|
|
||||||
"type": "textbox"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"time": {
|
|
||||||
"from": "now-24h",
|
|
||||||
"to": "now"
|
|
||||||
},
|
|
||||||
"timepicker": {},
|
|
||||||
"timezone": "",
|
|
||||||
"title": "Blocky query (modified)",
|
|
||||||
"uid": "EDhUAWZgz",
|
|
||||||
"version": 5
|
|
||||||
}
|
|
Binary file not shown.
After Width: | Height: | Size: 189 KiB |
|
@ -1,6 +1,8 @@
|
||||||
# Integration in Prometheus / Grafana
|
# Integration in Grafana
|
||||||
|
|
||||||
## Prometheus export
|
## Prometheus
|
||||||
|
|
||||||
|
### Prometheus export
|
||||||
|
|
||||||
Blocky can optionally export metrics for [Prometheus](https://prometheus.io/).
|
Blocky can optionally export metrics for [Prometheus](https://prometheus.io/).
|
||||||
|
|
||||||
|
@ -19,24 +21,34 @@ Following metrics will be exported:
|
||||||
| blocky_prefetch_count | Amount of prefetched DNS responses |
|
| blocky_prefetch_count | Amount of prefetched DNS responses |
|
||||||
| blocky_prefetch_domain_name_cache_count | Amount of domain names being prefetched |
|
| blocky_prefetch_domain_name_cache_count | Amount of domain names being prefetched |
|
||||||
|
|
||||||
## Grafana dashboard
|
### Grafana dashboard
|
||||||
|
|
||||||
Example [Grafana](https://grafana.com/) dashboard
|
Example [Grafana](https://grafana.com/) dashboard
|
||||||
definition [as JSON](https://github.com/0xERR0R/blocky/blob/master/docs/blocky-grafana.json)
|
definition [as JSON](https://github.com/0xERR0R/blocky/blob/master/docs/blocky-grafana.json)
|
||||||
or [at grafana.com](https://grafana.com/grafana/dashboards/13768)
|
or [at grafana.com](https://grafana.com/grafana/dashboards/13768)
|
||||||
![grafana-dashboard](https://github.com/0xERR0R/blocky/raw/master/docs/grafana-dashboard.png).
|
![grafana-dashboard](grafana-dashboard.png).
|
||||||
|
|
||||||
This dashboard shows all relevant statistics and allows enabling and disabling the blocking status.
|
This dashboard shows all relevant statistics and allows enabling and disabling the blocking status.
|
||||||
|
|
||||||
## Grafana configuration
|
### Grafana configuration
|
||||||
|
|
||||||
Please install `grafana-piechart-panel` and
|
Please install `grafana-piechart-panel` and
|
||||||
set [disable-sanitize-html](https://grafana.com/docs/grafana/latest/installation/configuration/#disable-sanitize-html)
|
set [disable-sanitize-html](https://grafana.com/docs/grafana/latest/installation/configuration/#disable-sanitize-html)
|
||||||
in config or as env to use control buttons to enable/disable the blocking status.
|
in config or as env to use control buttons to enable/disable the blocking status.
|
||||||
|
|
||||||
## Grafana and Prometheus example project
|
### Grafana and Prometheus example project
|
||||||
|
|
||||||
This [repo](https://github.com/0xERR0R/blocky-grafana-prometheus-example) contains example docker-compose.yml with
|
This [repo](https://github.com/0xERR0R/blocky-grafana-prometheus-example) contains example docker-compose.yml with
|
||||||
blocky, prometheus (with configured scraper for blocky) and grafana with prometheus datasource.
|
blocky, prometheus (with configured scraper for blocky) and grafana with prometheus datasource.
|
||||||
|
|
||||||
|
## MySQL / MariaDB
|
||||||
|
|
||||||
|
If database query logging is activated (see [Query logging](configuration.md#query-logging)), you can use following
|
||||||
|
Grafana Dashboard [as JSON](https://github.com/0xERR0R/blocky/blob/master/docs/blocky-query-grafana.json)
|
||||||
|
or [at grafana.com](https://grafana.com/grafana/dashboards/14980)
|
||||||
|
|
||||||
|
![grafana-dashboard](grafana-query-dashboard.png).
|
||||||
|
|
||||||
|
Please define the MySQL source in Grafana, which points to the database with blocky's log entries.
|
||||||
|
|
||||||
--8<-- "docs/includes/abbreviations.md"
|
--8<-- "docs/includes/abbreviations.md"
|
||||||
|
|
Loading…
Reference in New Issue