Zabbix 容器版安装
Zabbix 官网:www.zabbix.com/cn/
采用 docker-compose.yml
启动 zabbix
准备字体
zabiix
中文界面存在中文图表文字显示乱码问题,故先准备字体文件到 服务器。
DejaVuSans.ttf字体 Github 地址
点击下载DejaVuSans.ttf字体
yaml 文件
version: "3.8"
services:
mysql-server:
image: mysql:8.0
container_name: mysql-server
restart: always
environment:
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: 123456qaz!@#
MYSQL_ROOT_PASSWORD: 123456qaz!@#
command:
- --character-set-server=utf8
- --collation-server=utf8_bin
- --default-authentication-plugin=mysql_native_password
networks:
- zabbix-net
volumes:
- "/root/zabbix/mysqldata:/var/lib/mysql"
- "/etc/localtime:/etc/localtime"
ports:
- "3306:3306"
zabbix-java-gateway:
image: zabbix/zabbix-java-gateway
container_name: zabbix-java-gateway
volumes:
- "/etc/localtime:/etc/localtime"
ports:
- "10052:10052"
restart: always
networks:
- zabbix-net
zabbix-server-mysql:
image: zabbix/zabbix-server-mysql
container_name: zabbix-server-mysql
networks:
- zabbix-net
restart: always
depends_on:
- mysql-server
environment:
DB_SERVER_HOST: mysql-server
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: 123456qaz!@#
MYSQL_ROOT_PASSWORD: 123456qaz!@#
ZBX_JAVAGATEWAY: zabbix-java-gateway
ZBX_JAVAGATEWAY_ENABLE: "true"
ports:
- "10051:10051"
volumes:
- "/etc/localtime:/etc/localtime"
- "/root/zabbix/alertscripts:/usr/lib/zabbix/alertscripts"
- "/root/zabbix/externalscripts:/usr/lib/zabbix/externalscripts"
links:
- mysql-server:mysql
- zabbix-java-gateway:zabbix-java-gateway
zabbix-web-nginx-mysql:
image: zabbix/zabbix-web-nginx-mysql
container_name: zabbix-web-nginx-mysql
networks:
- zabbix-net
restart: always
depends_on:
- mysql-server
- zabbix-server-mysql
environment:
DB_SERVER_HOST: mysql-server
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: 123456qaz!@#
MYSQL_ROOT_PASSWORD: 123456qaz!@#
ZBX_SERVER_HOST: zabbix-server
PHP_TZ: "Asia/Shanghai"
ports:
- "8080:8080"
volumes:
- "/etc/localtime:/etc/localtime"
# 使用下载好的字体映射到容器中
- "/usr/share/fonts/:/usr/share/zabbix/assets/fonts/"
links:
- mysql-server:mysql
- zabbix-server-mysql:zabbix-server
zabbix-agent:
image: zabbix/zabbix-agent
container_name: zabbix-agent
restart: always
privileged: trueenvironment:
ZBX_HOSTNAME: "Zabbix server"
ZBX_SERVER_HOST: "172.18.0.1"
ZBX_SERVER_PORT: 10051
ports:
- "10050:10050"
volumes:
- "/etc/localtime:/etc/localtime"
networks:
- zabbix-net
networks:
zabbix-net:
ipam:
driver: default
config:
- subnet: "172.18.0.0/16"
启动并访问
docker-compose up -d
注意:应用安装完成后,需要等待5分钟,等应用完成自动配置后,即可通过浏览器访问
http://服务器IP:8080
账号: Admin
密码: zabbix