forked from zabbix/zabbix-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose_zabbix_components.yaml
589 lines (573 loc) · 14.3 KB
/
compose_zabbix_components.yaml
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
services:
server:
init: true
ports:
- name: zabbix-trapper
target: 10051
published: "${ZABBIX_SERVER_PORT}"
protocol: tcp
app_protocol: zabbix-trapper
restart: "${RESTART_POLICY}"
attach: true
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
- ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/export:/var/lib/zabbix/export:rw
- ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- snmptraps:/var/lib/zabbix/snmptraps:roz
tmpfs: /tmp
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
deploy:
resources:
limits:
cpus: '0.70'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
env_file:
- ${ENV_VARS_DIRECTORY}/.env_srv
- path: ${ENV_VARS_DIRECTORY}/.env_srv_override
required: false
networks:
database:
aliases:
- zabbix-server
backend:
aliases:
- zabbix-server
frontend:
tools_frontend:
# devices:
# - "/dev/ttyUSB0:/dev/ttyUSB0"
stop_grace_period: 30s
# cap_add:
# - "NET_RAW"
sysctls:
- net.ipv4.ip_local_port_range=1024 64999
- net.ipv4.conf.all.accept_redirects=0
- net.ipv4.conf.all.secure_redirects=0
- net.ipv4.conf.all.send_redirects=0
# - net.ipv4.ping_group_range=0 1995
labels:
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "zabbix-server"
server-mysql:
extends:
service: server
# volumes:
# - dbsocket:/var/run/mysqld/
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
# - client-key.pem
# - client-cert.pem
# - root-ca.pem
networks:
backend:
aliases:
- zabbix-server-mysql
labels:
com.zabbix.description: "Zabbix server with MySQL database support"
com.zabbix.dbtype: "mysql"
server-pgsql:
extends:
service: server
# volumes:
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
secrets:
- POSTGRES_USER
- POSTGRES_PASSWORD
networks:
backend:
aliases:
- zabbix-server-pgsql
labels:
com.zabbix.description: "Zabbix server with PostgreSQL database support"
com.zabbix.dbtype: "pgsql"
proxy:
init: true
profiles:
- all
restart: "${RESTART_POLICY}"
attach: false
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- snmptraps:/var/lib/zabbix/snmptraps:ro
tmpfs: /tmp
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
deploy:
resources:
limits:
cpus: '0.70'
memory: 512M
reservations:
cpus: '0.3'
memory: 256M
env_file:
- ${ENV_VARS_DIRECTORY}/.env_prx
networks:
backend:
frontend:
tools_frontend:
stop_grace_period: 30s
# cap_add:
# - "NET_RAW"
sysctls:
- net.ipv4.ip_local_port_range=1024 64999
- net.ipv4.conf.all.accept_redirects=0
- net.ipv4.conf.all.secure_redirects=0
- net.ipv4.conf.all.send_redirects=0
# - net.ipv4.ping_group_range=0 1995
labels:
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "zabbix-proxy"
proxy-sqlite3:
extends:
service: proxy
ports:
- name: zabbix-trapper
target: 10051
published: "${ZABBIX_PROXY_SQLITE3_PORT}"
protocol: tcp
app_protocol: zabbix-trapper
env_file:
- ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3
- path: ${ENV_VARS_DIRECTORY}/.env_prx_sqlite3_override
required: false
networks:
backend:
aliases:
- zabbix-proxy-sqlite3
labels:
com.zabbix.description: "Zabbix proxy with SQLite3 database support"
com.zabbix.dbtype: "sqlite3"
proxy-mysql:
extends:
service: proxy
ports:
- name: zabbix-trapper
target: 10051
published: "${ZABBIX_PROXY_MYSQL_PORT}"
protocol: tcp
app_protocol: zabbix-trapper
# volumes:
# - dbsocket:/var/run/mysqld/
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy
- ${ENV_VARS_DIRECTORY}/.env_prx_mysql
- path: ${ENV_VARS_DIRECTORY}/.env_prx_mysql_override
required: false
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
# - client-key.pem
# - client-cert.pem
# - root-ca.pem
networks:
database:
aliases:
- zabbix-proxy-mysql
backend:
aliases:
- zabbix-proxy-mysql
labels:
com.zabbix.description: "Zabbix proxy with MySQL database support"
com.zabbix.dbtype: "mysql"
web-apache:
profiles:
- all
ports:
- name: web-http
target: 8080
published: "${ZABBIX_WEB_APACHE_HTTP_PORT}"
protocol: tcp
app_protocol: http
- name: web-https
target: 8443
published: "${ZABBIX_WEB_APACHE_HTTPS_PORT}"
protocol: tcp
app_protocol: https
restart: "${RESTART_POLICY}"
attach: false
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/etc/ssl/apache2:/etc/ssl/apache2:ro
- ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
tmpfs: /tmp
deploy:
resources:
limits:
cpus: '0.70'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
env_file:
- ${ENV_VARS_DIRECTORY}/.env_web
- path: ${ENV_VARS_DIRECTORY}/.env_web_override
required: false
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
networks:
database:
backend:
frontend:
stop_grace_period: 10s
sysctls:
- net.core.somaxconn=65535
labels:
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "zabbix-frontend"
com.zabbix.webserver: "apache2"
web-apache-mysql:
extends:
service: web-apache
# volumes:
# - dbsocket:/var/run/mysqld/
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
# - client-key.pem
# - client-cert.pem
# - root-ca.pem
labels:
com.zabbix.description: "Zabbix frontend on Apache web-server with MySQL database support"
com.zabbix.dbtype: "mysql"
web-apache-pgsql:
extends:
service: web-apache
# volumes:
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
secrets:
- POSTGRES_USER
- POSTGRES_PASSWORD
networks:
backend:
aliases:
- zabbix-web-apache-pgsql
labels:
com.zabbix.description: "Zabbix frontend on Apache web-server with PostgreSQL database support"
com.zabbix.dbtype: "pgsql"
web-nginx:
ports:
- name: web-http
target: 8080
published: "${ZABBIX_WEB_NGINX_HTTP_PORT}"
protocol: tcp
app_protocol: http
- name: web-https
target: 8443
published: "${ZABBIX_WEB_NGINX_HTTPS_PORT}"
protocol: tcp
app_protocol: https
restart: "${RESTART_POLICY}"
attach: false
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/etc/ssl/nginx:/etc/ssl/nginx:ro
- ${DATA_DIRECTORY}/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
tmpfs: /tmp
deploy:
resources:
limits:
cpus: '0.70'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
env_file:
- ${ENV_VARS_DIRECTORY}/.env_web
- path: ${ENV_VARS_DIRECTORY}/.env_web_override
required: false
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
networks:
database:
backend:
frontend:
stop_grace_period: 10s
sysctls:
- net.core.somaxconn=65535
labels:
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "zabbix-frontend"
com.zabbix.webserver: "nginx"
web-nginx-mysql:
extends:
service: web-nginx
# volumes:
# - dbsocket:/var/run/mysqld/
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
secrets:
- MYSQL_USER
- MYSQL_PASSWORD
# - client-key.pem
# - client-cert.pem
# - root-ca.pem
networks:
backend:
aliases:
- zabbix-web-nginx-mysql
labels:
com.zabbix.description: "Zabbix frontend on Nginx web-server with MySQL database support"
com.zabbix.dbtype: "mysql"
web-nginx-pgsql:
extends:
service: web-nginx
# volumes:
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
env_file:
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
secrets:
- POSTGRES_USER
- POSTGRES_PASSWORD
networks:
backend:
aliases:
- zabbix-web-nginx-pgsql
labels:
com.zabbix.description: "Zabbix frontend on Nginx web-server with PostgreSQL database support"
com.zabbix.dbtype: "pgsql"
agent:
init: true
profiles:
- full
- all
ports:
- name: zabbix-agent
target: 10050
published: "${ZABBIX_AGENT_PORT}"
protocol: tcp
app_protocol: zabbix-agent
restart: "${RESTART_POLICY}"
attach: false
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
tmpfs: /tmp
deploy:
resources:
limits:
cpus: '0.2'
memory: 128M
reservations:
cpus: '0.1'
memory: 64M
mode: global
env_file:
- ${ENV_VARS_DIRECTORY}/.env_agent
- path: ${ENV_VARS_DIRECTORY}/.env_agent_override
required: false
privileged: true
pid: "host"
networks:
backend:
aliases:
- zabbix-agent
- zabbix-agent-passive
stop_grace_period: 5s
labels:
com.zabbix.description: "Zabbix agent"
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "zabbix-agentd"
agent2:
init: true
profiles:
- full
- all
ports:
- name: zabbix-agent
target: 10050
published: "${ZABBIX_AGENT2_PORT}"
protocol: tcp
app_protocol: zabbix-agent
restart: "${RESTART_POLICY}"
attach: false
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DATA_DIRECTORY}/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ${DATA_DIRECTORY}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
tmpfs: /tmp
deploy:
resources:
limits:
cpus: '0.2'
memory: 128M
reservations:
cpus: '0.1'
memory: 64M
mode: global
env_file:
- ${ENV_VARS_DIRECTORY}/.env_agent
- path: ${ENV_VARS_DIRECTORY}/.env_agent_override
required: false
privileged: true
pid: "host"
networks:
backend:
aliases:
- zabbix-agent
- zabbix-agent-passive
stop_grace_period: 5s
labels:
com.zabbix.description: "Zabbix agent 2"
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "zabbix-agent2"
java-gateway:
profiles:
- full
- all
ports:
- name: zabbix-java-gw
target: 10052
published: "${ZABBIX_JAVA_GATEWAY_PORT}"
protocol: tcp
restart: "${RESTART_POLICY}"
attach: false
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
env_file:
- ${ENV_VARS_DIRECTORY}/.env_java
- path: ${ENV_VARS_DIRECTORY}/.env_java_override
required: false
networks:
backend:
aliases:
- zabbix-java-gateway
frontend:
stop_grace_period: 5s
labels:
com.zabbix.description: "Zabbix Java Gateway"
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "java-gateway"
snmptraps:
# Override snmptrapd command arguments to receive SNMP traps by DNS
# It must be done with ZBX_SNMP_TRAP_USE_DNS=true environment variable
# command: /usr/sbin/snmptrapd -t -X -C -c /etc/snmp/snmptrapd.conf -Lo -A --doNotFork=yes --agentuser=zabbix --agentgroup=zabbix
profiles:
- full
- all
ports:
- name: snmptrap
target: 1162
published: "${ZABBIX_SNMPTRAPS_PORT}"
protocol: udp
app_protocol: snmptrap
restart: "${RESTART_POLICY}"
attach: false
read_only: true
volumes:
- snmptraps:/var/lib/zabbix/snmptraps:rwz
tmpfs: /tmp
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.25'
memory: 128M
env_file:
- ${ENV_VARS_DIRECTORY}/.env_snmptraps
- path: ${ENV_VARS_DIRECTORY}/.env_snmptraps_override
required: false
networks:
frontend:
aliases:
- zabbix-snmptraps
backend:
stop_grace_period: 5s
labels:
com.zabbix.description: "Zabbix snmptraps"
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "snmptraps"
web-service:
profiles:
- full
- all
ports:
- name: zabbix-web-service
target: 10053
published: "${ZABBIX_WEB_SERVICE_PORT}"
protocol: tcp
restart: "${RESTART_POLICY}"
attach: false
volumes:
- ${DATA_DIRECTORY}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
tmpfs: /tmp
security_opt:
- seccomp:${ENV_VARS_DIRECTORY}/chrome_dp.json
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
env_file:
- ${ENV_VARS_DIRECTORY}/.env_web_service
- path: ${ENV_VARS_DIRECTORY}/.env_web_service_override
required: false
networks:
backend:
aliases:
- zabbix-web-service
stop_grace_period: 5s
labels:
com.zabbix.description: "Zabbix web service"
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "web-service"