refactor: update grafana dashboard (#15)

Update the sample Grafana dashboard to use a variable for the data
source. All panels have been updated to use the new variable. This makes
it easier to import the dashboard and have it work with different data
sources.
This commit is contained in:
Hector 2021-12-23 11:39:15 +00:00
parent cf71dc7449
commit ae08a798b6
2 changed files with 119 additions and 30 deletions

View File

@ -24,7 +24,7 @@ The default location of the socket is: `/var/run/fail2ban/fail2ban.sock`
The metrics exported by this tool are compatible with Prometheus and Grafana. A sample grafana dashboard can be found in the `grafana.json` file. Just import the contents of this file into a new Grafana dashboard to get started.
*(Sample dashboard is compatible with Grafana `8.2.1` and above)*
*(Sample dashboard is compatible with Grafana `8.3.3` and above)*
## 2. Running the Exporter

View File

@ -1,11 +1,27 @@
{
"__inputs": [],
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__elements": [],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "8.2.1"
"version": "8.3.3"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
@ -41,14 +57,17 @@
},
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": null,
"graphTooltip": 2,
"id": null,
"iteration": 1640159475017,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": null,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "",
"fieldConfig": {
"defaults": {
@ -93,12 +112,23 @@
},
"id": 206,
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "8.2.1",
"pluginVersion": "8.3.3",
"targets": [
{
"exemplar": true,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"exemplar": false,
"expr": "f2b_config_jail_max_retries",
"format": "table",
"instant": true,
@ -107,7 +137,11 @@
"refId": "A"
},
{
"exemplar": true,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"exemplar": false,
"expr": "f2b_config_jail_ban_time",
"format": "table",
"hide": false,
@ -117,7 +151,11 @@
"refId": "B"
},
{
"exemplar": true,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"exemplar": false,
"expr": "f2b_config_jail_find_time",
"format": "table",
"hide": false,
@ -180,7 +218,10 @@
"type": "table"
},
{
"datasource": null,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "",
"fieldConfig": {
"defaults": {
@ -252,6 +293,10 @@
"pluginVersion": "8.2.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"exemplar": true,
"expr": "f2b_jail_failed_total",
"hide": false,
@ -260,14 +305,15 @@
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Fail2Ban Failures (Total)",
"transparent": true,
"type": "timeseries"
},
{
"datasource": null,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "",
"fieldConfig": {
"defaults": {
@ -339,6 +385,10 @@
"pluginVersion": "8.2.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"exemplar": true,
"expr": "f2b_jail_banned_total",
"interval": "",
@ -346,14 +396,15 @@
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Fail2Ban Bans (Total)",
"transparent": true,
"type": "timeseries"
},
{
"datasource": null,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "",
"fieldConfig": {
"defaults": {
@ -425,6 +476,10 @@
"pluginVersion": "8.2.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"exemplar": true,
"expr": "f2b_jail_failed_current",
"interval": "",
@ -432,14 +487,15 @@
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Fail2Ban Failures (Current)",
"transparent": true,
"type": "timeseries"
},
{
"datasource": null,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "",
"fieldConfig": {
"defaults": {
@ -511,6 +567,10 @@
"pluginVersion": "8.2.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"exemplar": true,
"expr": "f2b_jail_banned_current",
"interval": "",
@ -518,14 +578,15 @@
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Fail2Ban Bans (Current)",
"transparent": true,
"type": "timeseries"
},
{
"datasource": null,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "",
"fieldConfig": {
"defaults": {
@ -598,6 +659,10 @@
"pluginVersion": "8.2.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"exemplar": true,
"expr": "f2b_up",
"interval": "",
@ -605,14 +670,15 @@
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Fail2Ban Up",
"transparent": true,
"type": "timeseries"
},
{
"datasource": null,
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "",
"fieldConfig": {
"defaults": {
@ -685,6 +751,10 @@
"pluginVersion": "8.2.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"exemplar": true,
"expr": "f2b_errors",
"interval": "",
@ -692,19 +762,37 @@
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Fail2Ban Exporter Errors",
"transparent": true,
"type": "timeseries"
}
],
"refresh": "30s",
"schemaVersion": 31,
"schemaVersion": 34,
"style": "dark",
"tags": [],
"templating": {
"list": []
"list": [
{
"current": {
"selected": true,
"text": "Prometheus",
"value": "Prometheus"
},
"hide": 0,
"includeAll": false,
"label": "Data Source",
"multi": false,
"name": "DataSource",
"options": [],
"query": "prometheus",
"queryValue": "",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
}
]
},
"time": {
"from": "now-6h",
@ -714,5 +802,6 @@
"timezone": "",
"title": "F2B",
"uid": "cTkH9AT7z",
"version": 13
"version": 17,
"weekStart": ""
}