shell: docker run --name mysql-server -t \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix" \
-e MYSQL_ROOT_PASSWORD="zabbix" \
-d mysql:5.7 \
--character-set-server=utf8 --collation-server=utf8_bin
启动Zabbix server实例,并关联这个实例到已创建的MySQL服务器实例
shell: docker run --name zabbix-server-mysql -t \
-e DB_SERVER_HOST="mysql-server" \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix" \
-e MYSQL_ROOT_PASSWORD="zabbix" \
--link mysql-server:mysql \
-p 10051:10051 \
-d zabbix/zabbix-server-mysql:latest
启动Zabbix web 接口,并将它与MySQL服务器实例和Zabbix server实例关联
shell: docker run --name zabbix-web-nginx-mysql -t \
-e DB_SERVER_HOST="mysql-server" \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix" \
-e MYSQL_ROOT_PASSWORD="zabbix" \
--link mysql-server:mysql \
--link zabbix-server-mysql:zabbix-server \
-p 8080:80 \
-d zabbix/zabbix-web-nginx-mysql:latest
查看容器启动情况
shell: docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4c3380e791e2 zabbix/zabbix-web-nginx-mysql:latest "docker-entrypoint.sh" 25 minutes ago Up 25 minutes 443/tcp, 0.0.0.0:880->80/tcp zabbix-web-nginx-mysql
1256ee8a925d zabbix/zabbix-server-mysql:latest "/sbin/tini -- /usr/…" 25 minutes ago Up 25 minutes 0.0.0.0:10051->10051/tcp zabbix-server-mysql
126a18ddcec6 mysql:5.7 "docker-entrypoint.s…" 26 minutes ago Up 26 minutes 3306/tcp, 33060/tcp mysql-server
查看docker镜像
shell: docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
zabbix/zabbix-web-nginx-mysql latest 1bf06c43656f 36 hours ago 150MB
zabbix/zabbix-server-mysql latest 073a2414309c 36 hours ago 69.2MB
mysql 5.7 383867b75fd2 3 weeks ago 373MB
测试登陆帐号密码Admin/zabbix (http://ip:8080)
主机监控
客户端安装
yum install -y https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-agent-3.0.28-1.el7.x86_64.rpm
客户端配置
shell: vi /etc/zabbix/zabbix_agentd.conf
95 Server=192.168.3.208
135 ServerActive=192.168.3.208
客户端启动客户端服务以及配置防火墙
systemctl enable --now zabbix-agent && firewall-cmd --zone=public --add-port=10050/tcp --permanent && firewall-cmd --reload