ansible-debops-infrastructure

DebOps and Ansible scripts to manage my infrastructure
git clone git://git.erethon.com/ansible-debops-infrastructure
Log | Files | Refs

commit 5991413223cde357d6662515d97ef68d7b135c48
parent 23e288aba40ce1c729ec0325030aff70e860569e
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Thu, 20 Oct 2022 00:56:52 +0300

prometheus: Add libvirt and blackbox icmp config

Diffstat:
ansible/inventory/host_vars/productiongrafana/prometheus.yml | 4++++
ansible/roles/prometheus/templates/prometheus.yml.j2 | 30++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/ansible/inventory/host_vars/productiongrafana/prometheus.yml b/ansible/inventory/host_vars/productiongrafana/prometheus.yml @@ -14,3 +14,7 @@ prometheus__postgres_targets: ['pgmatrix.int.erethon.com'] prometheus__synapse_target: 'matrix.int.erethon.com' prometheus__apcupsd_target: 'thor.int.erethon.com' prometheus__dht_target: 'rpi.int.erethon.com' +prometheus__libvirt_targets: ['oricono.int.erethon.com'] +prometheus__icmp_targets: ['1.1.1.1', '8.8.8.8', 'erethon.com', + 'mail.erethon.com', 'brighty.erethon.com', '192.168.2.1'] +prometheus__icmp_replacement: 'thor.int.erethon.com:9115' diff --git a/ansible/roles/prometheus/templates/prometheus.yml.j2 b/ansible/roles/prometheus/templates/prometheus.yml.j2 @@ -80,3 +80,32 @@ scrape_configs: static_configs: - targets: ['{{ prometheus__dht_target }}:9222'] {% endif %} + +{% if prometheus__libvirt_targets is defined %} + - job_name: 'libvirt_exporter' + metrics_path: '/metrics' + static_configs: + - targets: +{% for target in prometheus__libvirt_targets %} + - '{{ target }}:9177' +{% endfor %} +{% endif %} + +{% if prometheus__icmp_targets is defined %} + - job_name: 'blackbox_icmp' + metrics_path: /probe + params: + module: [icmp] + static_configs: + - targets: +{% for target in prometheus__icmp_targets %} + - {{ target }} +{% endfor %} + relabel_configs: + - source_labels: [__address__] + target_label: __param_target + - source_labels: [__param_target] + target_label: instance + - target_label: __address__ + replacement: '{{ prometheus__icmp_replacement }}' +{% endif %}+ \ No newline at end of file