💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
docker部署zabbix [TOC] # 1.相关地址 zabbix官方docker安装说明 ``` https://www.zabbix.com/documentation/3.4/zh/manual/installation/containers ``` zabbix在docker hub上的地址 ``` https://hub.docker.com/r/zabbix/ ``` zabbix官方github地址 ``` https://github.com/zabbix/zabbix-docker ``` # 2 环境准备 # 2.1 debian环境安装docker 这里我们使用国内访问较快的清华源来安装docker,相关地址 ``` https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/ ``` ### 2.1 清除工作 如果你过去安装过 docker,先删掉: ``` apt-get remove docker docker-engine docker.io ``` ### 2.2 首先安装依赖: ``` apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common ``` ### 2.3 信任 Docker 的 GPG 公钥: ``` curl -fsSL https://download.docker.com/linux/debian/gpg |apt-key add - ``` ### 2.4 添加软件仓库 ``` add-apt-repository \ "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \ $(lsb_release -cs) \ stable" ``` 这里可能会报错提示找不到add-apt-repository命令 ``` add-apt-repository command not found ``` 解决方法: ``` apt-get install python-software-properties software-properties-common apt-transport-https apt-get update ``` 然后在重新执行一下添加仓库的命令即可 ### 2.5 最后安装doicker-ce ``` apt-get update apt-get install docker-ce systemctl start docker docker -v ``` ### 2.6 使用阿里云docker镜像加速 ``` mkdir -p /etc/docker tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://ig2l319y.mirror.aliyuncs.com"] } EOF systemctl daemon-reload systemctl restart docker ``` ### 检查docker是否正常工作 ``` systemctl status docker ``` # 3. 使用docker部署zabbix ## 3.1 官方地址 官方写的很详细并且是中文的,一步步按照操作就可以 ``` https://www.zabbix.com/documentation/3.4/zh/manual/installation/containers ``` ![](https://box.kancloud.cn/1bad5ce536b5d6e3339397189b7f1d5e_1309x957.png) ## 3.2 启动一个空的Mysql服务器实例 ``` 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 ``` ## 3.3 启动Zabbix server实例,并关联这个实例到已创建的MySQL服务器实例 ``` 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 ``` ## 3.4 启动Zabbix web 接口,并将它与MySQL服务器实例和Zabbix server实例关联 ``` 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 ``` ## 3.5 查看容器启动情况 ``` [root@zabbix_server ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 98cbe8d8a6bd zabbix/zabbix-web-nginx-mysql:latest "docker-entrypoint.sh" 6 seconds ago Up 5 seconds 443/tcp, 0.0.0.0:8080->80/tcp zabbix-web-nginx-mysql de040d43d60f zabbix/zabbix-server-mysql:latest "docker-entrypoint.sh" 59 seconds ago Up 59 seconds 0.0.0.0:10051->10051/tcp zabbix-server-mysql 3276f18def8d mysql:5.7 "docker-entrypoint.s…" About a minute ago Up About a minute 3306/tcp mysql-server ``` ## 3.6 查看docker镜像 ``` [root@zabbix_server ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE zabbix/zabbix-web-nginx-mysql latest 4db891b4393a 10 hours ago 177MB zabbix/zabbix-server-mysql latest f5e58dafe9ac 10 hours ago 62.2MB mysql 5.7 f0f3956a9dd8 7 days ago 409MB ``` ## 3.7 访问web界面 http://192.168.56.22:8080 ![](https://box.kancloud.cn/bfee21e1607dbc1d013ff922d2e89fee_493x601.png) 帐号密码: Admin zabbix ![](https://box.kancloud.cn/30e254574925e6285ccc54a8f5454ab8_1102x663.png) 已经可以访问了