diff options
37 files changed, 1849 insertions, 158 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/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/ch-apps/vars.yml b/inventory/host_vars/ch-apps/vars.yml index 89a6873c..f39d57f1 100644 --- a/inventory/host_vars/ch-apps/vars.yml +++ b/inventory/host_vars/ch-apps/vars.yml @@ -65,21 +65,22 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + 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 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-atlas.yml b/inventory/host_vars/ch-atlas.yml index f342445b..1f4dda2f 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_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 15e5f622..39ddbc3d 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_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 05489600..e5e4c3fc 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_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 - - instance: "https-greenbone.chaos-at-home.org" + - svc_kind: https + 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 11bc30e0..5677359c 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_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 53c3cfce..bdbde798 100644 --- a/inventory/host_vars/ch-http-proxy.yml +++ b/inventory/host_vars/ch-http-proxy.yml @@ -49,19 +49,21 @@ prometheus_exporters_extra: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + 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 - - instance: "https-login.chaos-at-home.org" + - svc_kind: https + svc_instance: "login.chaos-at-home.org" target: "https://{{ network_services.http.addr }}/login" module: "http_tls_2xx" hostname: "login.chaos-at-home.org" 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: @@ -124,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-imap-proxy.yml b/inventory/host_vars/ch-imap-proxy.yml index 76a62757..b54fabcc 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_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 1a5782b4..30bee5d8 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_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 - - instance: "mqtt-mqtt.chaos-at-home.org" + - svc_kind: mqtt + 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 92adb5cf..d0d84bf5 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_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 baf60b5e..bc09509d 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_instance: "{{ inventory_hostname }}" target: "{{ external_ip }}:{{ ansible_port | default(22) }}" module: ssh_banner - - instance: "https-mimas.chaos-at-home.org" + - svc_kind: https + 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 64121848..85b2dd8c 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: @@ -174,18 +173,21 @@ prometheus_exporter_smokeping_targets: prometheus_job_multitarget_blackbox__probe: ch-mon: - - instance: "ssh-{{ inventory_hostname }}" + - svc_kind: ssh + 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 - - instance: "https-mon.chaos-at-home.org" + - svc_kind: https + 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 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 @@ -266,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" @@ -276,7 +282,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/inventory/host_vars/ch-pan.yml b/inventory/host_vars/ch-pan.yml index d8e17277..29ec85ae 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_instance: "{{ 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_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 cfcfebc8..0f2ed044 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_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 de7e273b..b5641464 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_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 8ff107a5..de952d74 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_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 - - instance: "http-apt.chaos-at-home.org" + - svc_kind: http + svc_instance: "apt.chaos-at-home.org" target: "http://{{ approx_hostname }}" module: "http_2xx" 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 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-whawty-nginx-sso.json b/roles/monitoring/grafana/files/dashboard-apps/whawty-nginx-sso.json index b6f21f92..734893a5 100644 --- a/roles/monitoring/grafana/files/dashboard-whawty-nginx-sso.json +++ b/roles/monitoring/grafana/files/dashboard-apps/whawty-nginx-sso.json @@ -15,7 +15,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.2.2" + "version": "11.0.0" }, { "type": "datasource", @@ -146,6 +146,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "multi", "sort": "none" } @@ -246,6 +247,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -349,6 +351,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "multi", "sort": "asc" } @@ -378,7 +381,7 @@ "h": 1, "w": 24, "x": 0, - "y": 32 + "y": 14 }, "id": 5, "panels": [], @@ -448,7 +451,7 @@ "h": 7, "w": 12, "x": 0, - "y": 33 + "y": 15 }, "id": 13, "options": { @@ -459,6 +462,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -579,7 +583,7 @@ "h": 7, "w": 12, "x": 12, - "y": 33 + "y": 15 }, "id": 14, "options": { @@ -590,6 +594,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -710,7 +715,7 @@ "h": 6, "w": 12, "x": 0, - "y": 40 + "y": 22 }, "id": 21, "options": { @@ -721,6 +726,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -811,7 +817,7 @@ "h": 6, "w": 12, "x": 12, - "y": 40 + "y": 22 }, "id": 22, "options": { @@ -822,6 +828,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "multi", "sort": "asc" } @@ -850,7 +857,7 @@ "h": 1, "w": 24, "x": 0, - "y": 46 + "y": 28 }, "id": 2, "panels": [], @@ -951,7 +958,7 @@ "h": 7, "w": 19, "x": 0, - "y": 47 + "y": 29 }, "id": 1, "options": { @@ -962,6 +969,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -986,7 +994,6 @@ } ], "title": "Requests", - "transformations": [], "type": "timeseries" }, { @@ -1047,7 +1054,7 @@ "h": 7, "w": 5, "x": 19, - "y": 47 + "y": 29 }, "id": 3, "options": { @@ -1062,10 +1069,11 @@ "fields": "", "values": false }, + "showPercentChange": false, "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.2.2", + "pluginVersion": "11.0.0", "targets": [ { "datasource": { @@ -1198,7 +1206,7 @@ "h": 6, "w": 12, "x": 0, - "y": 54 + "y": 36 }, "id": 23, "options": { @@ -1209,6 +1217,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -1299,7 +1308,7 @@ "h": 6, "w": 12, "x": 12, - "y": 54 + "y": 36 }, "id": 24, "options": { @@ -1310,6 +1319,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "multi", "sort": "asc" } @@ -1426,7 +1436,7 @@ "h": 6, "w": 12, "x": 0, - "y": 60 + "y": 42 }, "id": 25, "options": { @@ -1437,6 +1447,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -1529,7 +1540,7 @@ "h": 6, "w": 12, "x": 12, - "y": 60 + "y": 42 }, "id": 26, "options": { @@ -1540,6 +1551,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "multi", "sort": "asc" } @@ -1569,7 +1581,7 @@ } ], "refresh": "", - "schemaVersion": 38, + "schemaVersion": 39, "tags": [], "templating": { "list": [ @@ -1579,7 +1591,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "definition": "label_values({job=\"whawty-nginx-sso\"},instance)", + "definition": "label_values({app_kind=\"whawty-nginx-sso\"},instance)", "hide": 0, "includeAll": false, "multi": false, @@ -1587,7 +1599,27 @@ "options": [], "query": { "qryType": 1, - "query": "label_values({job=\"whawty-nginx-sso\"},instance)", + "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, @@ -1602,7 +1634,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "definition": "label_values(whawty_nginx_sso_web_requests_total{instance=\"$instance\"},endpoint)", + "definition": "label_values(whawty_nginx_sso_web_requests_total{instance=\"$instance\", app_instance=~\"$app_instance\"},endpoint)", "hide": 0, "includeAll": true, "multi": true, @@ -1610,7 +1642,7 @@ "options": [], "query": { "qryType": 1, - "query": "label_values(whawty_nginx_sso_web_requests_total{instance=\"$instance\"},endpoint)", + "query": "label_values(whawty_nginx_sso_web_requests_total{instance=\"$instance\", app_instance=~\"$app_instance\"},endpoint)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 2, @@ -1625,7 +1657,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "definition": "label_values(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\"},server)", + "definition": "label_values(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\", app_instance=~\"$app_instance\"},server)", "hide": 0, "includeAll": true, "multi": true, @@ -1633,7 +1665,7 @@ "options": [], "query": { "qryType": 1, - "query": "label_values(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\"},server)", + "query": "label_values(whawty_nginx_sso_auth_ldap_requests_total{instance=\"$instance\", app_instance=~\"$app_instance\"},server)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 2, @@ -1648,10 +1680,11 @@ "from": "now-24h", "to": "now" }, + "timeRangeUpdatedDuringEditOrView": false, "timepicker": {}, "timezone": "", "title": "whawty nginx-sso", "uid": "e745f2f9-9115-49a0-b386-9919bcf566de", - "version": 2, + "version": 15, "weekStart": "" }
\ No newline at end of file diff --git a/roles/monitoring/grafana/files/dashboard-blackbox.json b/roles/monitoring/grafana/files/dashboard-blackbox/https.json index 448d605c..061be3ae 100644 --- a/roles/monitoring/grafana/files/dashboard-blackbox.json +++ b/roles/monitoring/grafana/files/dashboard-blackbox/https.json @@ -15,7 +15,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.4.0" + "version": "11.0.0" }, { "type": "datasource", @@ -58,7 +58,7 @@ } ] }, - "description": "Blackbox Exporter Overview", + "description": "Blackbox Exporter http/https Targets", "editable": true, "fiscalYearStartMonth": 0, "gnetId": 7587, @@ -83,6 +83,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "drawStyle": "line", "fillOpacity": 10, @@ -142,6 +143,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "multi", "sort": "asc" } @@ -153,11 +155,13 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "probe_duration_seconds{instance=~\"$target\"}", + "editorMode": "code", + "expr": "probe_duration_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, - "legendFormat": "{{ instance }}", + "legendFormat": "{{ svc_instance }}", + "range": true, "refId": "A" } ], @@ -179,6 +183,7 @@ "id": 15, "panels": [], "repeat": "target", + "repeatDirection": "h", "targets": [ { "datasource": { @@ -188,7 +193,7 @@ "refId": "A" } ], - "title": "$target status", + "title": "$target", "type": "row" }, { @@ -268,7 +273,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.0.0", "repeatDirection": "v", "targets": [ { @@ -276,10 +281,12 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "probe_success{instance=~\"$target\"}", + "editorMode": "code", + "expr": "probe_success{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, + "range": true, "refId": "A" } ], @@ -361,6 +368,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "multi", "sort": "none" } @@ -372,11 +380,13 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "probe_http_duration_seconds{instance=~\"$target\"}", + "editorMode": "code", + "expr": "probe_http_duration_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, "legendFormat": "{{ phase }}", + "range": true, "refId": "B" } ], @@ -391,7 +401,7 @@ "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "mode": "thresholds" }, "custom": { "axisBorderShow": false, @@ -399,10 +409,11 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "drawStyle": "line", "fillOpacity": 10, - "gradientMode": "none", + "gradientMode": "scheme", "hideFrom": { "legend": false, "tooltip": false, @@ -434,8 +445,12 @@ "value": null }, { + "color": "orange", + "value": 0.2 + }, + { "color": "red", - "value": 80 + "value": 1 } ] }, @@ -455,9 +470,10 @@ "calcs": [], "displayMode": "list", "placement": "bottom", - "showLegend": true + "showLegend": false }, "tooltip": { + "maxHeight": 600, "mode": "multi", "sort": "none" } @@ -469,11 +485,13 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "probe_duration_seconds{instance=~\"$target\"}", + "editorMode": "code", + "expr": "probe_duration_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, "legendFormat": "seconds", + "range": true, "refId": "A" } ], @@ -558,7 +576,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.0.0", "repeatDirection": "h", "targets": [ { @@ -566,10 +584,12 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "probe_http_status_code{instance=~\"$target\"}", + "editorMode": "code", + "expr": "probe_http_status_code{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, + "range": true, "refId": "A" } ], @@ -638,16 +658,18 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.0.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "probe_http_version{instance=~\"$target\"}", + "editorMode": "code", + "expr": "probe_http_version{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "intervalFactor": 1, + "range": true, "refId": "A" } ], @@ -731,7 +753,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.0.0", "repeatDirection": "v", "targets": [ { @@ -739,10 +761,12 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "probe_http_ssl{instance=~\"$target\"}", + "editorMode": "code", + "expr": "probe_http_ssl{svc_kind=~\"https?\", svc_instance=~\"$target\"}", "format": "time_series", "interval": "$interval", "intervalFactor": 1, + "range": true, "refId": "A" } ], @@ -827,7 +851,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.0.0", "repeatDirection": "h", "targets": [ { @@ -835,10 +859,12 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "probe_ssl_earliest_cert_expiry{instance=~\"$target\"} - time()", + "editorMode": "code", + "expr": "probe_ssl_earliest_cert_expiry{svc_kind=~\"https?\", svc_instance=~\"$target\"} - time()", "format": "time_series", "interval": "$interval", "intervalFactor": 1, + "range": true, "refId": "A" } ], @@ -907,17 +933,19 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.0.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "avg(probe_duration_seconds{instance=~\"$target\"})", + "editorMode": "code", + "expr": "avg(probe_duration_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"})", "format": "time_series", "interval": "$interval", "intervalFactor": 1, + "range": true, "refId": "A" } ], @@ -986,7 +1014,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.0.0", "repeatDirection": "h", "targets": [ { @@ -994,10 +1022,12 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "expr": "avg(probe_dns_lookup_time_seconds{instance=~\"$target\"})", + "editorMode": "code", + "expr": "avg(probe_dns_lookup_time_seconds{svc_kind=~\"https?\", svc_instance=~\"$target\"})", "format": "time_series", "interval": "$interval", "intervalFactor": 1, + "range": true, "refId": "A" } ], @@ -1109,15 +1139,16 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "definition": "", + "definition": "label_values(probe_success{svc_kind=~\"https?\"},svc_instance)", "hide": 0, "includeAll": true, "multi": true, "name": "target", "options": [], "query": { - "query": "label_values(probe_success, instance)", - "refId": "Prometheus-target-Variable-Query" + "qryType": 1, + "query": "label_values(probe_success{svc_kind=~\"https?\"},svc_instance)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, "regex": "", @@ -1134,6 +1165,7 @@ "from": "now-6h", "to": "now" }, + "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -1160,8 +1192,8 @@ ] }, "timezone": "", - "title": "Blackbox Exporter", - "uid": "xtkCtBkiz", - "version": 1, + "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..f019677f --- /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_instance=~\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "legendFormat": "{{ svc_instance }}", + "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_instance=~\"$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_instance=~\"$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_instance=~\"$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_instance=~\"$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_instance=~\"$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_instance)", + "hide": 0, + "includeAll": true, + "multi": true, + "name": "target", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(probe_success{svc_kind=~\"mqtt\"},svc_instance)", + "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..af8d31e1 --- /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_instance=~\"$target\"}", + "format": "time_series", + "interval": "$interval", + "intervalFactor": 1, + "legendFormat": "{{ svc_instance }}", + "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_instance=\"$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_instance=\"$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_instance=\"$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_instance=\"$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_instance)", + "hide": 0, + "includeAll": true, + "multi": true, + "name": "target", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(probe_success{svc_kind=\"ssh\"},svc_instance)", + "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/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/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 diff --git a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py index e8067a72..50e34865 100644 --- a/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py +++ b/roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py @@ -6,6 +6,15 @@ 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_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']))), +} + + def prometheus_job_targets(jobs, vars): try: result = [] @@ -14,15 +23,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..fbbce7df 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_instance: '{{ target.config.svc_instance }}' __param_target: '{{ target.config.target }}' __param_module: '{{ target.config.module }}' {% if 'hostname' in target.config %} 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 %} 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() %} 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 %} |