From ab97569f03c44e563237886fbcf2b81fb945f009 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 19 Jun 2024 13:57:27 +0200 Subject: prometheus: revamp labels for metrcis from blackbox exporter --- inventory/host_vars/ch-apps/vars.yml | 3 ++- inventory/host_vars/ch-atlas.yml | 3 ++- inventory/host_vars/ch-epimetheus.yml | 3 ++- inventory/host_vars/ch-greenbone.yml | 6 ++++-- inventory/host_vars/ch-gw-lan.yml | 3 ++- inventory/host_vars/ch-http-proxy.yml | 6 ++++-- inventory/host_vars/ch-imap-proxy.yml | 3 ++- inventory/host_vars/ch-iot.yml | 6 ++++-- inventory/host_vars/ch-jump.yml | 3 ++- inventory/host_vars/ch-mimas.yml | 6 ++++-- inventory/host_vars/ch-mon.yml | 6 ++++-- inventory/host_vars/ch-pan.yml | 6 ++++-- inventory/host_vars/ch-phoebe.yml | 3 ++- inventory/host_vars/ch-prometheus.yml | 3 ++- inventory/host_vars/ch-repo.yml | 6 ++++-- .../exporter/register/filter_plugins/prometheus.py | 16 +++++++++++++--- .../prometheus/exporter/register/tasks/main.yml | 8 ++++---- .../exporter/register/templates/blackbox/probe.yml.j2 | 2 ++ 18 files changed, 63 insertions(+), 29 deletions(-) diff --git a/inventory/host_vars/ch-apps/vars.yml b/inventory/host_vars/ch-apps/vars.yml index 89a6873c..8ea12d8b 100644 --- a/inventory/host_vars/ch-apps/vars.yml +++ b/inventory/host_vars/ch-apps/vars.yml @@ -65,7 +65,8 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 f342445b..3ee9f7ac 100644 --- a/inventory/host_vars/ch-atlas.yml +++ b/inventory/host_vars/ch-atlas.yml @@ -73,6 +73,7 @@ prometheus_exporter_node_textfile_collector_scripts: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 15e5f622..e76d10ae 100644 --- a/inventory/host_vars/ch-epimetheus.yml +++ b/inventory/host_vars/ch-epimetheus.yml @@ -40,7 +40,8 @@ prometheus_exporter_node_textfile_collector_scripts: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 05489600..4372ecd1 100644 --- a/inventory/host_vars/ch-greenbone.yml +++ b/inventory/host_vars/ch-greenbone.yml @@ -43,10 +43,12 @@ spreadspace_apt_repo_components: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 - - instance: "https-greenbone.chaos-at-home.org" + - svc_kind: https + svc_name: "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 11bc30e0..e621648c 100644 --- a/inventory/host_vars/ch-gw-lan.yml +++ b/inventory/host_vars/ch-gw-lan.yml @@ -48,7 +48,8 @@ spreadspace_apt_repo_components: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 53c3cfce..a61eb68a 100644 --- a/inventory/host_vars/ch-http-proxy.yml +++ b/inventory/host_vars/ch-http-proxy.yml @@ -49,10 +49,12 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 - - instance: "https-login.chaos-at-home.org" + - svc_kind: https + svc_name: "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 76a62757..16c5e047 100644 --- a/inventory/host_vars/ch-imap-proxy.yml +++ b/inventory/host_vars/ch-imap-proxy.yml @@ -42,7 +42,8 @@ spreadspace_apt_repo_components: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 1a5782b4..53af0fb5 100644 --- a/inventory/host_vars/ch-iot.yml +++ b/inventory/host_vars/ch-iot.yml @@ -92,10 +92,12 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 - - instance: "mqtt-mqtt.chaos-at-home.org" + - svc_kind: mqtt + svc_name: "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 92adb5cf..9af98aa1 100644 --- a/inventory/host_vars/ch-jump.yml +++ b/inventory/host_vars/ch-jump.yml @@ -68,6 +68,7 @@ spreadspace_apt_repo_components: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 baf60b5e..131d9396 100644 --- a/inventory/host_vars/ch-mimas.yml +++ b/inventory/host_vars/ch-mimas.yml @@ -134,10 +134,12 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ inventory_hostname }}" target: "{{ external_ip }}:{{ ansible_port | default(22) }}" module: ssh_banner - - instance: "https-mimas.chaos-at-home.org" + - svc_kind: https + svc_name: "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 64121848..4f5371ab 100644 --- a/inventory/host_vars/ch-mon.yml +++ b/inventory/host_vars/ch-mon.yml @@ -174,10 +174,12 @@ prometheus_exporter_smokeping_targets: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 - - instance: "https-mon.chaos-at-home.org" + - svc_kind: https + svc_name: "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 d8e17277..0edb86a1 100644 --- a/inventory/host_vars/ch-pan.yml +++ b/inventory/host_vars/ch-pan.yml @@ -170,10 +170,12 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ inventory_hostname }}" target: "{{ network.primary.address | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner - - instance: "https-pan.chaos-at-home.org" + - svc_kind: https + svc_name: "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 cfcfebc8..ca787492 100644 --- a/inventory/host_vars/ch-phoebe.yml +++ b/inventory/host_vars/ch-phoebe.yml @@ -69,7 +69,8 @@ prometheus_exporter_ipmi_modules: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 de7e273b..df6fa39a 100644 --- a/inventory/host_vars/ch-prometheus.yml +++ b/inventory/host_vars/ch-prometheus.yml @@ -64,7 +64,8 @@ prometheus_exporter_ipmi_modules: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 8ff107a5..c911195b 100644 --- a/inventory/host_vars/ch-repo.yml +++ b/inventory/host_vars/ch-repo.yml @@ -76,9 +76,11 @@ approx_backends: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_name: "{{ 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 - - instance: "http-apt.chaos-at-home.org" + - svc_kind: http + svc_name: "apt.chaos-at-home.org" target: "http://{{ approx_hostname }}" module: "http_2xx" diff --git a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py index e8067a72..27ba29e6 100644 --- a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py +++ b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py @@ -6,6 +6,11 @@ from functools import partial from ansible import errors +_multitarget_id_map_ = { + "blackbox/probe": (lambda vars, config: (vars['inventory_hostname'], "%s-%s" % (config['svc_kind'], config['svc_name']))), +} + + def prometheus_job_targets(jobs, vars): try: result = [] @@ -14,15 +19,20 @@ def prometheus_job_targets(jobs, vars): if multitarget_config_varname in vars: for exporter_hostname, configs in vars[multitarget_config_varname].items(): for config in configs: - result.append({'job': job, 'instance': config['instance'], 'enabled': True, + if job in _multitarget_id_map_: + instance, id = _multitarget_id_map_[job](vars, config) + else: + id = config['instance'] + instance = config['instance'] + result.append({'_id': id, 'job': job, 'instance': instance, 'enabled': True, 'exporter_hostname': exporter_hostname, 'config': config}) else: enabled = job in vars['prometheus_exporters_default'] or job in vars['prometheus_exporters_extra'] - result.append({'job': job, 'instance': vars['inventory_hostname'], 'enabled': enabled}) + result.append({'_id': vars['inventory_hostname'], 'job': job, 'instance': vars['inventory_hostname'], 'enabled': enabled}) return result except Exception as e: - raise errors.AnsibleFilterError("prometheus_job_targets(): %s" % str(e)) + raise errors.AnsibleFilterError("prometheus_job_targets(): %s" % repr(e)) class FilterModule(object): diff --git a/roles/monitoring/prometheus/exporter/register/tasks/main.yml b/roles/monitoring/prometheus/exporter/register/tasks/main.yml index 519975d6..1d8585e9 100644 --- a/roles/monitoring/prometheus/exporter/register/tasks/main.yml +++ b/roles/monitoring/prometheus/exporter/register/tasks/main.yml @@ -8,20 +8,20 @@ loop: "{{ job_targets | selectattr('enabled') }}" loop_control: loop_var: target - label: "{{ target.job }} -> {{ target.instance }}" + label: "{{ target.job }} -> {{ target._id }}" delegate_to: "{{ prometheus_server }}" template: src: "{{ lookup('first_found', {'paths': ['templates'], 'files': [target.job + '.yml.j2', 'generic.yml.j2']}) }}" - dest: "/etc/prometheus/targets/{{ target.job }}/{{ target.instance }}.yml" + dest: "/etc/prometheus/targets/{{ target.job }}/{{ target._id }}.yml" notify: reload prometheus - name: remove files for disabled targets loop: "{{ job_targets | rejectattr('enabled') }}" loop_control: loop_var: target - label: "{{ target.job }} -> {{ target.instance }}" + label: "{{ target.job }} -> {{ target._id }}" delegate_to: "{{ prometheus_server }}" file: - path: "/etc/prometheus/targets/{{ target.job }}/{{ target.instance }}.yml" + path: "/etc/prometheus/targets/{{ target.job }}/{{ target._id }}.yml" state: absent notify: reload prometheus 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 5f98e3a8..6319c1c5 100644 --- a/roles/monitoring/prometheus/exporter/register/templates/blackbox/probe.yml.j2 +++ b/roles/monitoring/prometheus/exporter/register/templates/blackbox/probe.yml.j2 @@ -1,6 +1,8 @@ - targets: [ '{{ (target.exporter_hostname == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.exporter_hostname].prometheus_scrape_endpoint) }}' ] labels: instance: '{{ target.instance }}' + svc_kind: '{{ target.config.svc_kind }}' + svc_name: '{{ target.config.svc_name }}' __param_target: '{{ target.config.target }}' __param_module: '{{ target.config.module }}' {% if 'hostname' in target.config %} -- cgit v1.2.3 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 --- inventory/host_vars/ch-mon.yml | 6 +- roles/monitoring/grafana/defaults/main.yml | 3 - .../grafana/files/dashboard-blackbox.json | 1167 ------------------- .../grafana/files/dashboard-blackbox/https.json | 1199 ++++++++++++++++++++ .../grafana/files/dashboard-blackbox/mqtt.json | 823 ++++++++++++++ .../grafana/files/dashboard-blackbox/ssh.json | 725 ++++++++++++ roles/monitoring/grafana/filter_plugins/grafana.py | 31 + roles/monitoring/grafana/tasks/main.yml | 24 +- 8 files changed, 2795 insertions(+), 1183 deletions(-) delete mode 100644 roles/monitoring/grafana/files/dashboard-blackbox.json create mode 100644 roles/monitoring/grafana/files/dashboard-blackbox/https.json create mode 100644 roles/monitoring/grafana/files/dashboard-blackbox/mqtt.json create mode 100644 roles/monitoring/grafana/files/dashboard-blackbox/ssh.json diff --git a/inventory/host_vars/ch-mon.yml b/inventory/host_vars/ch-mon.yml index 4f5371ab..0b830a88 100644 --- a/inventory/host_vars/ch-mon.yml +++ b/inventory/host_vars/ch-mon.yml @@ -268,7 +268,11 @@ grafana_dashboards: datasource: "Prometheus" - file: environment-sensors datasource: "Prometheus" - - file: blackbox + - file: blackbox/ssh + datasource: "Prometheus" + - file: blackbox/https + datasource: "Prometheus" + - file: blackbox/mqtt datasource: "Prometheus" - file: smokeping datasource: "Prometheus" diff --git a/roles/monitoring/grafana/defaults/main.yml b/roles/monitoring/grafana/defaults/main.yml index 20b886ca..39ea145a 100644 --- a/roles/monitoring/grafana/defaults/main.yml +++ b/roles/monitoring/grafana/defaults/main.yml @@ -55,9 +55,6 @@ grafana_dashboards: [] # - content: '... json-data ...' # name: bar # datasource: "Graphite" -# - id: 19 -# revision: 3 -# datasource: "Foo" grafana_admin_password: "{{ undef(hint='Please specify the password for the grafana admin user') }}" diff --git a/roles/monitoring/grafana/files/dashboard-blackbox.json b/roles/monitoring/grafana/files/dashboard-blackbox.json deleted file mode 100644 index 448d605c..00000000 --- a/roles/monitoring/grafana/files/dashboard-blackbox.json +++ /dev/null @@ -1,1167 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "10.4.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 Overview", - "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", - "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": { - "mode": "multi", - "sort": "asc" - } - }, - "pluginVersion": "10.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "probe_duration_seconds{instance=~\"$target\"}", - "format": "time_series", - "interval": "$interval", - "intervalFactor": 1, - "legendFormat": "{{ instance }}", - "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", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "$target status", - "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": 2, - "w": 4, - "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": "10.4.0", - "repeatDirection": "v", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "probe_success{instance=~\"$target\"}", - "format": "time_series", - "interval": "$interval", - "intervalFactor": 1, - "refId": "A" - } - ], - "title": "Status", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "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": 6, - "w": 10, - "x": 4, - "y": 9 - }, - "id": 25, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "10.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "probe_http_duration_seconds{instance=~\"$target\"}", - "format": "time_series", - "interval": "$interval", - "intervalFactor": 1, - "legendFormat": "{{ phase }}", - "refId": "B" - } - ], - "title": "HTTP Duration", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "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": 6, - "w": 10, - "x": 14, - "y": 9 - }, - "id": 17, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "pluginVersion": "10.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "probe_duration_seconds{instance=~\"$target\"}", - "format": "time_series", - "interval": "$interval", - "intervalFactor": 1, - "legendFormat": "seconds", - "refId": "A" - } - ], - "title": "Probe Duration", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "decimals": 0, - "mappings": [ - { - "options": { - "0": { - "text": "N/A" - }, - "1": { - "text": "YES" - } - }, - "type": "value" - }, - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#299c46", - "value": null - }, - { - "color": "rgba(237, 129, 40, 0.89)", - "value": 201 - }, - { - "color": "#d44a3a", - "value": 399 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 2, - "w": 4, - "x": 0, - "y": 11 - }, - "id": 20, - "maxDataPoints": 100, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "10.4.0", - "repeatDirection": "h", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "probe_http_status_code{instance=~\"$target\"}", - "format": "time_series", - "interval": "$interval", - "intervalFactor": 1, - "refId": "A" - } - ], - "title": "HTTP Status Code", - "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": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 2, - "w": 4, - "x": 0, - "y": 13 - }, - "id": 27, - "maxDataPoints": 100, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "10.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "probe_http_version{instance=~\"$target\"}", - "format": "time_series", - "intervalFactor": 1, - "refId": "A" - } - ], - "title": "HTTP Version", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "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": 1 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 2, - "w": 4, - "x": 0, - "y": 15 - }, - "id": 18, - "maxDataPoints": 100, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "10.4.0", - "repeatDirection": "v", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "probe_http_ssl{instance=~\"$target\"}", - "format": "time_series", - "interval": "$interval", - "intervalFactor": 1, - "refId": "A" - } - ], - "title": "SSL", - "type": "stat" - }, - { - "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": 2, - "w": 10, - "x": 4, - "y": 15 - }, - "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": "10.4.0", - "repeatDirection": "h", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "probe_ssl_earliest_cert_expiry{instance=~\"$target\"} - time()", - "format": "time_series", - "interval": "$interval", - "intervalFactor": 1, - "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": 2, - "w": 5, - "x": 14, - "y": 15 - }, - "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": "10.4.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "avg(probe_duration_seconds{instance=~\"$target\"})", - "format": "time_series", - "interval": "$interval", - "intervalFactor": 1, - "refId": "A" - } - ], - "title": "Average Probe Duration", - "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": 2, - "w": 5, - "x": 19, - "y": 15 - }, - "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": "10.4.0", - "repeatDirection": "h", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "expr": "avg(probe_dns_lookup_time_seconds{instance=~\"$target\"})", - "format": "time_series", - "interval": "$interval", - "intervalFactor": 1, - "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": "", - "hide": 0, - "includeAll": true, - "multi": true, - "name": "target", - "options": [], - "query": { - "query": "label_values(probe_success, instance)", - "refId": "Prometheus-target-Variable-Query" - }, - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "tagValuesQuery": "", - "tagsQuery": "", - "type": "query", - "useTags": false - } - ] - }, - "time": { - "from": "now-6h", - "to": "now" - }, - "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": "Blackbox Exporter", - "uid": "xtkCtBkiz", - "version": 1, - "weekStart": "" -} \ No newline at end of file diff --git a/roles/monitoring/grafana/files/dashboard-blackbox/https.json b/roles/monitoring/grafana/files/dashboard-blackbox/https.json new file mode 100644 index 00000000..0d322f3d --- /dev/null +++ b/roles/monitoring/grafana/files/dashboard-blackbox/https.json @@ -0,0 +1,1199 @@ +{ + "__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 http/https 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=~\"https?\", 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": 2, + "w": 4, + "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=~\"https?\", 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": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "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": 6, + "w": 10, + "x": 4, + "y": 9 + }, + "id": 25, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "10.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "probe_http_duration_seconds{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "legendFormat": "{{ phase }}", + "range": true, + "refId": "B" + } + ], + "title": "HTTP Duration", + "type": "timeseries" + }, + { + "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": 10, + "x": 14, + "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=~\"https?\", svc_name=~\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "legendFormat": "seconds", + "range": true, + "refId": "A" + } + ], + "title": "Probe Duration", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 0, + "mappings": [ + { + "options": { + "0": { + "text": "N/A" + }, + "1": { + "text": "YES" + } + }, + "type": "value" + }, + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#299c46", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 201 + }, + { + "color": "#d44a3a", + "value": 399 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 4, + "x": 0, + "y": 11 + }, + "id": 20, + "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": "probe_http_status_code{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "range": true, + "refId": "A" + } + ], + "title": "HTTP Status Code", + "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": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 4, + "x": 0, + "y": 13 + }, + "id": 27, + "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": "probe_http_version{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "format": "time_series", + "intervalFactor": 1, + "range": true, + "refId": "A" + } + ], + "title": "HTTP Version", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "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": 1 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 4, + "x": 0, + "y": 15 + }, + "id": 18, + "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": "v", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "probe_http_ssl{svc_kind=~\"https?\", svc_name=~\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "range": true, + "refId": "A" + } + ], + "title": "SSL", + "type": "stat" + }, + { + "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": 2, + "w": 10, + "x": 4, + "y": 15 + }, + "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=~\"https?\", 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": 2, + "w": 5, + "x": 14, + "y": 15 + }, + "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=~\"https?\", 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" + }, + "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": 2, + "w": 5, + "x": 19, + "y": 15 + }, + "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=~\"https?\", 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=~\"https?\"},svc_name)", + "hide": 0, + "includeAll": true, + "multi": true, + "name": "target", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(probe_success{svc_kind=~\"https?\"},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": "http/https", + "uid": "edp9yl8cgfd34b", + "version": 8, + "weekStart": "" +} \ No newline at end of file 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 diff --git a/roles/monitoring/grafana/files/dashboard-blackbox/ssh.json b/roles/monitoring/grafana/files/dashboard-blackbox/ssh.json new file mode 100644 index 00000000..93c3206f --- /dev/null +++ b/roles/monitoring/grafana/files/dashboard-blackbox/ssh.json @@ -0,0 +1,725 @@ +{ + "__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 SSH 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=\"ssh\", 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": 4, + "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=\"ssh\", 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": 4, + "x": 4, + "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=\"ssh\", 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" + }, + "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": 4, + "x": 8, + "y": 9 + }, + "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=\"ssh\", svc_name=\"$target\"})", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "range": true, + "refId": "A" + } + ], + "title": "Average DNS Lookup", + "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": 3, + "w": 12, + "x": 12, + "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=\"ssh\", svc_name=\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "legendFormat": "seconds", + "range": true, + "refId": "A" + } + ], + "type": "timeseries" + } + ], + "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=\"ssh\"},svc_name)", + "hide": 0, + "includeAll": true, + "multi": true, + "name": "target", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(probe_success{svc_kind=\"ssh\"},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": "ssh", + "uid": "fdp9xih70k7pce", + "version": 8, + "weekStart": "" +} diff --git a/roles/monitoring/grafana/filter_plugins/grafana.py b/roles/monitoring/grafana/filter_plugins/grafana.py index 750dc46d..9fb78734 100644 --- a/roles/monitoring/grafana/filter_plugins/grafana.py +++ b/roles/monitoring/grafana/filter_plugins/grafana.py @@ -1,6 +1,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type +import os from functools import partial from ansible import errors @@ -22,10 +23,40 @@ def resolve_grafana_url(url, config): raise errors.AnsibleFilterError("resolve_grafana_url(): %s" % str(e)) +def grafana_dashboard_subdirs(dashboards): + try: + dirs = [] + for dashboard in dashboards: + if 'file' in dashboard: + if '/' in dashboard['file']: + dirs.append(os.path.dirname(dashboard['file'])) + else: + if '/' in dashboard['name']: + dirs.append(os.path.dirname(dashboard['name'])) + return dirs + except Exception as e: + raise errors.AnsibleFilterError("grafana_dashboard_subdirs(): %s" % str(e)) + + +def grafana_dashboard_dest(dashboard): + try: + key = 'name' + if 'file' in dashboard: + key = 'file' + + if '/' in dashboard[key]: + return "%s/%s_%s" % (os.path.dirname(dashboard[key]), dashboard['datasource'], os.path.basename(dashboard[key])) + return "%s_%s" % (dashboard['datasource'], dashboard[key]) + except Exception as e: + raise errors.AnsibleFilterError("grafana_dashboard_dest(): %s" % str(e)) + + class FilterModule(object): filter_map = { 'resolve_grafana_url': resolve_grafana_url, + 'grafana_dashboard_subdirs': grafana_dashboard_subdirs, + 'grafana_dashboard_dest': grafana_dashboard_dest, } def filters(self): diff --git a/roles/monitoring/grafana/tasks/main.yml b/roles/monitoring/grafana/tasks/main.yml index de2857df..5d6c9c17 100644 --- a/roles/monitoring/grafana/tasks/main.yml +++ b/roles/monitoring/grafana/tasks/main.yml @@ -118,20 +118,28 @@ mode: 0640 notify: restart grafana -- name: create directory for dashboards +- name: create base directory for dashboards file: path: /var/lib/grafana/dashboards/ansible state: directory group: grafana mode: 0750 +- name: create sub-directories for dashboards + loop: "{{ grafana_dashboards | grafana_dashboard_subdirs }}" + file: + path: "/var/lib/grafana/dashboards/ansible/{{ item }}" + state: directory + group: grafana + mode: 0750 + - name: install dashboards from file loop: "{{ grafana_dashboards | selectattr('file', 'defined') }}" loop_control: label: "{{ item.file }} -> {{ item.datasource }}" copy: content: "{{ lookup('file', 'dashboard-'+item.file+'.json') | regex_replace('\"(?:\\${)?DS_[A-Z0-9_-]+(?:})?\"', '\"'+item.datasource+'\"') }}\n" - dest: "/var/lib/grafana/dashboards/ansible/{{ item.datasource }}_{{ item.file }}.json" + dest: "/var/lib/grafana/dashboards/ansible/{{ item | grafana_dashboard_dest }}.json" register: grafana_dasboards_from_file - name: install dashboards from content @@ -140,22 +148,14 @@ label: "{{ item.name }} -> {{ item.datasource }}" copy: content: "{{ item.content | regex_replace('\"(?:\\${)?DS_[A-Z0-9_-]+(?:})?\"', '\"'+item.datasource+'\"') }}\n" - dest: "/var/lib/grafana/dashboards/ansible/{{ item.datasource }}_{{ item.name }}.json" + dest: "/var/lib/grafana/dashboards/ansible/{{ item | grafana_dashboard_dest }}.json" register: grafana_dasboards_from_content - ## TODO: implement this -- name: install dashboards from grafana.com - loop: "{{ grafana_dashboards | selectattr('id', 'defined') }}" - loop_control: - label: "https://grafana.com/api/dashboards/{{ item.id }} -> {{ item.datasource }}" - debug: - msg: 'installing dashboards from grafana.com is not yet supported!' - # register: grafana_dasboards_from_grafanacom - - name: fetch list of installed dashboards find: paths: /var/lib/grafana/dashboards/ansible patterns: "*.json" + recurse: true register: grafana_dashboards_installed - name: remove superfluous dashboards -- 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(-) 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 From 6ba8e72412f9ee47755d8f5cee41874bcd717540 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 21 Jun 2024 00:25:07 +0200 Subject: revamp prometheus metric lables for whawty-nginx-sso --- inventory/host_vars/ch-http-proxy.yml | 3 +- inventory/host_vars/ch-mon.yml | 5 +- .../files/dashboard-apps/whawty-nginx-sso.json | 1690 ++++++++++++++++++++ .../grafana/files/dashboard-whawty-nginx-sso.json | 1657 ------------------- .../exporter/register/filter_plugins/prometheus.py | 1 + .../register/templates/whawty-nginx-sso.yml.j2 | 4 +- 6 files changed, 1697 insertions(+), 1663 deletions(-) create mode 100644 roles/monitoring/grafana/files/dashboard-apps/whawty-nginx-sso.json delete mode 100644 roles/monitoring/grafana/files/dashboard-whawty-nginx-sso.json diff --git a/inventory/host_vars/ch-http-proxy.yml b/inventory/host_vars/ch-http-proxy.yml index 1e998ed0..024c9bfc 100644 --- a/inventory/host_vars/ch-http-proxy.yml +++ b/inventory/host_vars/ch-http-proxy.yml @@ -126,5 +126,4 @@ whawty_nginx_sso_logins: prometheus_job_multitarget_whawty_nginx_sso: ch-http-proxy: - - instance: "whawty-nginx-sso-{{ inventory_hostname }}-chaos-at-home" - instance_name: chaos-at-home + - app_instance: chaos-at-home diff --git a/inventory/host_vars/ch-mon.yml b/inventory/host_vars/ch-mon.yml index c514550e..e974b0af 100644 --- a/inventory/host_vars/ch-mon.yml +++ b/inventory/host_vars/ch-mon.yml @@ -121,8 +121,7 @@ whawty_nginx_sso_auths: prometheus_job_multitarget_whawty_nginx_sso: ch-mon: - - instance: "whawty-nginx-sso-{{ inventory_hostname }}-chaos-at-home" - instance_name: chaos-at-home + - app_instance: chaos-at-home prometheus_server_storage: @@ -282,7 +281,7 @@ grafana_dashboards: datasource: "Prometheus" - file: standalone-kubelet-overview datasource: "Prometheus" - - file: whawty-nginx-sso + - file: apps/whawty-nginx-sso datasource: "Prometheus" - file: mosquitto datasource: "Prometheus" diff --git a/roles/monitoring/grafana/files/dashboard-apps/whawty-nginx-sso.json b/roles/monitoring/grafana/files/dashboard-apps/whawty-nginx-sso.json new file mode 100644 index 00000000..734893a5 --- /dev/null +++ b/roles/monitoring/grafana/files/dashboard-apps/whawty-nginx-sso.json @@ -0,0 +1,1690 @@ +{ + "__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": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 4, + "panels": [], + "title": "Web", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 31, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 1 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum by(endpoint) (increase(whawty_nginx_sso_web_requests_total{instance=\"$instance\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "1h", + "legendFormat": "{{ endpoint }}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Requests", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 31, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 7, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "single", + "sort": "none" + } + }, + "repeat": "endpoint", + "repeatDirection": "v", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "increase(whawty_nginx_sso_web_requests_total{instance=\"$instance\", endpoint=\"$endpoint\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "1h", + "legendFormat": "{{status}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Status Code: $endpoint", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "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": 6, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 8, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "multi", + "sort": "asc" + } + }, + "repeat": "endpoint", + "repeatDirection": "v", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "builder", + "expr": "whawty_nginx_sso_web_request_duration_seconds{instance=\"$instance\", endpoint=\"$endpoint\"}", + "instant": false, + "legendFormat": "{{ quantile }} Quantile", + "range": true, + "refId": "A" + } + ], + "title": "Duration: $endpoint", + "type": "timeseries" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 14 + }, + "id": 5, + "panels": [], + "title": "Cookie", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 31, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 15 + }, + "id": 13, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "increase(whawty_nginx_sso_cookie_created_total{instance=\"$instance\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "1h", + "legendFormat": "cookies", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Created", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 31, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "failed" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "success" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 15 + }, + "id": 14, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "increase(whawty_nginx_sso_cookie_verified_total{instance=\"$instance\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "1h", + "legendFormat": "{{ result }}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Verified", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 31, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "failed" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "success" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 22 + }, + "id": 21, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "increase(whawty_nginx_sso_cookie_sync_requests_total{instance=\"$instance\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "1h", + "legendFormat": "{{ result }}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Sync: Requests", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "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": 6, + "w": 12, + "x": 12, + "y": 22 + }, + "id": 22, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "multi", + "sort": "asc" + } + }, + "repeatDirection": "v", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "whawty_nginx_sso_cookie_sync_request_duration_seconds{instance=\"$instance\"}", + "instant": false, + "legendFormat": "{{ quantile }} Quantile", + "range": true, + "refId": "A" + } + ], + "title": "Sync: Duration", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 28 + }, + "id": 2, + "panels": [], + "title": "Authentication", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 31, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "failed" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "success" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 19, + "x": 0, + "y": 29 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "increase(whawty_nginx_sso_auth_requests_total{instance=\"$instance\"}[1h])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "1h", + "legendFormat": "{{result}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Requests", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "color": "green", + "index": 0, + "text": "OK" + }, + "1": { + "color": "red", + "index": 1, + "text": "Error" + } + }, + "type": "value" + }, + { + "options": { + "match": "null", + "result": { + "color": "text", + "index": 2, + "text": "-" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 5, + "x": 19, + "y": 29 + }, + "id": 3, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "whawty_nginx_sso_auth_static_reload_failed{instance=\"$instance\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "whawty_nginx_sso_auth_whawty_reload_failed{instance=\"$instance\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "B", + "useBackend": false + } + ], + "title": "Database reload", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 31, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "failed" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "success" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 36 + }, + "id": 23, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "increase(whawty_nginx_sso_auth_whawty_remote_upgrades_total{instance=\"$instance\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "1h", + "legendFormat": "{{ result }}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Whawty: remote-upgrade Requests", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "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": 6, + "w": 12, + "x": 12, + "y": 36 + }, + "id": 24, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "multi", + "sort": "asc" + } + }, + "repeatDirection": "v", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "whawty_nginx_sso_auth_whawty_remote_upgrade_duration_seconds{instance=\"$instance\"}", + "instant": false, + "legendFormat": "{{ quantile }} Quantile", + "range": true, + "refId": "A" + } + ], + "title": "Whawty: remote-upgrade Duration", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 31, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "failed" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "success" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 42 + }, + "id": 25, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "single", + "sort": "none" + } + }, + "repeat": "ldapserver", + "repeatDirection": "v", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "increase(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\", server=~\".*$ldapserver\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "1h", + "legendFormat": "{{ result }}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "LDAP: Requests $ldapserver", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "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": 6, + "w": 12, + "x": 12, + "y": 42 + }, + "id": 26, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "multi", + "sort": "asc" + } + }, + "repeat": "ldapserver", + "repeatDirection": "v", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "whawty_nginx_sso_auth_ldap_request_duration_seconds{instance=\"$instance\", server=~\".*$ldapserver\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "{{ quantile }} Quantile", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "LDAP: Duration $ldapserver", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [ + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values({app_kind=\"whawty-nginx-sso\"},instance)", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "instance", + "options": [], + "query": { + "qryType": 1, + "query": "label_values({app_kind=\"whawty-nginx-sso\"},instance)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": {}, + "definition": "label_values({instance=\"$instance\"},app_instance)", + "hide": 0, + "includeAll": true, + "label": "", + "multi": true, + "name": "app_instance", + "options": [], + "query": { + "qryType": 1, + "query": "label_values({instance=\"$instance\"},app_instance)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(whawty_nginx_sso_web_requests_total{instance=\"$instance\", app_instance=~\"$app_instance\"},endpoint)", + "hide": 0, + "includeAll": true, + "multi": true, + "name": "endpoint", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(whawty_nginx_sso_web_requests_total{instance=\"$instance\", app_instance=~\"$app_instance\"},endpoint)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\", app_instance=~\"$app_instance\"},server)", + "hide": 0, + "includeAll": true, + "multi": true, + "name": "ldapserver", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\", app_instance=~\"$app_instance\"},server)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 2, + "regex": "/ldaps?://(.*)/", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-24h", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": {}, + "timezone": "", + "title": "whawty nginx-sso", + "uid": "e745f2f9-9115-49a0-b386-9919bcf566de", + "version": 15, + "weekStart": "" +} \ No newline at end of file diff --git a/roles/monitoring/grafana/files/dashboard-whawty-nginx-sso.json b/roles/monitoring/grafana/files/dashboard-whawty-nginx-sso.json deleted file mode 100644 index b6f21f92..00000000 --- a/roles/monitoring/grafana/files/dashboard-whawty-nginx-sso.json +++ /dev/null @@ -1,1657 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "10.2.2" - }, - { - "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": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 4, - "panels": [], - "title": "Web", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 31, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 1 - }, - "id": 6, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "sum by(endpoint) (increase(whawty_nginx_sso_web_requests_total{instance=\"$instance\"}[$__rate_interval]))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "1h", - "legendFormat": "{{ endpoint }}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Requests", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 31, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 12, - "x": 0, - "y": 8 - }, - "id": 7, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "repeat": "endpoint", - "repeatDirection": "v", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "increase(whawty_nginx_sso_web_requests_total{instance=\"$instance\", endpoint=\"$endpoint\"}[$__rate_interval])", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "1h", - "legendFormat": "{{status}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Status Code: $endpoint", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "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": 6, - "w": 12, - "x": 12, - "y": 8 - }, - "id": 8, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "asc" - } - }, - "repeat": "endpoint", - "repeatDirection": "v", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "builder", - "expr": "whawty_nginx_sso_web_request_duration_seconds{instance=\"$instance\", endpoint=\"$endpoint\"}", - "instant": false, - "legendFormat": "{{ quantile }} Quantile", - "range": true, - "refId": "A" - } - ], - "title": "Duration: $endpoint", - "type": "timeseries" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 32 - }, - "id": 5, - "panels": [], - "title": "Cookie", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 31, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 33 - }, - "id": 13, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "increase(whawty_nginx_sso_cookie_created_total{instance=\"$instance\"}[$__rate_interval])", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "1h", - "legendFormat": "cookies", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Created", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 31, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "failed" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "red", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "success" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "green", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 7, - "w": 12, - "x": 12, - "y": 33 - }, - "id": 14, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "increase(whawty_nginx_sso_cookie_verified_total{instance=\"$instance\"}[$__rate_interval])", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "1h", - "legendFormat": "{{ result }}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Verified", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 31, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "failed" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "red", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "success" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "green", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 12, - "x": 0, - "y": 40 - }, - "id": 21, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "increase(whawty_nginx_sso_cookie_sync_requests_total{instance=\"$instance\"}[$__rate_interval])", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "1h", - "legendFormat": "{{ result }}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Sync: Requests", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "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": 6, - "w": 12, - "x": 12, - "y": 40 - }, - "id": 22, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "asc" - } - }, - "repeatDirection": "v", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "whawty_nginx_sso_cookie_sync_request_duration_seconds{instance=\"$instance\"}", - "instant": false, - "legendFormat": "{{ quantile }} Quantile", - "range": true, - "refId": "A" - } - ], - "title": "Sync: Duration", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 46 - }, - "id": 2, - "panels": [], - "title": "Authentication", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 31, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "failed" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "red", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "success" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "green", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 7, - "w": 19, - "x": 0, - "y": 47 - }, - "id": 1, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "increase(whawty_nginx_sso_auth_requests_total{instance=\"$instance\"}[1h])", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "1h", - "legendFormat": "{{result}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Requests", - "transformations": [], - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "0": { - "color": "green", - "index": 0, - "text": "OK" - }, - "1": { - "color": "red", - "index": 1, - "text": "Error" - } - }, - "type": "value" - }, - { - "options": { - "match": "null", - "result": { - "color": "text", - "index": 2, - "text": "-" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 5, - "x": 19, - "y": 47 - }, - "id": 3, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "10.2.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "whawty_nginx_sso_auth_static_reload_failed{instance=\"$instance\"}", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "{{__name__}}", - "range": true, - "refId": "A", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "whawty_nginx_sso_auth_whawty_reload_failed{instance=\"$instance\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "{{__name__}}", - "range": true, - "refId": "B", - "useBackend": false - } - ], - "title": "Database reload", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 31, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "failed" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "red", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "success" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "green", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 12, - "x": 0, - "y": 54 - }, - "id": 23, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "increase(whawty_nginx_sso_auth_whawty_remote_upgrades_total{instance=\"$instance\"}[$__rate_interval])", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "1h", - "legendFormat": "{{ result }}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Whawty: remote-upgrade Requests", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "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": 6, - "w": 12, - "x": 12, - "y": 54 - }, - "id": 24, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "asc" - } - }, - "repeatDirection": "v", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "whawty_nginx_sso_auth_whawty_remote_upgrade_duration_seconds{instance=\"$instance\"}", - "instant": false, - "legendFormat": "{{ quantile }} Quantile", - "range": true, - "refId": "A" - } - ], - "title": "Whawty: remote-upgrade Duration", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 31, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "failed" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "red", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "success" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "green", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 12, - "x": 0, - "y": 60 - }, - "id": 25, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "repeat": "ldapserver", - "repeatDirection": "v", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "increase(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\", server=~\".*$ldapserver\"}[$__rate_interval])", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "interval": "1h", - "legendFormat": "{{ result }}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "LDAP: Requests $ldapserver", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "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": 6, - "w": 12, - "x": 12, - "y": 60 - }, - "id": 26, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "asc" - } - }, - "repeat": "ldapserver", - "repeatDirection": "v", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "whawty_nginx_sso_auth_ldap_request_duration_seconds{instance=\"$instance\", server=~\".*$ldapserver\"}", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "{{ quantile }} Quantile", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "LDAP: Duration $ldapserver", - "type": "timeseries" - } - ], - "refresh": "", - "schemaVersion": 38, - "tags": [], - "templating": { - "list": [ - { - "current": {}, - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values({job=\"whawty-nginx-sso\"},instance)", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "instance", - "options": [], - "query": { - "qryType": 1, - "query": "label_values({job=\"whawty-nginx-sso\"},instance)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": {}, - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(whawty_nginx_sso_web_requests_total{instance=\"$instance\"},endpoint)", - "hide": 0, - "includeAll": true, - "multi": true, - "name": "endpoint", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(whawty_nginx_sso_web_requests_total{instance=\"$instance\"},endpoint)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 2, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": {}, - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\"},server)", - "hide": 0, - "includeAll": true, - "multi": true, - "name": "ldapserver", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\"},server)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 2, - "regex": "/ldaps?://(.*)/", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } - ] - }, - "time": { - "from": "now-24h", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "whawty nginx-sso", - "uid": "e745f2f9-9115-49a0-b386-9919bcf566de", - "version": 2, - "weekStart": "" -} \ No newline at end of file diff --git a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py index 9c99113d..57b69a13 100644 --- a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py +++ b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py @@ -8,6 +8,7 @@ from ansible import errors _multitarget_id_map_ = { "blackbox/probe": (lambda vars, config: (vars['inventory_hostname'], "%s-%s" % (config['svc_kind'], config['svc_instance']))), + "whawty-nginx-sso": (lambda vars, config: (vars['inventory_hostname'], "%s-%s" % (config['app_instance'], vars['inventory_hostname']))), } diff --git a/roles/monitoring/prometheus/exporter/register/templates/whawty-nginx-sso.yml.j2 b/roles/monitoring/prometheus/exporter/register/templates/whawty-nginx-sso.yml.j2 index 74ada64e..8675a143 100644 --- a/roles/monitoring/prometheus/exporter/register/templates/whawty-nginx-sso.yml.j2 +++ b/roles/monitoring/prometheus/exporter/register/templates/whawty-nginx-sso.yml.j2 @@ -1,7 +1,9 @@ - targets: [ '{{ (target.exporter_hostname == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.exporter_hostname].prometheus_scrape_endpoint) }}' ] labels: instance: '{{ target.instance }}' - __metrics_path__: '/whawty-nginx-sso/{{ target.config.instance_name }}' + app_kind: 'whawty-nginx-sso' + app_instance: '{{ target.config.app_instance }}' + __metrics_path__: '/whawty-nginx-sso/{{ target.config.app_instance }}' {% for name, value in prometheus_target_labels.items() %} {{ name }}: '{{ value }}' {% endfor %} -- cgit v1.2.3 From 992b7262ea1d8e8cf7c6d0e3afaa33427ea0ca4a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 28 Jun 2024 23:59:11 +0200 Subject: revamp prometheus metric lables for ssl/probe --- inventory/host_vars/ch-apps/vars.yml | 12 ++++++------ inventory/host_vars/ch-http-proxy.yml | 4 ++-- inventory/host_vars/ch-mon.yml | 5 +++-- .../exporter/register/filter_plugins/prometheus.py | 1 + .../prometheus/exporter/register/templates/ssl/probe.yml.j2 | 2 ++ 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/inventory/host_vars/ch-apps/vars.yml b/inventory/host_vars/ch-apps/vars.yml index 22a5578a..f39d57f1 100644 --- a/inventory/host_vars/ch-apps/vars.yml +++ b/inventory/host_vars/ch-apps/vars.yml @@ -72,15 +72,15 @@ prometheus_job_multitarget_blackbox__probe: prometheus_job_multitarget_ssl__probe: ch-apps: - - instance: "sslcert-standalone-kubelet-{{ inventory_hostname }}" + - module: file target: "/etc/ssl/standalone-kubelet/*.pem" - module: file - - instance: "sslcert-node-red-{{ inventory_hostname }}" + sslcert_instance: "standalone-kubelet" + - module: file target: "/etc/ssl/node-red-*/*.pem" - module: file - - instance: "sslcert-whawty-auth-{{ inventory_hostname }}" + sslcert_instance: "node-red" + - module: file target: "/etc/ssl/whawty-auth-*/*.pem" - module: file + sslcert_instance: "whawty-auth" zfs_arc_size: diff --git a/inventory/host_vars/ch-http-proxy.yml b/inventory/host_vars/ch-http-proxy.yml index 024c9bfc..bdbde798 100644 --- a/inventory/host_vars/ch-http-proxy.yml +++ b/inventory/host_vars/ch-http-proxy.yml @@ -61,9 +61,9 @@ prometheus_job_multitarget_blackbox__probe: prometheus_job_multitarget_ssl__probe: ch-http-proxy: - - instance: "sslcert-apps-publish-{{ inventory_hostname }}" + - module: file target: "/etc/ssl/apps-publish-*/*.pem" - module: file + sslcert_instance: apps-publish whawty_auth_store_instances: diff --git a/inventory/host_vars/ch-mon.yml b/inventory/host_vars/ch-mon.yml index e974b0af..85b2dd8c 100644 --- a/inventory/host_vars/ch-mon.yml +++ b/inventory/host_vars/ch-mon.yml @@ -184,9 +184,10 @@ prometheus_job_multitarget_blackbox__probe: prometheus_job_multitarget_ssl__probe: ch-mon: - - instance: "sslcert-prometheus-{{ inventory_hostname }}" + - module: file target: "/etc/ssl/prometheus/**/*.pem" - module: file + sslcert_instance: prometheus + prometheus_server_rules_node_extra: - alert: GitFsckMetricsOutdated diff --git a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py index 57b69a13..473eb655 100644 --- a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py +++ b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py @@ -8,6 +8,7 @@ from ansible import errors _multitarget_id_map_ = { "blackbox/probe": (lambda vars, config: (vars['inventory_hostname'], "%s-%s" % (config['svc_kind'], config['svc_instance']))), + "ssl/probe": (lambda vars, config: (vars['inventory_hostname'], "%s-%s-%s" % (config['module'], config['sslcert_instance'], vars['inventory_hostname']))), "whawty-nginx-sso": (lambda vars, config: (vars['inventory_hostname'], "%s-%s" % (config['app_instance'], vars['inventory_hostname']))), } diff --git a/roles/monitoring/prometheus/exporter/register/templates/ssl/probe.yml.j2 b/roles/monitoring/prometheus/exporter/register/templates/ssl/probe.yml.j2 index 3ecf129a..6d26e779 100644 --- a/roles/monitoring/prometheus/exporter/register/templates/ssl/probe.yml.j2 +++ b/roles/monitoring/prometheus/exporter/register/templates/ssl/probe.yml.j2 @@ -1,6 +1,8 @@ - targets: [ '{{ (target.exporter_hostname == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.exporter_hostname].prometheus_scrape_endpoint) }}' ] labels: instance: '{{ target.instance }}' + sslcert_kind: '{{ target.config.module }}' + sslcert_instance: '{{ target.config.sslcert_instance }}' __param_target: '{{ target.config.target }}' __param_module: '{{ target.config.module }}' {% for name, value in prometheus_target_labels.items() %} -- cgit v1.2.3 From 91fc6ce942be1da2026e7b8dcefda5cc86a8fdb3 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 29 Jun 2024 22:55:29 +0200 Subject: revamp prometheus metric lables for ipmi/remote and nut/ups --- inventory/group_vars/chaos-at-home-ups/vars.yml | 3 +- .../grafana/files/dashboard-network-ups-tools.json | 64 +++++++++++----------- .../exporter/register/filter_plugins/prometheus.py | 2 + .../exporter/register/templates/nut/ups.yml.j2 | 1 + 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/inventory/group_vars/chaos-at-home-ups/vars.yml b/inventory/group_vars/chaos-at-home-ups/vars.yml index 31be4572..5c0de008 100644 --- a/inventory/group_vars/chaos-at-home-ups/vars.yml +++ b/inventory/group_vars/chaos-at-home-ups/vars.yml @@ -16,6 +16,5 @@ prometheus_exporters_default: prometheus_job_multitarget_nut__ups: ch-mon: - - instance: "ups-{{ ups_name }}" - ups: "{{ ups_name }}" + - ups: "{{ ups_name }}" server: "{{ network_mgmt_zone.prefix | ansible.utils.ipaddr(network_mgmt_zone.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}" diff --git a/roles/monitoring/grafana/files/dashboard-network-ups-tools.json b/roles/monitoring/grafana/files/dashboard-network-ups-tools.json index 468bae82..367e9b56 100644 --- a/roles/monitoring/grafana/files/dashboard-network-ups-tools.json +++ b/roles/monitoring/grafana/files/dashboard-network-ups-tools.json @@ -75,9 +75,9 @@ }, "id": 9, "panels": [], - "repeat": "instance", + "repeat": "ups_instance", "repeatDirection": "h", - "title": "Status: $instance", + "title": "Status: $ups_instance", "type": "row" }, { @@ -140,7 +140,7 @@ }, "editorMode": "builder", "exemplar": false, - "expr": "network_ups_tools_device_info{instance=\"$instance\"}", + "expr": "network_ups_tools_device_info{ups_instance=\"$ups_instance\"}", "instant": true, "legendFormat": "{{ mfr }}, {{ model }}", "range": false, @@ -210,7 +210,7 @@ }, "editorMode": "builder", "exemplar": false, - "expr": "network_ups_tools_ups_status{instance=\"$instance\", flag=\"OL\"}", + "expr": "network_ups_tools_ups_status{ups_instance=\"$ups_instance\", flag=\"OL\"}", "instant": true, "legendFormat": "{{ flag }}", "range": false, @@ -280,7 +280,7 @@ }, "editorMode": "builder", "exemplar": false, - "expr": "network_ups_tools_ups_status{instance=\"$instance\", flag=\"OVER\"}", + "expr": "network_ups_tools_ups_status{ups_instance=\"$ups_instance\", flag=\"OVER\"}", "instant": true, "legendFormat": "{{ flag }}", "range": false, @@ -350,7 +350,7 @@ }, "editorMode": "builder", "exemplar": false, - "expr": "network_ups_tools_ups_status{instance=\"$instance\", flag=\"OFF\"}", + "expr": "network_ups_tools_ups_status{ups_instance=\"$ups_instance\", flag=\"OFF\"}", "instant": true, "legendFormat": "{{ flag }}", "range": false, @@ -420,7 +420,7 @@ }, "editorMode": "builder", "exemplar": false, - "expr": "network_ups_tools_ups_status{instance=\"$instance\", flag=\"OB\"}", + "expr": "network_ups_tools_ups_status{ups_instance=\"$ups_instance\", flag=\"OB\"}", "instant": true, "legendFormat": "{{ flag }}", "range": false, @@ -490,7 +490,7 @@ }, "editorMode": "builder", "exemplar": false, - "expr": "network_ups_tools_ups_status{instance=\"$instance\", flag=\"LB\"}", + "expr": "network_ups_tools_ups_status{ups_instance=\"$ups_instance\", flag=\"LB\"}", "instant": true, "legendFormat": "{{ flag }}", "range": false, @@ -560,7 +560,7 @@ }, "editorMode": "builder", "exemplar": false, - "expr": "network_ups_tools_ups_status{instance=\"$instance\", flag=\"RB\"}", + "expr": "network_ups_tools_ups_status{ups_instance=\"$ups_instance\", flag=\"RB\"}", "instant": true, "legendFormat": "{{ flag }}", "range": false, @@ -669,8 +669,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "network_ups_tools_input_voltage{instance=~\"$instance\"}", - "legendFormat": "{{ instance }}", + "expr": "network_ups_tools_input_voltage{ups_instance=~\"$ups_instance\"}", + "legendFormat": "{{ ups_instance }}", "range": true, "refId": "A" } @@ -764,8 +764,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "network_ups_tools_input_frequency{instance=~\"$instance\"}", - "legendFormat": "{{ instance }}", + "expr": "network_ups_tools_input_frequency{ups_instance=~\"$ups_instance\"}", + "legendFormat": "{{ ups_instance }}", "range": true, "refId": "A" } @@ -859,8 +859,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "network_ups_tools_output_voltage{instance=~\"$instance\"}", - "legendFormat": "{{ instance }}", + "expr": "network_ups_tools_output_voltage{ups_instance=~\"$ups_instance\"}", + "legendFormat": "{{ ups_instance }}", "range": true, "refId": "A" } @@ -954,8 +954,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "network_ups_tools_output_frequency{instance=~\"$instance\"}", - "legendFormat": "{{ instance }}", + "expr": "network_ups_tools_output_frequency{ups_instance=~\"$ups_instance\"}", + "legendFormat": "{{ ups_instance }}", "range": true, "refId": "A" } @@ -1048,8 +1048,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "network_ups_tools_ups_load{instance=~\"$instance\"}", - "legendFormat": "{{ instance }}", + "expr": "network_ups_tools_ups_load{ups_instance=~\"$ups_instance\"}", + "legendFormat": "{{ ups_instance }}", "range": true, "refId": "A" } @@ -1142,8 +1142,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "network_ups_tools_ups_power{instance=~\"$instance\"}", - "legendFormat": "{{ instance }}", + "expr": "network_ups_tools_ups_power{ups_instance=~\"$ups_instance\"}", + "legendFormat": "{{ ups_instance }}", "range": true, "refId": "A" } @@ -1236,8 +1236,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "network_ups_tools_ups_realpower{instance=~\"$instance\"}", - "legendFormat": "{{ instance }}", + "expr": "network_ups_tools_ups_realpower{ups_instance=~\"$ups_instance\"}", + "legendFormat": "{{ ups_instance }}", "range": true, "refId": "A" } @@ -1330,8 +1330,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "network_ups_tools_battery_charge{instance=~\"$instance\"}", - "legendFormat": "{{ instance }}", + "expr": "network_ups_tools_battery_charge{ups_instance=~\"$ups_instance\"}", + "legendFormat": "{{ ups_instance }}", "range": true, "refId": "A" } @@ -1424,8 +1424,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "network_ups_tools_battery_runtime{instance=~\"$instance\"}", - "legendFormat": "{{ instance }}", + "expr": "network_ups_tools_battery_runtime{ups_instance=~\"$ups_instance\"}", + "legendFormat": "{{ ups_instance }}", "range": true, "refId": "A" } @@ -1446,18 +1446,18 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "definition": "network_ups_tools_device_info", + "definition": "label_values(ups_instance)", "hide": 0, "includeAll": true, "multi": true, - "name": "instance", + "name": "ups_instance", "options": [], "query": { - "query": "network_ups_tools_device_info", - "refId": "StandardVariableQuery" + "query": "label_values(ups_instance)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, - "regex": "/.*instance=\"([^\"]*).*/", + "regex": "", "skipUrlSync": false, "sort": 0, "type": "query" diff --git a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py index 473eb655..50e34865 100644 --- a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py +++ b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py @@ -9,6 +9,8 @@ from ansible import errors _multitarget_id_map_ = { "blackbox/probe": (lambda vars, config: (vars['inventory_hostname'], "%s-%s" % (config['svc_kind'], config['svc_instance']))), "ssl/probe": (lambda vars, config: (vars['inventory_hostname'], "%s-%s-%s" % (config['module'], config['sslcert_instance'], vars['inventory_hostname']))), + "ipmi/remote": (lambda vars, config: (vars['inventory_hostname'], vars['inventory_hostname'])), + "nut/ups": (lambda vars, config: (vars['inventory_hostname'], config['ups'])), "whawty-nginx-sso": (lambda vars, config: (vars['inventory_hostname'], "%s-%s" % (config['app_instance'], vars['inventory_hostname']))), } diff --git a/roles/monitoring/prometheus/exporter/register/templates/nut/ups.yml.j2 b/roles/monitoring/prometheus/exporter/register/templates/nut/ups.yml.j2 index 5181f4e4..6c549e1e 100644 --- a/roles/monitoring/prometheus/exporter/register/templates/nut/ups.yml.j2 +++ b/roles/monitoring/prometheus/exporter/register/templates/nut/ups.yml.j2 @@ -1,6 +1,7 @@ - targets: [ '{{ (target.exporter_hostname == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.exporter_hostname].prometheus_scrape_endpoint) }}' ] labels: instance: '{{ target.instance }}' + ups_instance: '{{ target.config.ups }}' __param_ups: '{{ target.config.ups }}' __param_server: '{{ target.config.server | default('127.0.0.1') }}' {% if 'username' in target.config %} -- cgit v1.2.3 From 7220af6cefd8e066f9b55961f6f035480f520a09 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 30 Jun 2024 00:32:19 +0200 Subject: prometheus: incooporate multitarget labelding to elevate hosts as well --- inventory/group_vars/ele-ups/vars.yml | 3 +-- inventory/host_vars/ele-calypso.yml | 5 +++-- inventory/host_vars/ele-dione.yml | 3 ++- inventory/host_vars/ele-helene.yml | 3 ++- inventory/host_vars/ele-media.yml | 3 ++- inventory/host_vars/ele-telesto.yml | 3 ++- inventory/host_vars/ele-thetys.yml | 3 ++- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/inventory/group_vars/ele-ups/vars.yml b/inventory/group_vars/ele-ups/vars.yml index 6146bc37..7d99ac83 100644 --- a/inventory/group_vars/ele-ups/vars.yml +++ b/inventory/group_vars/ele-ups/vars.yml @@ -20,6 +20,5 @@ prometheus_exporters_default: prometheus_job_multitarget_nut__ups: ele-calypso: - - instance: "ups-{{ ups_name }}" - ups: "{{ ups_name }}" + - ups: "{{ ups_name }}" server: "{{ network_mgmt_zone.prefix | ansible.utils.ipaddr(network_mgmt_zone.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}" diff --git a/inventory/host_vars/ele-calypso.yml b/inventory/host_vars/ele-calypso.yml index 2f5648ac..75054533 100644 --- a/inventory/host_vars/ele-calypso.yml +++ b/inventory/host_vars/ele-calypso.yml @@ -122,7 +122,8 @@ prometheus_exporter_blackbox_modules_extra: prometheus_job_multitarget_blackbox__probe: ele-calypso: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + 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 @@ -178,7 +179,7 @@ grafana_dashboards: datasource: "Prometheus" - file: chrony datasource: "Prometheus" - - file: blackbox + - file: blackbox/ssh datasource: "Prometheus" - file: network-ups-tools datasource: "Prometheus" diff --git a/inventory/host_vars/ele-dione.yml b/inventory/host_vars/ele-dione.yml index 7b1d98d7..7f5b8a31 100644 --- a/inventory/host_vars/ele-dione.yml +++ b/inventory/host_vars/ele-dione.yml @@ -98,6 +98,7 @@ prometheus_exporter_ipmi_modules: prometheus_job_multitarget_blackbox__probe: ele-calypso: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.emc.prefix | ansible.utils.ipaddr(network_zones.emc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ele-helene.yml b/inventory/host_vars/ele-helene.yml index 8d73ce80..48efb84b 100644 --- a/inventory/host_vars/ele-helene.yml +++ b/inventory/host_vars/ele-helene.yml @@ -66,7 +66,8 @@ prometheus_exporter_ipmi_modules: prometheus_job_multitarget_blackbox__probe: ele-calypso: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + 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/ele-media.yml b/inventory/host_vars/ele-media.yml index 09f08d63..286b6ff9 100644 --- a/inventory/host_vars/ele-media.yml +++ b/inventory/host_vars/ele-media.yml @@ -51,7 +51,8 @@ prometheus_exporter_node_textfile_collector_scripts: prometheus_job_multitarget_blackbox__probe: ele-calypso: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + 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/ele-telesto.yml b/inventory/host_vars/ele-telesto.yml index 030a7111..f70efa16 100644 --- a/inventory/host_vars/ele-telesto.yml +++ b/inventory/host_vars/ele-telesto.yml @@ -74,6 +74,7 @@ prometheus_exporter_ipmi_modules: prometheus_job_multitarget_blackbox__probe: ele-calypso: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.emc.prefix | ansible.utils.ipaddr(network_zones.emc.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner diff --git a/inventory/host_vars/ele-thetys.yml b/inventory/host_vars/ele-thetys.yml index 2144327c..bd72f98a 100644 --- a/inventory/host_vars/ele-thetys.yml +++ b/inventory/host_vars/ele-thetys.yml @@ -51,7 +51,8 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ele-calypso: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + svc_instance: "{{ inventory_hostname }}" target: "{{ network_zones.cc_orpheum.prefix | ansible.utils.ipaddr(network_zones.cc_orpheum.offsets[inventory_hostname]) | ansible.utils.ipaddr('address') }}:{{ ansible_port | default(22) }}" module: ssh_banner -- cgit v1.2.3