From 5aafc31ce200e0a3a27245410291cf76dc412a75 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 4 Feb 2023 00:41:12 +0100 Subject: promethues: move target file installation to seperate role --- .../prometheus/server/filter_plugins/prometheus.py | 37 ---------------------- 1 file changed, 37 deletions(-) delete mode 100644 roles/monitoring/prometheus/server/filter_plugins/prometheus.py (limited to 'roles/monitoring/prometheus/server/filter_plugins/prometheus.py') diff --git a/roles/monitoring/prometheus/server/filter_plugins/prometheus.py b/roles/monitoring/prometheus/server/filter_plugins/prometheus.py deleted file mode 100644 index d91ef619..00000000 --- a/roles/monitoring/prometheus/server/filter_plugins/prometheus.py +++ /dev/null @@ -1,37 +0,0 @@ -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from functools import partial - -from ansible import errors - - -def prometheus_job_targets(hostvars, jobs, targets): - try: - result = [] - for job in jobs: - for target in targets: - multitarget_config_varname = 'prometheus_job_multitarget_' + job.replace('-', '_').replace('/', '__') - if multitarget_config_varname in hostvars[target]: - for exporter_hostname, configs in hostvars[target][multitarget_config_varname].items(): - for config in configs: - result.append({'job': job, 'instance': config['instance'], 'enabled': True, - 'exporter_hostname': exporter_hostname, 'config': config}) - - else: - enabled = job in hostvars[target]['prometheus_exporters_default'] or job in hostvars[target]['prometheus_exporters_extra'] - result.append({'job': job, 'instance': target, 'enabled': enabled}) - return result - except Exception as e: - raise errors.AnsibleFilterError("prometheus_job_targets(): %s" % str(e)) - - -class FilterModule(object): - - ''' prometheus filters ''' - filter_map = { - 'prometheus_job_targets': prometheus_job_targets, - } - - def filters(self): - return self.filter_map -- cgit v1.2.3