summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/server/templates
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-08-28 18:35:24 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-08-28 18:35:24 +0200
commit5984697d98b5c953101aa8eef6c69db307d4a563 (patch)
treef5db17aeb140e9acb8e56b27167c2c8b7358a9f4 /roles/monitoring/prometheus/server/templates
parentpromethues generic vs special jobs (diff)
prometheus: add support special jobs (WIP)
Diffstat (limited to 'roles/monitoring/prometheus/server/templates')
-rw-r--r--roles/monitoring/prometheus/server/templates/job-snippets/generic.j2 (renamed from roles/monitoring/prometheus/server/templates/job-snippets/default.j2)0
-rw-r--r--roles/monitoring/prometheus/server/templates/prometheus.yml.j22
-rw-r--r--roles/monitoring/prometheus/server/templates/targets/generic.yml.j23
-rw-r--r--roles/monitoring/prometheus/server/templates/targets/nut.yml.j217
4 files changed, 21 insertions, 1 deletions
diff --git a/roles/monitoring/prometheus/server/templates/job-snippets/default.j2 b/roles/monitoring/prometheus/server/templates/job-snippets/generic.j2
index 87992eeb..87992eeb 100644
--- a/roles/monitoring/prometheus/server/templates/job-snippets/default.j2
+++ b/roles/monitoring/prometheus/server/templates/job-snippets/generic.j2
diff --git a/roles/monitoring/prometheus/server/templates/prometheus.yml.j2 b/roles/monitoring/prometheus/server/templates/prometheus.yml.j2
index 2b9a08e4..4cfcc498 100644
--- a/roles/monitoring/prometheus/server/templates/prometheus.yml.j2
+++ b/roles/monitoring/prometheus/server/templates/prometheus.yml.j2
@@ -37,7 +37,7 @@ scrape_configs:
{% endif %}
{% for job in (prometheus_server_jobs_generic + prometheus_server_jobs_special) %}
-{% include 'job-snippets/' + (lookup('first_found', {'paths': ['templates/job-snippets'], 'files': [job + '.j2', 'default.j2']}) | basename) %}{{ '' }}
+{% include 'job-snippets/' + (lookup('first_found', {'paths': ['templates/job-snippets'], 'files': [job + '.j2', 'generic.j2']}) | basename) %}{{ '' }}
{% endfor %}
{% if prometheus_server_jobs_extra is defined %}
diff --git a/roles/monitoring/prometheus/server/templates/targets/generic.yml.j2 b/roles/monitoring/prometheus/server/templates/targets/generic.yml.j2
new file mode 100644
index 00000000..e83b6bf4
--- /dev/null
+++ b/roles/monitoring/prometheus/server/templates/targets/generic.yml.j2
@@ -0,0 +1,3 @@
+- targets: [ "{{ hostvars[target].prometheus_scrape_endpoint }}" ]
+ labels:
+ instance: "{{ target }}"
diff --git a/roles/monitoring/prometheus/server/templates/targets/nut.yml.j2 b/roles/monitoring/prometheus/server/templates/targets/nut.yml.j2
new file mode 100644
index 00000000..da3de3d7
--- /dev/null
+++ b/roles/monitoring/prometheus/server/templates/targets/nut.yml.j2
@@ -0,0 +1,17 @@
+- targets: [ "{{ hostvars[target.config.exporter_hostname].prometheus_scrape_endpoint }}" ]
+ labels:
+ instance: "{{ target.instance }}"
+ __param_ups: {{ target.config.ups }}
+ __param_server: {{ target.config.server | default('127.0.0.1') }}
+{% if 'username' in target.config %}
+ __param_username: {{ target.config.username }}
+{% endif %}
+{% if 'password' in target.config %}
+ __param_password: {{ target.config.password }}
+{% endif %}
+{% if 'variables' in target.config %}
+ __param_variables: {{ target.config.variables }}
+{% endif %}
+{% if 'statuses' in target.config %}
+ __param_statuses: {{ target.config.statuses }}
+{% endif %}