发布时间: 2023-12-4 文章作者: myluzh 分类名称: Zabbix 朗读文章
# mysql docker pull mysql:8.0 docker volume create -d local mysql_data # 存放mysql数据 docker volume create -d local mysql_logs # 存放mysql日志 docker volume create -d local mysql_conf # 存放mysql配置文件 docker run --name mysql-server \ -v mysql_data:/var/lib/mysql \ -v mysql_logs:/var/log/mysql \ -v mysql_conf:/etc/mysql \ -e MYSQL_DATABASE="zabbix" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="zabbix_pwd" \ -e MYSQL_ROOT_PASSWORD="123456" \ --restart=unless-stopped \ -d mysql:8.0 \ --character-set-server=utf8 --collation-server=utf8_bin \ --default-authentication-plugin=mysql_native_password2、 部署zabbix-java网关
# zabbix-java-gateway docker pull zabbix/zabbix-java-gateway:alpine-6.2-latest docker run --name zabbix-java-gateway -t \ --restart=unless-stopped \ -d zabbix/zabbix-java-gateway:alpine-6.2-latest3、部署zabbix-server
# zabbix-server docker pull zabbix/zabbix-server-mysql:6.2-alpine-latest docker volume create -d local zabbix_server docker run --name zabbix-server-mysql -t \ -v zabbix_server:/etc/zabbix \ -e DB_SERVER_HOST="mysql-server" \ -e MYSQL_DATABASE="zabbix" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="zabbix_pwd" \ -e MYSQL_ROOT_PASSWORD="123456" \ -e ZBX_JAVAGATEWAY="zabbix-java-gateway" \ --link mysql-server:mysql \ --link zabbix-java-gateway:zabbix-java-gateway \ --restart=unless-stopped \ -p 10051:10051 \ -d zabbix/zabbix-server-mysql:alpine-6.2-latest4、部署zabbix-web
# zabbix-web docker pull zabbix/zabbix-web-nginx-mysql:alpine-6.2-latest docker run --name zabbix-web-nginx-mysql -t \ -e PHP_TZ="Asia/Shanghai" \ -e ZBX_SERVER_HOST="zabbix-server-mysql" \ -e DB_SERVER_HOST="mysql-server" \ -e MYSQL_DATABASE="zabbix" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="zabbix_pwd" \ -e MYSQL_ROOT_PASSWORD="123456" \ --link mysql-server:mysql \ --link zabbix-server-mysql:zabbix-server \ -p 80:8080 \ --restart unless-stopped \ -d zabbix/zabbix-web-nginx-mysql:alpine-6.2-latest5、部署zabbix-agent 如果是在zabbix-server部署agent的话,需要进入zabbix-server容器ip然后把容器ip填入ZBX_SERVER_HOST
# zabbix-agent docker run --name zabbix-agent -t \ -v zabbix_agent:/etc/zabbix \ -e ZBX_HOSTNAME="host01" \ -e ZBX_SERVER_HOST="121.4.185.210" \ -e ZBX_SERVER_PORT=10051 \ -p 10050:10050 \ --restart=unless-stopped \ --privileged \ -d zabbix/zabbix-agent:alpine-6.2-latest
发表评论