Monitoring of docker containers

This commit is contained in:
pz2891 2021-02-10 19:06:28 +01:00
parent b5dbe2c5c9
commit 4308bedf8f
3 changed files with 13 additions and 0 deletions

View file

@ -101,6 +101,8 @@
prometheus_targets: prometheus_targets:
- targets: | - targets: |
{{ groups['ovh_pve'] + groups['ovh_vm'] | list | sort }} {{ groups['ovh_pve'] + groups['ovh_vm'] | list | sort }}
prometheus_docker_targets:
- targets: docker-ovh.adm.auro.re:8087
roles: roles:
- prometheus - prometheus

View file

@ -64,6 +64,13 @@
mode: 0644 mode: 0644
when: prometheus_ups_snmp_targets is defined when: prometheus_ups_snmp_targets is defined
- name: Configure Prometheus docker monitoring
copy:
content: "{{ [{'targets': prometheus_docker_targets }] | to_nice_json }}\n"
dest: /etc/prometheus/targets_docker.json
mode: 0644
when: prometheus_docker_targets is defined
- name: Activate prometheus service - name: Activate prometheus service
systemd: systemd:
name: prometheus name: prometheus

View file

@ -81,3 +81,7 @@ scrape_configs:
- target_label: __address__ - target_label: __address__
replacement: 127.0.0.1:9116 replacement: 127.0.0.1:9116
- job_name: docker
file_sd_configs:
- files:
- '/etc/prometheus/targets_docker.json'