Repository navigation
Expand file tree
/
Copy pathcompose.monitoring.yaml
More file actions
142 lines (137 loc) · 4.08 KB
/
Copy pathcompose.monitoring.yaml
File metadata and controls
142 lines (137 loc) · 4.08 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
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
services:
prometheus:
image: prom/prometheus:v3.10.0
# dockerswarm_sd reads the mounted socket, which the image's `nobody` user
# cannot open. Scoped to this local/demo stack; in front of a real cluster
# put a socket proxy here instead of granting root.
user: root
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
read_only: true
- type: volume
source: prometheus_data
target: /prometheus
# Without an explicit target the config lands at /prometheus_config and
# Prometheus silently runs its built-in default instead, discovering
# nothing.
configs:
- source: prometheus_config
target: /etc/prometheus/prometheus.yml
# No published port: Cetacean reaches Prometheus over the overlay, and
# Prometheus has no authentication of its own.
networks:
- monitoring
healthcheck:
test: [ "CMD", "wget", "-q", "--spider", "http://localhost:9090" ]
interval: 10s
timeout: 15s
retries: 10
start_period: 40s
deploy:
placement:
constraints:
- node.role == manager
resources:
limits:
cpus: "1.0"
memory: 2G
reservations:
cpus: "0.25"
memory: 512M
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.55.1@sha256:3de2bd5203120b866d74a9b283b2ffb8ec382fbf9dc321814700c6ea6f44ec57
command:
- "--store_container_labels=true"
- "--docker_only=true"
volumes:
- type: bind
source: /
target: /rootfs
read_only: true
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
read_only: true
# cAdvisor's docker factory talks to containerd, not to dockerd, and
# dials /run/containerd/containerd.sock. Docker Engine runs its own
# containerd under /run/docker/containerd, so without this the factory
# fails to register — and with --docker_only that leaves cAdvisor
# reporting the root cgroup and nothing else: no per-container series,
# so no per-service charts and no sizing recommendations. A host whose
# Docker uses a system containerd wants /run/containerd as the source
# instead. The directory is mounted rather than the socket so that a
# host with neither still starts, degraded, rather than failing.
- type: bind
source: /run/docker/containerd
target: /run/containerd
read_only: true
- type: bind
source: /sys
target: /sys
read_only: true
- type: bind
source: /var/lib/docker/
target: /var/lib/docker
read_only: true
networks:
- monitoring
deploy:
mode: global
resources:
limits:
cpus: "0.5"
memory: 256M
reservations:
cpus: "0.1"
memory: 64M
node-exporter:
image: prom/node-exporter:v1.9.0
hostname: "{{.Node.Hostname}}"
volumes:
- type: bind
source: /sys
target: /host/sys
read_only: true
- type: bind
source: /proc
target: /host/proc
read_only: true
- type: bind
source: /
target: /rootfs
read_only: true
command:
- "--path.procfs=/host/proc"
- "--path.sysfs=/host/sys"
- "--path.rootfs=/rootfs"
- "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)"
networks:
- monitoring
healthcheck:
test: [ "CMD", "wget", "-q", "--spider", "http://localhost:9100/metrics" ]
interval: 10s
timeout: 15s
retries: 10
start_period: 40s
deploy:
mode: global
resources:
limits:
cpus: "0.5"
memory: 128M
reservations:
cpus: "0.1"
memory: 32M
networks:
monitoring:
# Named explicitly so the network is `monitoring`, not
# `<stack>_monitoring` — compose.yaml joins it as an external network.
name: monitoring
driver: overlay
volumes:
prometheus_data:
configs:
prometheus_config:
file: ./prometheus.yml