summaryrefslogtreecommitdiff
path: root/roles/monitoring
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-10-26 00:49:54 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-10-26 00:49:54 +0200
commit61700fa5c63b6f2a45b2ba3210247b4fe6028afa (patch)
tree128dc93901d267c7e21e741dbfc0a994a658c357 /roles/monitoring
parentdisable all grafana dashboards for now (diff)
prometheus: scrape exporter running on server using localhost address
Diffstat (limited to 'roles/monitoring')
-rw-r--r--roles/monitoring/prometheus/exporter/base/tasks/tls.yml2
-rw-r--r--roles/monitoring/prometheus/exporter/base/templates/nginx-vhost.j22
-rw-r--r--roles/monitoring/prometheus/server/templates/targets/blackbox/probe.yml.j22
-rw-r--r--roles/monitoring/prometheus/server/templates/targets/generic.yml.j22
-rw-r--r--roles/monitoring/prometheus/server/templates/targets/ipmi/remote.yml.j22
-rw-r--r--roles/monitoring/prometheus/server/templates/targets/nut/ups.yml.j22
-rw-r--r--roles/monitoring/prometheus/server/templates/targets/ssl/probe.yml.j22
7 files changed, 7 insertions, 7 deletions
diff --git a/roles/monitoring/prometheus/exporter/base/tasks/tls.yml b/roles/monitoring/prometheus/exporter/base/tasks/tls.yml
index 083ca930..7adbd8ee 100644
--- a/roles/monitoring/prometheus/exporter/base/tasks/tls.yml
+++ b/roles/monitoring/prometheus/exporter/base/tasks/tls.yml
@@ -34,7 +34,7 @@
CN: "{{ inventory_hostname }}"
subject_alt_name:
- "DNS:{{ host_name }}.{{ host_domain }}"
- - "IP:{{ ansible_default_ipv4.address }}"
+ - "IP:{{ (inventory_hostname == prometheus_server) | ternary('127.0.0.1', ansible_default_ipv4.address) }}"
key_usage:
- digitalSignature
key_usage_critical: yes
diff --git a/roles/monitoring/prometheus/exporter/base/templates/nginx-vhost.j2 b/roles/monitoring/prometheus/exporter/base/templates/nginx-vhost.j2
index 70e65b29..a392e821 100644
--- a/roles/monitoring/prometheus/exporter/base/templates/nginx-vhost.j2
+++ b/roles/monitoring/prometheus/exporter/base/templates/nginx-vhost.j2
@@ -1,5 +1,5 @@
server {
- listen {{ prometheus_exporter_listen }} ssl;
+ listen {{ (inventory_hostname == prometheus_server) | ternary('127.0.0.1:9999', prometheus_exporter_listen) }} ssl;
server_name _;
ssl_certificate /etc/ssl/prometheus/exporter/crt.pem;
diff --git a/roles/monitoring/prometheus/server/templates/targets/blackbox/probe.yml.j2 b/roles/monitoring/prometheus/server/templates/targets/blackbox/probe.yml.j2
index 4e336873..47e6dceb 100644
--- a/roles/monitoring/prometheus/server/templates/targets/blackbox/probe.yml.j2
+++ b/roles/monitoring/prometheus/server/templates/targets/blackbox/probe.yml.j2
@@ -1,4 +1,4 @@
-- targets: [ '{{ hostvars[target.exporter_hostname].prometheus_scrape_endpoint }}' ]
+- targets: [ '{{ (target.exporter_hostname == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.exporter_hostname].prometheus_scrape_endpoint) }}' ]
labels:
instance: '{{ target.instance }}'
__param_target: '{{ target.config.target }}'
diff --git a/roles/monitoring/prometheus/server/templates/targets/generic.yml.j2 b/roles/monitoring/prometheus/server/templates/targets/generic.yml.j2
index 6591362b..341cb45a 100644
--- a/roles/monitoring/prometheus/server/templates/targets/generic.yml.j2
+++ b/roles/monitoring/prometheus/server/templates/targets/generic.yml.j2
@@ -1,3 +1,3 @@
-- targets: [ '{{ hostvars[target.instance].prometheus_scrape_endpoint }}' ]
+- targets: [ '{{ (target.instance == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.instance].prometheus_scrape_endpoint) }}' ]
labels:
instance: '{{ target.instance }}'
diff --git a/roles/monitoring/prometheus/server/templates/targets/ipmi/remote.yml.j2 b/roles/monitoring/prometheus/server/templates/targets/ipmi/remote.yml.j2
index 4e336873..47e6dceb 100644
--- a/roles/monitoring/prometheus/server/templates/targets/ipmi/remote.yml.j2
+++ b/roles/monitoring/prometheus/server/templates/targets/ipmi/remote.yml.j2
@@ -1,4 +1,4 @@
-- targets: [ '{{ hostvars[target.exporter_hostname].prometheus_scrape_endpoint }}' ]
+- targets: [ '{{ (target.exporter_hostname == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.exporter_hostname].prometheus_scrape_endpoint) }}' ]
labels:
instance: '{{ target.instance }}'
__param_target: '{{ target.config.target }}'
diff --git a/roles/monitoring/prometheus/server/templates/targets/nut/ups.yml.j2 b/roles/monitoring/prometheus/server/templates/targets/nut/ups.yml.j2
index c60077c7..a25cdfe5 100644
--- a/roles/monitoring/prometheus/server/templates/targets/nut/ups.yml.j2
+++ b/roles/monitoring/prometheus/server/templates/targets/nut/ups.yml.j2
@@ -1,4 +1,4 @@
-- targets: [ '{{ hostvars[target.exporter_hostname].prometheus_scrape_endpoint }}' ]
+- targets: [ '{{ (target.exporter_hostname == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.exporter_hostname].prometheus_scrape_endpoint) }}' ]
labels:
instance: '{{ target.instance }}'
__param_ups: '{{ target.config.ups }}'
diff --git a/roles/monitoring/prometheus/server/templates/targets/ssl/probe.yml.j2 b/roles/monitoring/prometheus/server/templates/targets/ssl/probe.yml.j2
index 4e336873..47e6dceb 100644
--- a/roles/monitoring/prometheus/server/templates/targets/ssl/probe.yml.j2
+++ b/roles/monitoring/prometheus/server/templates/targets/ssl/probe.yml.j2
@@ -1,4 +1,4 @@
-- targets: [ '{{ hostvars[target.exporter_hostname].prometheus_scrape_endpoint }}' ]
+- targets: [ '{{ (target.exporter_hostname == prometheus_server) | ternary('127.0.0.1:9999', hostvars[target.exporter_hostname].prometheus_scrape_endpoint) }}' ]
labels:
instance: '{{ target.instance }}'
__param_target: '{{ target.config.target }}'