-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexporter.yml
More file actions
104 lines (98 loc) · 3.83 KB
/
exporter.yml
File metadata and controls
104 lines (98 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
- name: Deploy monitoring exporters
hosts: all
gather_facts: true
environment:
PATH: "{{ ansible_env.HOME }}/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/sbin:/bin:{{ ansible_env.PATH }}"
vars_files:
- vars.yml
tasks:
- name: Create monitoring network
community.docker.docker_network:
name: "{{ item.name }}"
state: present
driver: "{{ item.driver }}"
loop: "{{ docker_networks }}"
delegate_to: "{{ groups['all'][0] }}"
- name: Pull exporter images
community.docker.docker_container:
name: "{{ item.image }}"
pull: missing
loop: "{{ exporters }}"
- name: Deploy node-exporter
community.docker.docker_container:
name: "node-exporter"
image: "{{ exporters.node.image }}"
state: started
restart_policy: unless-stopped
networks:
- name: "{{ docker_networks[0].name }}"
published_ports:
- "{{ exporters.node.port }}:{{ exporters.node.port }}"
volumes:
- "/proc:/host/proc:ro"
- "/sys:/host/sys:ro"
- "/:/rootfs:ro"
command:
- "--path.procfs=/host/proc"
- "--path.sysfs=/host/sys"
- "--path.rootfs=/rootfs"
- "--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)"
when: "'node' in exporters"
- name: Deploy mongodb exporter
community.docker.docker_container:
name: "mongodb-exporter-{{ item.name }}"
image: "{{ exporters.mongodb.image }}"
state: started
restart_policy: unless-stopped
networks:
- name: "{{ docker_networks[0].name }}"
published_ports:
- "{{ exporters.mongodb.port }}:{{ exporters.mongodb.port }}"
command: "--mongodb.uri=mongodb://{{ item.ip }}:{{ item.port }}/"
when: "'mongodb' in active_exporters"
loop: "{{ service_hosts | selectattr('service', 'equalto', 'mongodb') | list }}"
- name: Deploy redis exporter
community.docker.docker_container:
name: "redis-exporter-{{ item.name }}"
image: "{{ exporters.redis.image }}"
state: started
restart_policy: unless-stopped
networks:
- name: "{{ docker_networks[0].name }}"
published_ports:
- "{{ exporters.redis.port }}:{{ exporters.redis.port }}"
command: "--redis.addr=redis://{{ item.ip }}:{{ item.port }}"
when: "'redis' in active_exporters"
loop: "{{ service_hosts | selectattr('service', 'equalto', 'redis') | list }}"
- name: Deploy elasticsearch exporter
community.docker.docker_container:
name: "elasticsearch-exporter-{{ item.name }}"
image: "{{ exporters.elasticsearch.image }}"
state: started
restart_policy: unless-stopped
networks:
- name: "{{ docker_networks[0].name }}"
published_ports:
- "{{ exporters.elasticsearch.port }}:{{ exporters.elasticsearch.port }}"
command: >-
--es.uri=http://{{ item.ip }}:{{ item.port }}
--es.all
--es.indices
--es.indices_settings
--es.cluster_settings
when: "'elasticsearch' in active_exporters"
loop: "{{ service_hosts | selectattr('service', 'equalto', 'elasticsearch') | list }}"
- name: Deploy kafka exporter
community.docker.docker_container:
name: "kafka-exporter-{{ item.name }}"
image: "{{ exporters.kafka.image }}"
state: started
restart_policy: unless-stopped
networks:
- name: "{{ docker_networks[0].name }}"
published_ports:
- "{{ exporters.kafka.port }}:{{ exporters.kafka.port }}"
command: "--kafka.server={{ item.ip }}:{{ item.port }}"
when: "'kafka' in active_exporters"
loop: "{{ service_hosts | selectattr('service', 'equalto', 'kafka') | list }}"