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 --- .../prometheus/exporter/register/filter_plugins/prometheus.py | 2 ++ roles/monitoring/prometheus/exporter/register/templates/nut/ups.yml.j2 | 1 + 2 files changed, 3 insertions(+) (limited to 'roles/monitoring/prometheus/exporter') 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