一、部署docker
本文第一步有部署docker步骤
二、部署docker-compose
本文第二步有部署docker-compose步骤
三、部署Zabbix Server 6.0
- 创建父目录
mkdir /zabbix-server
- 创建容器映射文件夹
cd /zabbix-server
mkdir -p ./mysql/data
#映射数据库数据目录
mkdir -p ./mysql/conf
#映射数据库配置文件
mkdir -p ./mysql/logs
#映射数据库日志文件
mkdir -p ./font
mkdir -p ./snmptraps
mkdir -p ./mibs
mkdir -p ./alertscripts
mkdir -p ./externalscripts
- 拉取镜像
docker pull mysql:8.0
docker pull zabbix/zabbix-java-gateway:6.0-centos-latest
docker pull zabbix/zabbix-snmptraps:6.0-centos-latest
docker pull zabbix/zabbix-server-mysql:6.0-centos-latest
docker pull zabbix/zabbix-web-nginx-mysql:6.0-centos-latest
- 上传.ttf文件解决乱码问题
将windows的simfang.ttf上传至./font
路径C:\Windows\Fonts\simfang.ttf
- 编辑docker-compose.yml文件部署容器堆栈
vim ./docker-compose.yml
---
version: '3'
services:
mysql:
image: mysql:8.0
container_name: mysql
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/conf:/etc/mysql/conf.d
- ./mysql/logs:/var/log/mysql
- /etc/localtime:/etc/localtime
restart: always
privileged: true
environment:
- MYSQL_ROOT_PASSWORD=myrootpass
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=mypass
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
expose:
- "3306"
networks:
zabbix-net:
command: --character-set-server=utf8 --collation-server=utf8_bin
zabbix-gateway:
image: zabbix/zabbix-java-gateway:6.0-centos-latest
container_name: zabbix-gateway
volumes:
- /etc/localtime:/etc/localtime
restart: always
privileged: true
ports:
- "10052:10052"
networks:
zabbix-net:
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:6.0-centos-latest
container_name: zabbix-snmptraps
volumes:
- /etc/localtime:/etc/localtime
- ./snmptraps:/var/lib/zabbix/snmptraps
- ./mibs:/var/lib/zabbix/mibs
restart: always
privileged: true
ports:
- "1162:1162/udp"
networks:
zabbix-net:
zabbix-server:
image: zabbix/zabbix-server-mysql:6.0-centos-latest
container_name: zabbix-server
volumes:
- /etc/localtime:/etc/localtime
- ./snmptraps:/var/lib/zabbix/snmptraps
- ./mibs:/var/lib/zabbix/mibs
- ./alertscripts:/usr/lib/zabbix/alertscripts
- ./externalscripts:/usr/lib/zabbix/externalscripts
restart: always
privileged: true
environment:
- ZBX_LISTENPORT=10051
- DB_SERVER_HOST=mysql
- DB_SERVER_PORT=3306
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=mypass
- MYSQL_ROOT_PASSWORD=myrootpass
- ZBX_CACHESIZE=1G
- ZBX_HISTORYCACHESIZE=512M
- ZBX_HISTORYINDEXCACHESIZE=16M
- ZBX_TRENDCACHESIZE=256M
- ZBX_VALUECACHESIZE=256M
- ZBX_STARTPINGERS=64
- ZBX_IPMIPOLLERS=1
- ZBX_ENABLE_SNMP_TRAPS=true
- ZBX_STARTTRAPPERS=1
- ZBX_JAVAGATEWAY_ENABLE=true
- ZBX_JAVAGATEWAY=zabbix-gateway
- ZBX_STARTJAVAPOLLERS=1
ports:
- "10051:10051"
networks:
zabbix-net:
links:
- mysql
- zabbix-gateway
zabbix-web:
image: zabbix/zabbix-web-nginx-mysql:6.0-centos-latest
container_name: zabbix-web
volumes:
- ./font/simfang.ttf:/usr/share/zabbix/assets/fonts/DejaVuSans.ttf
- /etc/localtime:/etc/localtime
restart: always
privileged: true
environment:
- ZBX_SERVER_NAME=Zabbix 6.0
- ZBX_SERVER_HOST=zabbix-server
- ZBX_SERVER_PORT=10051
- DB_SERVER_HOST=mysql
- DB_SERVER_PORT=3306
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=mypass
- MYSQL_ROOT_PASSWORD=myrootpass
- PHP_TZ=Asia/Shanghai
ports:
- "80:8080"
networks:
zabbix-net:
links:
- mysql
- zabbix-server
networks:
zabbix-net:
driver: bridge
ipam:
config:
- subnet: 10.10.10.0/24
gateway: 10.10.10.1
- 启动Zabbix Server容器堆栈
docker-compose up -d
- 查看容器堆栈启动状态
docker-compose ps
- 查看启动日志
docker-compose logs
# 查看所有日志
docker-compose logs [container_name]
# 查看单个容器的日志
四、浏览器访问Zabbix
url栏输入http://ip
/文章来源:https://www.toymoban.com/news/detail-406911.html
初始Username [Admin]
初始Password [zabbix]
文章来源地址https://www.toymoban.com/news/detail-406911.html
到了这里,关于docker-compose部署zabbix6.0的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!