[prometheus] Replace targets deployment by a service
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>ntpsec
parent
9e4d157743
commit
e21dbc7781
|
@ -1,6 +1,20 @@
|
||||||
---
|
---
|
||||||
glob_prometheus: {}
|
glob_prometheus: {}
|
||||||
|
|
||||||
|
glob_service_prometheus_target:
|
||||||
|
git:
|
||||||
|
remote: https://gitlab.adm.crans.org/nounous/prometheus-target.git
|
||||||
|
version: main
|
||||||
|
name: prometheus-target
|
||||||
|
install_dir: /var/local/services/prometheus-target
|
||||||
|
generated: false
|
||||||
|
cron:
|
||||||
|
frequency: "*/10 * * * *"
|
||||||
|
options: ""
|
||||||
|
config:
|
||||||
|
ldap:
|
||||||
|
server: "ldaps://{{ query('ldap', 'ip', 'tealc', 'adm') | ansible.utils.ipv4 | first }}"
|
||||||
|
|
||||||
glob_ninjabot:
|
glob_ninjabot:
|
||||||
config:
|
config:
|
||||||
nick: fyre
|
nick: fyre
|
||||||
|
|
|
@ -5,8 +5,6 @@ interfaces:
|
||||||
|
|
||||||
loc_prometheus:
|
loc_prometheus:
|
||||||
node:
|
node:
|
||||||
file: targets_node.json
|
|
||||||
targets: "{{ groups['server'] | select('match', '^.*\\.adm\\.crans\\.org$') | list | sort }}"
|
|
||||||
config:
|
config:
|
||||||
- job_name: servers
|
- job_name: servers
|
||||||
file_sd_configs:
|
file_sd_configs:
|
||||||
|
@ -22,8 +20,6 @@ loc_prometheus:
|
||||||
replacement: '$1:9100'
|
replacement: '$1:9100'
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
file: targets_nginx.json
|
|
||||||
targets: "{{ groups['nginx'] | select('match', '^.*\\.adm\\.crans\\.org$') | list | sort }}"
|
|
||||||
config:
|
config:
|
||||||
- job_name: nginx
|
- job_name: nginx
|
||||||
file_sd_configs:
|
file_sd_configs:
|
||||||
|
@ -77,11 +73,6 @@ loc_prometheus:
|
||||||
replacement: 127.0.0.1:9115
|
replacement: 127.0.0.1:9115
|
||||||
|
|
||||||
blackbox_icmp:
|
blackbox_icmp:
|
||||||
file: targets_icmp.json
|
|
||||||
targets:
|
|
||||||
- karst.adm.crans.org
|
|
||||||
- horst.adm.crans.org
|
|
||||||
- rodney.adm.crans.org
|
|
||||||
config:
|
config:
|
||||||
- job_name: blackbox_icmp
|
- job_name: blackbox_icmp
|
||||||
file_sd_configs:
|
file_sd_configs:
|
||||||
|
@ -99,8 +90,6 @@ loc_prometheus:
|
||||||
replacement: 127.0.0.1:9115
|
replacement: 127.0.0.1:9115
|
||||||
|
|
||||||
bird:
|
bird:
|
||||||
file: targets_bird.json
|
|
||||||
targets: "{{ groups['bird'] | select('match', '^.*\\.adm\\.crans\\.org$') | list | sort }}"
|
|
||||||
config:
|
config:
|
||||||
- job_name: bird
|
- job_name: bird
|
||||||
file_sd_configs:
|
file_sd_configs:
|
||||||
|
@ -116,23 +105,21 @@ loc_prometheus:
|
||||||
replacement: '$1:9324'
|
replacement: '$1:9324'
|
||||||
|
|
||||||
mtail:
|
mtail:
|
||||||
file: targets_mtail.json
|
|
||||||
targets:
|
|
||||||
- tealc.adm.crans.org
|
|
||||||
config:
|
config:
|
||||||
- job_name: mtail
|
- job_name: mtail
|
||||||
static_configs:
|
file_sd_configs:
|
||||||
- targets: ["tealc.adm.crans.org"]
|
- files:
|
||||||
|
- '/etc/prometheus/targets_mtail.json'
|
||||||
relabel_configs:
|
relabel_configs:
|
||||||
- source_labels: [__address__]
|
- source_labels: [__address__]
|
||||||
|
target_label: __param_target
|
||||||
|
- source_labels: [__param_target]
|
||||||
target_label: instance
|
target_label: instance
|
||||||
- source_labels: [instance]
|
- source_labels: [__param_target]
|
||||||
target_label: __address__
|
target_label: __address__
|
||||||
replacement: '$1:3903'
|
replacement: '$1:3903'
|
||||||
|
|
||||||
ilo_snmp:
|
ilo_snmp:
|
||||||
file: targets_ilo_snmp.json
|
|
||||||
targets: "{{ groups['ilo_snmp'] | select('match', '^.*\\.adm\\.crans\\.org$') | list | sort }}"
|
|
||||||
config:
|
config:
|
||||||
- job_name: ilo_snmp
|
- job_name: ilo_snmp
|
||||||
file_sd_configs:
|
file_sd_configs:
|
||||||
|
@ -151,9 +138,6 @@ loc_prometheus:
|
||||||
target_label: __address__
|
target_label: __address__
|
||||||
|
|
||||||
ups_snmp:
|
ups_snmp:
|
||||||
file: targets_ups_snmp.json
|
|
||||||
targets:
|
|
||||||
- excalibur.adm.crans.org
|
|
||||||
config:
|
config:
|
||||||
- job_name: ups_snmp
|
- job_name: ups_snmp
|
||||||
file_sd_configs:
|
file_sd_configs:
|
||||||
|
@ -174,8 +158,6 @@ loc_prometheus:
|
||||||
target_label: __address__
|
target_label: __address__
|
||||||
|
|
||||||
printer_snmp:
|
printer_snmp:
|
||||||
file: targets_printer.json
|
|
||||||
targets: ["printer.lp.crans.org"]
|
|
||||||
config:
|
config:
|
||||||
- job_name: printer_snmp
|
- job_name: printer_snmp
|
||||||
static_configs:
|
static_configs:
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
- hosts: prometheus
|
- hosts: prometheus
|
||||||
vars:
|
vars:
|
||||||
prometheus: "{{ glob_prometheus | default({}) | combine(loc_prometheus | default({})) }}"
|
prometheus: "{{ glob_prometheus | default({}) | combine(loc_prometheus | default({})) }}"
|
||||||
|
service: "{{ glob_service_prometheus_target | default({}) | combine(loc_service_prometheus_target | default({})) }}"
|
||||||
roles:
|
roles:
|
||||||
- prometheus
|
- prometheus
|
||||||
|
- service
|
||||||
|
|
||||||
- hosts: prometheus_alertmanager
|
- hosts: prometheus_alertmanager
|
||||||
vars:
|
vars:
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
dest: /etc/prometheus/{{ item.value.file }}
|
dest: /etc/prometheus/{{ item.value.file }}
|
||||||
mode: 0644
|
mode: 0644
|
||||||
loop: "{{ prometheus | dict2items }}"
|
loop: "{{ prometheus | dict2items }}"
|
||||||
|
when: "item.value.file is defined"
|
||||||
|
|
||||||
- name: Activate prometheus service
|
- name: Activate prometheus service
|
||||||
systemd:
|
systemd:
|
||||||
|
|
Loading…
Reference in New Issue