From 02fa342e7d98365b7bde8a390e0432249aaf12a1 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 19 Jun 2024 21:08:54 +0200 Subject: grafana: create new dashboards for revamped blackbox exporter metric labels --- .../grafana/files/dashboard-blackbox/mqtt.json | 823 +++++++++++++++++++++ 1 file changed, 823 insertions(+) create mode 100644 roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json (limited to 'roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json') diff --git a/roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json b/roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json new file mode 100644 index 00000000..40eddf82 --- /dev/null +++ b/roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json @@ -0,0 +1,823 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "11.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "description": "Blackbox Exporter MQTT Targets", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 7587, + "graphTooltip": 0, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 138, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "multi", + "sort": "asc" + } + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "probe_duration_seconds{svc_kind=~\"mqtt\", svc_name=~\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "legendFormat": "{{ svc_name }}", + "range": true, + "refId": "A" + } + ], + "title": "Global Probe Duration", + "type": "timeseries" + }, + { + "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 8 + }, + "id": 15, + "panels": [], + "repeat": "target", + "repeatDirection": "h", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "$target", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "text": "DOWN" + }, + "1": { + "text": "UP" + } + }, + "type": "value" + }, + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#d44a3a", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 1 + }, + { + "color": "#299c46", + "value": 1 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 8, + "x": 0, + "y": 9 + }, + "id": 2, + "maxDataPoints": 100, + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.0.0", + "repeatDirection": "v", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "probe_success{svc_kind=\"mqtt\", svc_name=~\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "range": true, + "refId": "A" + } + ], + "title": "Status", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 5, + "x": 8, + "y": 9 + }, + "id": 23, + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "avg(probe_duration_seconds{svc_kind=\"mqtt\", svc_name=~\"$target\"})", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "range": true, + "refId": "A" + } + ], + "title": "Average Probe Duration", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 0.2 + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 11, + "x": 13, + "y": 9 + }, + "id": 17, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "tooltip": { + "maxHeight": 600, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "probe_duration_seconds{svc_kind=\"mqtt\", svc_name=~\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "legendFormat": "seconds", + "range": true, + "refId": "A" + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "0": { + "text": "NO" + }, + "1": { + "text": "YES" + } + }, + "type": "value" + }, + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#d44a3a", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 0 + }, + { + "color": "#299c46", + "value": 1209600 + } + ] + }, + "unit": "dtdurations" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 8, + "x": 0, + "y": 12 + }, + "id": 19, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.0.0", + "repeatDirection": "h", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "probe_ssl_earliest_cert_expiry{svc_kind=\"mqtt\", svc_name=~\"$target\"} - time()", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "range": true, + "refId": "A" + } + ], + "title": "SSL Expiry", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 5, + "x": 8, + "y": 12 + }, + "id": 24, + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.0.0", + "repeatDirection": "h", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "avg(probe_dns_lookup_time_seconds{svc_kind=\"mqtt\", svc_name=~\"$target\"})", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "range": true, + "refId": "A" + } + ], + "title": "Average DNS Lookup", + "type": "stat" + } + ], + "refresh": "10s", + "schemaVersion": 39, + "tags": [ + "blackbox", + "prometheus" + ], + "templating": { + "list": [ + { + "auto": true, + "auto_count": 10, + "auto_min": "10s", + "current": { + "selected": false, + "text": "10s", + "value": "10s" + }, + "hide": 0, + "label": "Interval", + "name": "interval", + "options": [ + { + "selected": false, + "text": "auto", + "value": "$__auto_interval_interval" + }, + { + "selected": false, + "text": "5s", + "value": "5s" + }, + { + "selected": true, + "text": "10s", + "value": "10s" + }, + { + "selected": false, + "text": "30s", + "value": "30s" + }, + { + "selected": false, + "text": "1m", + "value": "1m" + }, + { + "selected": false, + "text": "10m", + "value": "10m" + }, + { + "selected": false, + "text": "30m", + "value": "30m" + }, + { + "selected": false, + "text": "1h", + "value": "1h" + }, + { + "selected": false, + "text": "6h", + "value": "6h" + }, + { + "selected": false, + "text": "12h", + "value": "12h" + }, + { + "selected": false, + "text": "1d", + "value": "1d" + }, + { + "selected": false, + "text": "7d", + "value": "7d" + }, + { + "selected": false, + "text": "14d", + "value": "14d" + }, + { + "selected": false, + "text": "30d", + "value": "30d" + } + ], + "query": "5s,10s,30s,1m,10m,30m,1h,6h,12h,1d,7d,14d,30d", + "queryValue": "", + "refresh": 2, + "skipUrlSync": false, + "type": "interval" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(probe_success{svc_kind=~\"mqtt\"},svc_name)", + "hide": 0, + "includeAll": true, + "multi": true, + "name": "target", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(probe_success{svc_kind=~\"mqtt\"},svc_name)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tagsQuery": "", + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "", + "title": "mqtt", + "uid": "ddpa033pbeubkb", + "version": 4, + "weekStart": "" +} \ No newline at end of file -- cgit v1.2.3 From 6cd14100e53002280286af048a7dca4e7127ebd3 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 20 Jun 2024 19:35:10 +0200 Subject: rename new blackbox-exporter metric label from svc_name to svc_instance --- inventory/host_vars/ch-apps/vars.yml | 2 +- inventory/host_vars/ch-atlas.yml | 2 +- inventory/host_vars/ch-epimetheus.yml | 2 +- inventory/host_vars/ch-greenbone.yml | 4 ++-- inventory/host_vars/ch-gw-lan.yml | 2 +- inventory/host_vars/ch-http-proxy.yml | 4 ++-- inventory/host_vars/ch-imap-proxy.yml | 2 +- inventory/host_vars/ch-iot.yml | 4 ++-- inventory/host_vars/ch-jump.yml | 2 +- inventory/host_vars/ch-mimas.yml | 4 ++-- inventory/host_vars/ch-mon.yml | 4 ++-- inventory/host_vars/ch-pan.yml | 4 ++-- inventory/host_vars/ch-phoebe.yml | 2 +- inventory/host_vars/ch-prometheus.yml | 2 +- inventory/host_vars/ch-repo.yml | 4 ++-- .../grafana/files/dashboard-blackbox/https.json | 26 +++++++++++----------- .../grafana/files/dashboard-blackbox/mqtt.json | 18 +++++++-------- .../grafana/files/dashboard-blackbox/ssh.json | 16 ++++++------- .../exporter/register/filter_plugins/prometheus.py | 2 +- .../register/templates/blackbox/probe.yml.j2 | 2 +- 20 files changed, 54 insertions(+), 54 deletions(-) (limited to 'roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json') diff --git a/inventory/host_vars/ch-apps/vars.yml b/inventory/host_vars/ch-apps/vars.yml index 8ea12d8b..22a5578a 100644 --- a/inventory/host_vars/ch-apps/vars.yml +++ b/inventory/host_vars/ch-apps/vars.yml @@ -66,7 +66,7 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ch-atlas.yml b/inventory/host_vars/ch-atlas.yml index 3ee9f7ac..1f4dda2f 100644 --- a/inventory/host_vars/ch-atlas.yml +++ b/inventory/host_vars/ch-atlas.yml @@ -74,6 +74,6 @@ prometheus_exporter_node_textfile_collector_scripts: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network.primary.address | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ch-epimetheus.yml b/inventory/host_vars/ch-epimetheus.yml index e76d10ae..39ddbc3d 100644 --- a/inventory/host_vars/ch-epimetheus.yml +++ b/inventory/host_vars/ch-epimetheus.yml @@ -41,7 +41,7 @@ prometheus_exporter_node_textfile_collector_scripts: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.lan.prefix | ansible.utils.ipaddr(network_zones.lan.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ch-greenbone.yml b/inventory/host_vars/ch-greenbone.yml index 4372ecd1..e5e4c3fc 100644 --- a/inventory/host_vars/ch-greenbone.yml +++ b/inventory/host_vars/ch-greenbone.yml @@ -44,11 +44,11 @@ spreadspace_apt_repo_components: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner - svc_kind: https - svc_name: "greenbone.chaos-at-home.org" + svc_instance: "greenbone.chaos-at-home.org" target: "https://{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}/robots.txt" module: http_tls_2xx diff --git a/inventory/host_vars/ch-gw-lan.yml b/inventory/host_vars/ch-gw-lan.yml index e621648c..5677359c 100644 --- a/inventory/host_vars/ch-gw-lan.yml +++ b/inventory/host_vars/ch-gw-lan.yml @@ -49,7 +49,7 @@ spreadspace_apt_repo_components: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ch-http-proxy.yml b/inventory/host_vars/ch-http-proxy.yml index a61eb68a..1e998ed0 100644 --- a/inventory/host_vars/ch-http-proxy.yml +++ b/inventory/host_vars/ch-http-proxy.yml @@ -50,11 +50,11 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner - svc_kind: https - svc_name: "login.chaos-at-home.org" + svc_instance: "login.chaos-at-home.org" target: "https://{{ network_services.http.addr }}/login" module: "http_tls_2xx" hostname: "login.chaos-at-home.org" diff --git a/inventory/host_vars/ch-imap-proxy.yml b/inventory/host_vars/ch-imap-proxy.yml index 16c5e047..b54fabcc 100644 --- a/inventory/host_vars/ch-imap-proxy.yml +++ b/inventory/host_vars/ch-imap-proxy.yml @@ -43,7 +43,7 @@ spreadspace_apt_repo_components: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ch-iot.yml b/inventory/host_vars/ch-iot.yml index 53af0fb5..30bee5d8 100644 --- a/inventory/host_vars/ch-iot.yml +++ b/inventory/host_vars/ch-iot.yml @@ -93,11 +93,11 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner - svc_kind: mqtt - svc_name: "mqtt.chaos-at-home.org" + svc_instance: "mqtt.chaos-at-home.org" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:1883" module: "tcp_tls_connect" hostname: "mqtt.chaos-at-home.org" diff --git a/inventory/host_vars/ch-jump.yml b/inventory/host_vars/ch-jump.yml index 9af98aa1..d0d84bf5 100644 --- a/inventory/host_vars/ch-jump.yml +++ b/inventory/host_vars/ch-jump.yml @@ -69,6 +69,6 @@ spreadspace_apt_repo_components: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ch-mimas.yml b/inventory/host_vars/ch-mimas.yml index 131d9396..bc09509d 100644 --- a/inventory/host_vars/ch-mimas.yml +++ b/inventory/host_vars/ch-mimas.yml @@ -135,11 +135,11 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ external_ip }}:{{ ansible_port | default(22) }}" module: ssh_banner - svc_kind: https - svc_name: "mimas.chaos-at-home.org" + svc_instance: "mimas.chaos-at-home.org" target: "https://mimas.chaos-at-home.org" module: http_tls_2xx diff --git a/inventory/host_vars/ch-mon.yml b/inventory/host_vars/ch-mon.yml index 0b830a88..c514550e 100644 --- a/inventory/host_vars/ch-mon.yml +++ b/inventory/host_vars/ch-mon.yml @@ -175,11 +175,11 @@ prometheus_exporter_smokeping_targets: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner - svc_kind: https - svc_name: "mon.chaos-at-home.org" + svc_instance: "mon.chaos-at-home.org" target: "https://{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}/healthz" module: http_tls_2xx diff --git a/inventory/host_vars/ch-pan.yml b/inventory/host_vars/ch-pan.yml index 0edb86a1..29ec85ae 100644 --- a/inventory/host_vars/ch-pan.yml +++ b/inventory/host_vars/ch-pan.yml @@ -171,11 +171,11 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network.primary.address | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner - svc_kind: https - svc_name: "pan.chaos-at-home.org" + svc_instance: "pan.chaos-at-home.org" target: "https://pan.chaos-at-home.org" module: http_tls_2xx diff --git a/inventory/host_vars/ch-phoebe.yml b/inventory/host_vars/ch-phoebe.yml index ca787492..0f2ed044 100644 --- a/inventory/host_vars/ch-phoebe.yml +++ b/inventory/host_vars/ch-phoebe.yml @@ -70,7 +70,7 @@ prometheus_exporter_ipmi_modules: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.lan.prefix | ansible.utils.ipaddr(network_zones.lan.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ch-prometheus.yml b/inventory/host_vars/ch-prometheus.yml index df6fa39a..b5641464 100644 --- a/inventory/host_vars/ch-prometheus.yml +++ b/inventory/host_vars/ch-prometheus.yml @@ -65,7 +65,7 @@ prometheus_exporter_ipmi_modules: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.lan.prefix | ansible.utils.ipaddr(network_zones.lan.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ch-repo.yml b/inventory/host_vars/ch-repo.yml index c911195b..de952d74 100644 --- a/inventory/host_vars/ch-repo.yml +++ b/inventory/host_vars/ch-repo.yml @@ -77,10 +77,10 @@ approx_backends: prometheus_job_multitarget_blackbox__probe: ch-mon: - svc_kind: ssh - svc_name: "{{ inventory_hostname }}" + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner - svc_kind: http - svc_name: "apt.chaos-at-home.org" + svc_instance: "apt.chaos-at-home.org" target: "http://{{ approx_hostname }}" module: "http_2xx" diff --git a/roles/monitoring/grafana/files/dashboard-blackbox/https.json b/roles/monitoring/grafana/files/dashboard-blackbox/https.json index 0d322f3d..061be3ae 100644 --- a/roles/monitoring/grafana/files/dashboard-blackbox/https.json +++ b/roles/monitoring/grafana/files/dashboard-blackbox/https.json @@ -156,11 +156,11 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_duration_seconds{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "expr": "probe_duration_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, - "legendFormat": "{{ svc_name }}", + "legendFormat": "{{ svc_instance }}", "range": true, "refId": "A" } @@ -282,7 +282,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_success{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "expr": "probe_success{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -381,7 +381,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_http_duration_seconds{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "expr": "probe_http_duration_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -486,7 +486,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_duration_seconds{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "expr": "probe_duration_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -585,7 +585,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_http_status_code{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "expr": "probe_http_status_code{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -666,7 +666,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_http_version{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "expr": "probe_http_version{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "intervalFactor": 1, "range": true, @@ -762,7 +762,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_http_ssl{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "expr": "probe_http_ssl{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -860,7 +860,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_ssl_earliest_cert_expiry{svc_kind=~\"https?\", svc_name=~\"$target\"} - time()", + "expr": "probe_ssl_earliest_cert_expiry{svc_kind=~\"https?\", svc_instance=~\"$target\"} - time()", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -941,7 +941,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "avg(probe_duration_seconds{svc_kind=~\"https?\", svc_name=~\"$target\"})", + "expr": "avg(probe_duration_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"})", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -1023,7 +1023,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "avg(probe_dns_lookup_time_seconds{svc_kind=~\"https?\", svc_name=~\"$target\"})", + "expr": "avg(probe_dns_lookup_time_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"})", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -1139,7 +1139,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "definition": "label_values(probe_success{svc_kind=~\"https?\"},svc_name)", + "definition": "label_values(probe_success{svc_kind=~\"https?\"},svc_instance)", "hide": 0, "includeAll": true, "multi": true, @@ -1147,7 +1147,7 @@ "options": [], "query": { "qryType": 1, - "query": "label_values(probe_success{svc_kind=~\"https?\"},svc_name)", + "query": "label_values(probe_success{svc_kind=~\"https?\"},svc_instance)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, diff --git a/roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json b/roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json index 40eddf82..f019677f 100644 --- a/roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json +++ b/roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json @@ -156,11 +156,11 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_duration_seconds{svc_kind=~\"mqtt\", svc_name=~\"$target\"}", + "expr": "probe_duration_seconds{svc_kind=~\"mqtt\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, - "legendFormat": "{{ svc_name }}", + "legendFormat": "{{ svc_instance }}", "range": true, "refId": "A" } @@ -282,7 +282,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_success{svc_kind=\"mqtt\", svc_name=~\"$target\"}", + "expr": "probe_success{svc_kind=\"mqtt\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -363,7 +363,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "avg(probe_duration_seconds{svc_kind=\"mqtt\", svc_name=~\"$target\"})", + "expr": "avg(probe_duration_seconds{svc_kind=\"mqtt\", svc_instance=~\"$target\"})", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -467,7 +467,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_duration_seconds{svc_kind=\"mqtt\", svc_name=~\"$target\"}", + "expr": "probe_duration_seconds{svc_kind=\"mqtt\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -565,7 +565,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_ssl_earliest_cert_expiry{svc_kind=\"mqtt\", svc_name=~\"$target\"} - time()", + "expr": "probe_ssl_earliest_cert_expiry{svc_kind=\"mqtt\", svc_instance=~\"$target\"} - time()", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -647,7 +647,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "avg(probe_dns_lookup_time_seconds{svc_kind=\"mqtt\", svc_name=~\"$target\"})", + "expr": "avg(probe_dns_lookup_time_seconds{svc_kind=\"mqtt\", svc_instance=~\"$target\"})", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -763,7 +763,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "definition": "label_values(probe_success{svc_kind=~\"mqtt\"},svc_name)", + "definition": "label_values(probe_success{svc_kind=~\"mqtt\"},svc_instance)", "hide": 0, "includeAll": true, "multi": true, @@ -771,7 +771,7 @@ "options": [], "query": { "qryType": 1, - "query": "label_values(probe_success{svc_kind=~\"mqtt\"},svc_name)", + "query": "label_values(probe_success{svc_kind=~\"mqtt\"},svc_instance)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, diff --git a/roles/monitoring/grafana/files/dashboard-blackbox/ssh.json b/roles/monitoring/grafana/files/dashboard-blackbox/ssh.json index 93c3206f..af8d31e1 100644 --- a/roles/monitoring/grafana/files/dashboard-blackbox/ssh.json +++ b/roles/monitoring/grafana/files/dashboard-blackbox/ssh.json @@ -156,11 +156,11 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_duration_seconds{svc_kind=\"ssh\", svc_name=~\"$target\"}", + "expr": "probe_duration_seconds{svc_kind=\"ssh\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, - "legendFormat": "{{ svc_name }}", + "legendFormat": "{{ svc_instance }}", "range": true, "refId": "A" } @@ -282,7 +282,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_success{svc_kind=\"ssh\", svc_name=\"$target\"}", + "expr": "probe_success{svc_kind=\"ssh\", svc_instance=\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -363,7 +363,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "avg(probe_duration_seconds{svc_kind=\"ssh\", svc_name=\"$target\"})", + "expr": "avg(probe_duration_seconds{svc_kind=\"ssh\", svc_instance=\"$target\"})", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -445,7 +445,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "avg(probe_dns_lookup_time_seconds{svc_kind=\"ssh\", svc_name=\"$target\"})", + "expr": "avg(probe_dns_lookup_time_seconds{svc_kind=\"ssh\", svc_instance=\"$target\"})", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -549,7 +549,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "probe_duration_seconds{svc_kind=\"ssh\", svc_name=\"$target\"}", + "expr": "probe_duration_seconds{svc_kind=\"ssh\", svc_instance=\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, @@ -665,7 +665,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "definition": "label_values(probe_success{svc_kind=\"ssh\"},svc_name)", + "definition": "label_values(probe_success{svc_kind=\"ssh\"},svc_instance)", "hide": 0, "includeAll": true, "multi": true, @@ -673,7 +673,7 @@ "options": [], "query": { "qryType": 1, - "query": "label_values(probe_success{svc_kind=\"ssh\"},svc_name)", + "query": "label_values(probe_success{svc_kind=\"ssh\"},svc_instance)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, diff --git a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py index 27ba29e6..9c99113d 100644 --- a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py +++ b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py @@ -7,7 +7,7 @@ from ansible import errors _multitarget_id_map_ = { - "blackbox/probe": (lambda vars, config: (vars['inventory_hostname'], "%s-%s" % (config['svc_kind'], config['svc_name']))), + "blackbox/probe": (lambda vars, config: (vars['inventory_hostname'], "%s-%s" % (config['svc_kind'], config['svc_instance']))), } diff --git a/roles/monitoring/prometheus/exporter/register/templates/blackbox/probe.yml.j2 b/roles/monitoring/prometheus/exporter/register/templates/blackbox/probe.yml.j2 index 6319c1c5..fbbce7df 100644 --- a/roles/monitoring/prometheus/exporter/register/templates/blackbox/probe.yml.j2 +++ b/roles/monitoring/prometheus/exporter/register/templates/blackbox/probe.yml.j2 @@ -2,7 +2,7 @@ labels: instance: '{{ target.instance }}' svc_kind: '{{ target.config.svc_kind }}' - svc_name: '{{ target.config.svc_name }}' + svc_instance: '{{ target.config.svc_instance }}' __param_target: '{{ target.config.target }}' __param_module: '{{ target.config.module }}' {% if 'hostname' in target.config %} -- cgit v1.2.3