From a7ee08962fe6276c7217f50e64997cec0f605dc0 Mon Sep 17 00:00:00 2001 From: HgO Date: Wed, 4 Aug 2021 23:26:52 +0200 Subject: [PATCH 1/2] grab certificate metrics from neutrinet.be --- inventories/host_vars/monitoring.htz.neutri.net.yml | 3 +++ roles/probe/defaults/main.yml | 2 ++ roles/probe/templates/telegraf/probe.conf.j2 | 12 ++++++++++++ 3 files changed, 17 insertions(+) diff --git a/inventories/host_vars/monitoring.htz.neutri.net.yml b/inventories/host_vars/monitoring.htz.neutri.net.yml index 0dd4434..b04a7ed 100644 --- a/inventories/host_vars/monitoring.htz.neutri.net.yml +++ b/inventories/host_vars/monitoring.htz.neutri.net.yml @@ -5,3 +5,6 @@ prometheus_federation_hosts: prometheus_telegraf_hosts: - "{{ inventory_hostname }}" - vpn.neutri.net + +probe_http_certs: + - https://neutrinet.be diff --git a/roles/probe/defaults/main.yml b/roles/probe/defaults/main.yml index 1d1e496..b392996 100644 --- a/roles/probe/defaults/main.yml +++ b/roles/probe/defaults/main.yml @@ -5,6 +5,8 @@ probe_http_urls: - name: https://prometheus.example.com url: http://localhost:9090 +probe_http_certs: [] + probe_ping_hosts: - '127.0.0.1' - '::1' diff --git a/roles/probe/templates/telegraf/probe.conf.j2 b/roles/probe/templates/telegraf/probe.conf.j2 index c6626b3..d40a3b0 100644 --- a/roles/probe/templates/telegraf/probe.conf.j2 +++ b/roles/probe/templates/telegraf/probe.conf.j2 @@ -36,3 +36,15 @@ {% endfor %} ] method = "native" + +{% if probe_http_certs | length > 0 %} +[[inputs.x509_cert]] + ## List certificate sources + ## Prefix your entry with 'file://' if you intend to use relative paths + sources = [ +{% for url in probe_http_certs %} + "{{ url }}"{% if not loop.last %},{% endif %} + +{% endfor %} + ] +{% endif %} -- GitLab From be8386e8104ce358facd1e953151b078330b799c Mon Sep 17 00:00:00 2001 From: HgO Date: Wed, 4 Aug 2021 23:41:44 +0200 Subject: [PATCH 2/2] telegraf expect port in cert url --- inventories/host_vars/monitoring.htz.neutri.net.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inventories/host_vars/monitoring.htz.neutri.net.yml b/inventories/host_vars/monitoring.htz.neutri.net.yml index b04a7ed..2e4fa80 100644 --- a/inventories/host_vars/monitoring.htz.neutri.net.yml +++ b/inventories/host_vars/monitoring.htz.neutri.net.yml @@ -7,4 +7,4 @@ prometheus_telegraf_hosts: - vpn.neutri.net probe_http_certs: - - https://neutrinet.be + - https://neutrinet.be:443 -- GitLab