docker-compose 安装部署zabbix
1. 使用docker-compose 安装部署zabbix监控?
要求:
① docker-compose文件在/docker-compose目录下
镜像提供地址:
registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/mysql:8.0.39
registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/zabbix-java-gateway
registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/zabbix-server-mysql
registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/zabbix-web-nginx-mysql
registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/zabbix-agent
创建目录
mkdir /docker-compose
cd /docker-compose
编写配置文件 vim docker-compose.yml
version: '3.8'
networks:
zabbix-net:
driver: bridge
services:
zabbix-server:
image: registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/zabbix-server-mysql
container_name: zabbix-server
ports:
- "10051:10051"
networks:
- zabbix-net
environment:
- DB_SERVER=mysql
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=Aa123456!
- MYSQL_ROOT_PASSWORD=Aa123456!
- DB_SERVER_HOST=mysql
- DB_SERVER_PORT=3306
volumes:
- /etc/localtime:/etc/localtime:ro
depends_on:
- mysql
zabbix-web:
image: registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/zabbix-web-nginx-mysql
container_name: zabbix-web
ports:
- "80:8080"
networks:
- zabbix-net
environment:
- ZBX_SERVER_HOST=zabbix-server
- DB_SERVER=mysql
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=Aa123456!
- MYSQL_ROOT_PASSWORD=Aa123456!
- DB_SERVER_HOST=mysql
- DB_SERVER_PORT=3306
depends_on:
- zabbix-server
mysql:
image: registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/mysql:8.0.39
container_name: mysql
ports:
- "3306:3306"
networks:
- zabbix-net
environment:
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=Aa123456!
- MYSQL_ROOT_PASSWORD=Aa123456!
volumes:
- /docker-compose/mysql/data:/var/lib/mysql
zabbix-java-gateway:
image: registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/zabbix-java-gateway
container_name: zabbix-java-gateway
networks:
- zabbix-net
zabbix-agent:
image: registry.cn-shanghai.aliyuncs.com/aliyun_lqkhn/zabbix-agent
container_name: zabbix-agent
ports:
- "10050:10050"
networks:
- zabbix-net
environment:
- ZBX_SERVER_HOST=zabbix-server
- ZBX_SERVER_PORT=10051
volumes:
- /etc/localtime:/etc/localtime:ro
启动
docker-compose up -d