docker安装zabbix 20240803
宿主机IP:192.168.177.128
1、下载数据库:
docker pull mysql:5.7
2、下载支持数据库的zabbix :
docker pull zabbix/zabbix-server-mysql:centos-latest
3、下载web容器:
docker pull zabbix/zabbix-web-nginx-mysql:latest
4、下载java 监控:
docker pull zabbix/zabbix-java-gateway:latest
5、创建自定义zabbix网络:
docker network create --driver bridge --subnet 10.113.0.0/24 --gateway 10.113.0.1 zabbix-net
6、运行数据库镜像,启动容器:
docker run -dit -p 3306:3306 --name zabbix-mysql --network zabbix-net --restart always -v /etc/localtime:/etc/localtime -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix-pwd" -e MYSQL_ROOT_PASSWORD="root-pwd" mysql:5.7
7、运行java监控:
docker run -v /etc/localtime:/etc/localtime -dit --restart=always --name=zabbix-java-gateway --network zabbix-net zabbix/zabbix-java-gateway:latest
8、创建数据:
docker volume create zabbix-server-vol
9、运行zabbix-server:
docker run -dit -p 10051:10051 --mount source=zabbix-server-vol,target=/etc/zabbix -v /etc/localtime:/etc/localtime -v /usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts --name=zabbix-server-mysql --restart=always --network zabbix-net -e DB_SERVER_HOST="zabbix-mysql" -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix-pwd" -e MYSQL_ROOT_PASSWORD="root-pwd" -e ZBX_JAVAGATEWAY="zabbix-java-gateway" zabbix/zabbix-server-mysql:centos-latest
10、运行web镜像启动容器:
docker run -dit -p 80:80 -p 9001:8080 -v /etc/localtime:/etc/localtime --name zabbix-web-nginx-mysql --restart=always --network zabbix-net -e DB_SERVER_HOST="zabbix-mysql" -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix-pwd" -e MYSQL_ROOT_PASSWORD="root-pwd" -e ZBX_SERVER_HOST="zabbix-server-mysql" zabbix/zabbix-web-nginx-mysql:latest
容器:主机 -----》8080:9001
宿主机curl 10.113.0.5:8080
zabbix-web-nginx-mysql容器ip 10.113.0.5
宿主机curl localhost:9001
11、查看已经启动的容器:
docker ps
12 192.168.177.128:9001/ 密码 zabbix