summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-06-28 23:59:11 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-06-28 23:59:11 +0200
commit992b7262ea1d8e8cf7c6d0e3afaa33427ea0ca4a (patch)
treea9e4d0dd7436a9aaa282734803cdbc500036fff6
parentrevamp prometheus metric lables for whawty-nginx-sso (diff)
revamp prometheus metric lables for ssl/probe
-rw-r--r--inventory/host_vars/ch-apps/vars.yml12
-rw-r--r--inventory/host_vars/ch-http-proxy.yml4
-rw-r--r--inventory/host_vars/ch-mon.yml5
-rw-r--r--roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py1
-rw-r--r--roles/monitoring/prometheus/exporter/register/templates/ssl/probe.yml.j22
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() %}