This repository has been archived by the owner on Sep 2, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
155 lines (155 loc) · 4.09 KB
/
docker-compose.yml
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
version: '3.6'
networks:
mon:
driver: overlay
attachable: true
labels:
- "mon=true"
- "cadvisor=true"
- "grafana=true"
- "node-exporter=true"
- "blackbox-exporter=true"
- "prometheus=true"
configs:
alertmanager_config:
file: ./configs/alertmanager.yml
blackbox_config:
file: ./configs/blackbox.yml
grafana_datasource:
file: ./configs/datasources/prometheus.yml
grafana_dashboard_yml:
file: ./configs/dashboards/all.yml
grafana_dashboard:
file: ./configs/dashboards/monitoring.json
prometheus_config:
file: ./configs/prometheus.yml
prometheus_rules:
file: ./configs/alert.rules.yml
volumes:
grafana:
driver: local
name: grafana
alertmanager:
driver: local
name: alertmanager
prometheus:
driver: local
name: prometheus
services:
cadvisor:
image: google/cadvisor:latest
command: '-logtostderr -docker_only -prometheus_endpoint=/metrics'
hostname: '{{.Node.ID}}'
networks:
- mon
volumes:
- /var/run:/var/run:rw
- /:/rootfs:ro
- /sys:/sys:ro
- /dev/disk/:/dev/disk:ro
deploy:
mode: global
resources:
limits:
memory: 80M
prometheus:
image: prom/prometheus:latest
command: '--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.retention=30d --storage.tsdb.path=/prometheus --web.enable-admin-api'
hostname: '{{.Node.ID}}'
ports:
- 9090:9090
configs:
- source: prometheus_config
target: /etc/prometheus/prometheus.yml
- source: prometheus_rules
target: /etc/prometheus/alert.rules.yml
networks:
- mon
volumes:
- /var/run:/var/run:rw
- prometheus:/prometheus
deploy:
mode: global
placement:
constraints:
- 'node.role == manager'
- 'node.platform.os == linux'
node-exporter:
image: prom/node-exporter
command: '--path.procfs=/host/proc --path.sysfs=/host/sys --collector.filesystem.ignored-mount-points="^(/rootfs|/host|)/(sys|proc|dev|host|etc)($$|/)" --collector.filesystem.ignored-fs-types="^(sys|proc|auto|cgroup|devpts|ns|au|fuse\.lxc|mqueue)(fs|)$$"'
hostname: '{{.Node.ID}}'
volumes:
- /var/run:/var/run:rw
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
deploy:
mode: global
environment:
HOST_HOSTNAME: /etc/hostname
networks:
- mon
blackbox-exporter:
image: prom/blackbox-exporter
command: '--config.file=/etc/prometheus/blackbox.yml'
hostname: '{{.Node.ID}}'
configs:
- source: blackbox_config
target: /etc/prometheus/blackbox.yml
networks:
- mon
alertmanager:
image: prom/alertmanager
hostname: '{{.Node.ID}}'
ports:
- 9093:9093
configs:
- source: alertmanager_config
target: /etc/prometheus/alertmanager.yml
depends_on:
- cadvisor
- prometheus
environment:
no_proxy: "prometheus"
command: '--config.file=/etc/prometheus/alertmanager.yml --storage.path=/alertmanager'
volumes:
- alertmanager:/alertmanager
networks:
- mon
deploy:
replicas: 1
placement:
constraints:
- 'node.role == manager'
- 'node.platform.os == linux'
grafana:
build:
context: .
dockerfile: Dockerfile.grafana
image: grafana/grafana
hostname: '{{.Node.ID}}'
ports:
- 3000:3000
configs:
- source: grafana_datasource
target: /etc/grafana/provisioning/datasources/prometheus.yml
- source: grafana_dashboard_yml
target: /etc/grafana/provisioning/dashboards/all.yml
- source: grafana_dashboard
target: /var/lib/grafana/dashboards/monitoring.json
volumes:
- grafana:/var/lib/grafana:rw
depends_on:
- cadvisor
- prometheus
environment:
- GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
deploy:
replicas: 1
placement:
constraints:
- 'node.role == manager'
networks:
- mon