summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/exporter/register
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-06-21 00:25:07 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-06-21 00:25:07 +0200
commit6ba8e72412f9ee47755d8f5cee41874bcd717540 (patch)
tree29560a2e663b899d13a88466233fb49838e15997 /roles/monitoring/prometheus/exporter/register
parentrename new blackbox-exporter metric label from svc_name to svc_instance (diff)
revamp prometheus metric lables for whawty-nginx-sso
Diffstat (limited to 'roles/monitoring/prometheus/exporter/register')
-rw-r--r--roles/monitoring/prometheus/exporter/register/filter_plugins/prometheus.py1
-rw-r--r--roles/monitoring/prometheus/exporter/register/templates/whawty-nginx-sso.yml.j24
2 files changed, 4 insertions, 1 deletions
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 %}