homelab-nomad/core/grafana/provisioning/dashboards/default/blocky-query.json

883 lines
22 KiB
JSON
Raw Permalink Normal View History

2022-11-12 00:21:17 +00:00
{
"annotations": {
"list": [
{
"builtIn": 1,
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "datasource",
"uid": "grafana"
},
2022-11-12 00:21:17 +00:00
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"description": "Query report for blocky (MySQL)",
"editable": true,
2022-11-16 16:42:36 +00:00
"fiscalYearStartMonth": 0,
2022-11-12 00:21:17 +00:00
"gnetId": 14980,
"graphTooltip": 0,
"links": [],
2022-11-16 16:42:36 +00:00
"liveNow": false,
2022-11-12 00:21:17 +00:00
"panels": [
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
2022-11-16 16:42:36 +00:00
"decimals": 0,
2022-11-12 00:21:17 +00:00
"mappings": [],
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 0,
"y": 0
},
"id": 14,
"links": [],
2022-11-16 16:42:36 +00:00
"options": {
"legend": {
"calcs": [],
"displayMode": "table",
"placement": "bottom",
"showLegend": true,
"values": [
"value"
]
},
"pieType": "pie",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
2022-11-12 00:21:17 +00:00
"pluginVersion": "8.1.2",
"repeatDirection": "v",
"targets": [
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"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"
}
]
}
],
"title": "Query count by response type",
"transformations": [],
2022-11-16 16:42:36 +00:00
"type": "piechart"
2022-11-12 00:21:17 +00:00
},
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
2022-11-16 16:42:36 +00:00
"decimals": 0,
"mappings": [],
"unit": "short"
2022-11-12 00:21:17 +00:00
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 6,
"y": 0
},
"id": 16,
"links": [],
2022-11-16 16:42:36 +00:00
"options": {
"legend": {
"calcs": [],
"displayMode": "table",
"placement": "bottom",
"showLegend": true,
"values": [
"value"
]
},
"pieType": "pie",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
2022-11-12 00:21:17 +00:00
"targets": [
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"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",
2022-11-16 16:42:36 +00:00
"type": "piechart"
2022-11-12 00:21:17 +00:00
},
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"displayName": "$__cell_1",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 13,
"links": [],
"options": {
"displayMode": "gradient",
2022-11-16 16:42:36 +00:00
"minVizHeight": 10,
"minVizWidth": 0,
2022-11-12 00:21:17 +00:00
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": true
},
"showUnfilled": true,
"text": {}
},
2022-11-16 16:42:36 +00:00
"pluginVersion": "9.2.4",
2022-11-12 00:21:17 +00:00
"repeatDirection": "v",
"targets": [
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"format": "table",
"group": [],
"metricColumn": "f",
"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"
}
]
}
],
"title": "Query count by client",
"transformations": [],
"type": "bargauge"
},
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"description": "Top 20 effective top level domain plus one more label",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"displayName": "$__cell_0",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"id": 11,
"options": {
"displayMode": "gradient",
2022-11-16 16:42:36 +00:00
"minVizHeight": 10,
"minVizWidth": 0,
2022-11-12 00:21:17 +00:00
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": true
},
"showUnfilled": true
},
2022-11-16 16:42:36 +00:00
"pluginVersion": "9.2.4",
2022-11-12 00:21:17 +00:00
"targets": [
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"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": "bargauge"
},
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"displayName": "$__cell_0",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 8
},
"id": 8,
"options": {
"displayMode": "gradient",
2022-11-16 16:42:36 +00:00
"minVizHeight": 10,
"minVizWidth": 0,
2022-11-12 00:21:17 +00:00
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": true
},
"showUnfilled": true
},
2022-11-16 16:42:36 +00:00
"pluginVersion": "9.2.4",
2022-11-12 00:21:17 +00:00
"targets": [
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"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": "bargauge"
},
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
2022-11-16 16:42:36 +00:00
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
2022-11-12 00:21:17 +00:00
"axisPlacement": "auto",
"barAlignment": 0,
2022-11-16 16:42:36 +00:00
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
2022-11-12 00:21:17 +00:00
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
2022-11-16 16:42:36 +00:00
"pointSize": 5,
2022-11-12 00:21:17 +00:00
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
2022-11-16 16:42:36 +00:00
"spanNulls": false,
2022-11-12 00:21:17 +00:00
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
2022-11-16 16:42:36 +00:00
},
"unit": "short"
2022-11-12 00:21:17 +00:00
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 16
},
"id": 12,
"options": {
2022-11-16 16:42:36 +00:00
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "9.2.4",
2022-11-12 00:21:17 +00:00
"targets": [
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"format": "time_series",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n $__timeGroupAlias(t.request_Ts, '30m'),\n t.client_name as metric,\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)",
2022-11-16 16:42:36 +00:00
"type": "timeseries"
2022-11-12 00:21:17 +00:00
},
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
2022-11-16 16:42:36 +00:00
"axisCenteredZero": false,
"axisColorMode": "text",
2022-11-12 00:21:17 +00:00
"axisLabel": "",
"axisPlacement": "auto",
2022-11-16 16:42:36 +00:00
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
2022-11-12 00:21:17 +00:00
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
2022-11-16 16:42:36 +00:00
"lineInterpolation": "linear",
2022-11-12 00:21:17 +00:00
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
2022-11-16 16:42:36 +00:00
"showPoints": "never",
"spanNulls": false,
2022-11-12 00:21:17 +00:00
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
2022-11-16 16:42:36 +00:00
"mode": "off"
2022-11-12 00:21:17 +00:00
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
2022-11-16 16:42:36 +00:00
},
{
"color": "red",
"value": 80
2022-11-12 00:21:17 +00:00
}
]
},
"unit": "dtdurationms"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 23
},
"id": 10,
"options": {
2022-11-16 16:42:36 +00:00
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "9.2.4",
2022-11-12 00:21:17 +00:00
"targets": [
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"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",
2022-11-16 16:42:36 +00:00
"type": "timeseries"
2022-11-12 00:21:17 +00:00
},
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"description": "Last 100 queries, newest on top",
"fieldConfig": {
"defaults": {
"custom": {
"displayMode": "auto",
2022-11-16 16:42:36 +00:00
"filterable": false,
"inspect": false
2022-11-12 00:21:17 +00:00
},
"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": {
2022-11-16 16:42:36 +00:00
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
2022-11-12 00:21:17 +00:00
"showHeader": true
},
2022-11-16 16:42:36 +00:00
"pluginVersion": "9.2.4",
2022-11-12 00:21:17 +00:00
"targets": [
{
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"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"
}
]
}
],
"title": "Last queries",
"type": "table"
}
],
"refresh": "",
2022-11-16 16:42:36 +00:00
"schemaVersion": 37,
2022-11-12 00:21:17 +00:00
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": "",
"current": {
"selected": false,
"text": "All",
"value": "$__all"
},
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"definition": "select distinct client_name from log_entries",
"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
},
{
"current": {
"selected": true,
"text": [
"All"
],
"value": [
"$__all"
]
},
2022-11-16 16:42:36 +00:00
"datasource": {
"type": "mysql",
"uid": "DN2DNsD4z"
},
2022-11-12 00:21:17 +00:00
"definition": "select distinct response_type from log_entries",
"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": ""
},
"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",
"uid": "AVmWSVWgz",
2022-11-16 16:42:36 +00:00
"version": 1,
"weekStart": ""
2022-11-12 00:21:17 +00:00
}