Created
June 3, 2020 04:41
-
-
Save 3ng1n33r/428ba64aa9efa5b2261468578c46df61 to your computer and use it in GitHub Desktop.
Zabbix 5.0 docker compose (with mysql database support)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.5' | |
services: | |
zabbix-server: | |
image: zabbix/zabbix-server-mysql:alpine-5.0-latest | |
container_name: zabbix-server | |
ports: | |
- "10051:10051" | |
networks: | |
zabbix_network: | |
ipv4_address: 172.18.0.5 | |
volumes: | |
- /etc/localtime:/etc/localtime:ro | |
# - /etc/timezone:/etc/timezone:ro | |
- ./usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro | |
- ./usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro | |
- ./var/lib/zabbix/export:/var/lib/zabbix/export:rw | |
- ./var/lib/zabbix/modules:/var/lib/zabbix/modules:ro | |
- ./var/lib/zabbix/enc:/var/lib/zabbix/enc:ro | |
- ./var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro | |
- ./var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro | |
- ./var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro | |
links: | |
- mysql-server:mysql-server | |
ulimits: | |
nproc: 65535 | |
nofile: | |
soft: 20000 | |
hard: 40000 | |
deploy: | |
resources: | |
limits: | |
cpus: '0.70' | |
memory: 1G | |
reservations: | |
cpus: '0.5' | |
memory: 512M | |
environment: | |
MYSQL_USER: zabbix | |
MYSQL_PASSWORD: zabbix | |
MYSQL_ROOT_PASSWORD: root_pwd | |
MYSQL_DATABASE: zabbix | |
ZBX_JAVAGATEWAY_ENABLE: 'false' | |
ZBX_ENABLE_SNMP_TRAPS: 'true' | |
depends_on: | |
- mysql-server | |
- zabbix-snmptraps | |
# devices: | |
# - "/dev/ttyUSB0:/dev/ttyUSB0" | |
stop_grace_period: 30s | |
sysctls: | |
- net.ipv4.ip_local_port_range=1024 65000 | |
- net.ipv4.conf.all.accept_redirects=0 | |
- net.ipv4.conf.all.secure_redirects=0 | |
- net.ipv4.conf.all.send_redirects=0 | |
labels: | |
com.zabbix.description: "Zabbix server with MySQL database support" | |
com.zabbix.company: "Zabbix LLC" | |
com.zabbix.component: "zabbix-server" | |
com.zabbix.dbtype: "mysql" | |
com.zabbix.os: "alpine" | |
zabbix-web-nginx-mysql: | |
image: zabbix/zabbix-web-nginx-mysql:alpine-5.0-latest | |
container_name: zabbix-web | |
ports: | |
- "8081:8080" | |
- "8443:8443" | |
networks: | |
zabbix_network: | |
ipv4_address: 172.18.0.6 | |
links: | |
- mysql-server:mysql-server | |
- zabbix-server:zabbix-server | |
volumes: | |
- /etc/localtime:/etc/localtime:ro | |
# - /etc/timezone:/etc/timezone:ro | |
- ./etc/ssl/nginx:/etc/ssl/nginx:ro | |
- ./usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro | |
deploy: | |
resources: | |
limits: | |
cpus: '0.70' | |
memory: 512M | |
reservations: | |
cpus: '0.5' | |
memory: 256M | |
environment: | |
MYSQL_USER: zabbix | |
MYSQL_PASSWORD: zabbix | |
MYSQL_ROOT_PASSWORD: root_pwd | |
MYSQL_DATABASE: zabbix | |
PHP_TZ: Asia/Yekaterinburg | |
depends_on: | |
- mysql-server | |
- zabbix-server | |
healthcheck: | |
test: ["CMD", "curl", "-f", "http://localhost:8080/"] | |
interval: 10s | |
timeout: 5s | |
retries: 3 | |
start_period: 30s | |
stop_grace_period: 10s | |
sysctls: | |
- net.core.somaxconn=65535 | |
labels: | |
com.zabbix.description: "Zabbix frontend on Nginx web-server with MySQL database support" | |
com.zabbix.company: "Zabbix LLC" | |
com.zabbix.component: "zabbix-frontend" | |
com.zabbix.webserver: "nginx" | |
com.zabbix.dbtype: "mysql" | |
com.zabbix.os: "alpine" | |
zabbix-agent: | |
image: zabbix/zabbix-agent:alpine-5.0-latest | |
container_name: zabbix-agent | |
ports: | |
- "10050:10050" | |
networks: | |
zabbix_network: | |
ipv4_address: 172.18.0.2 | |
volumes: | |
- /etc/localtime:/etc/localtime:ro | |
# - /etc/timezone:/etc/timezone:ro | |
- ./etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro | |
- ./var/lib/zabbix/modules:/var/lib/zabbix/modules:ro | |
- ./var/lib/zabbix/enc:/var/lib/zabbix/enc:ro | |
- ./var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro | |
links: | |
- zabbix-server:zabbix-server | |
deploy: | |
resources: | |
limits: | |
cpus: '0.2' | |
memory: 128M | |
reservations: | |
cpus: '0.1' | |
memory: 64M | |
mode: global | |
privileged: true | |
pid: "host" | |
stop_grace_period: 5s | |
labels: | |
com.zabbix.description: "Zabbix agent" | |
com.zabbix.company: "Zabbix LLC" | |
com.zabbix.component: "zabbix-agentd" | |
com.zabbix.os: "alpine" | |
zabbix-snmptraps: | |
image: zabbix/zabbix-snmptraps:alpine-5.0-latest | |
container_name: zabbix-snmptraps | |
ports: | |
- "162:1162/udp" | |
networks: | |
zabbix_network: | |
ipv4_address: 172.18.0.3 | |
volumes: | |
- ./var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:rw | |
deploy: | |
resources: | |
limits: | |
cpus: '0.5' | |
memory: 256M | |
reservations: | |
cpus: '0.25' | |
memory: 128M | |
stop_grace_period: 5s | |
labels: | |
com.zabbix.description: "Zabbix snmptraps" | |
com.zabbix.company: "Zabbix LLC" | |
com.zabbix.component: "snmptraps" | |
com.zabbix.os: "alpine" | |
mysql-server: | |
image: mysql:8.0 | |
container_name: mysql-server | |
ports: | |
- "3306:3306" | |
networks: | |
zabbix_network: | |
ipv4_address: 172.18.0.4 | |
command: [mysqld, --character-set-server=utf8, --collation-server=utf8_bin, --default-authentication-plugin=mysql_native_password] | |
volumes: | |
- ./var/lib/mysql:/var/lib/mysql:rw | |
environment: | |
MYSQL_USER: zabbix | |
MYSQL_PASSWORD: zabbix | |
MYSQL_ROOT_PASSWORD: root_pwd | |
MYSQL_DATABASE: zabbix | |
stop_grace_period: 1m | |
db_data_mysql: | |
image: busybox | |
volumes: | |
- ./var/lib/mysql:/var/lib/mysql:rw | |
networks: | |
zabbix_network: | |
driver: bridge | |
driver_opts: | |
com.docker.network.enable_ipv6: "false" | |
ipam: | |
driver: default | |
config: | |
- subnet: 172.18.0.0/16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment