ติดตั้งด้วย docker run
$ docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 zabbix-net
$ docker pull mysql:8.0-oracle && docker pull zabbix/zabbix-java-gateway:alpine-5.4.12 && docker pull zabbix/zabbix-server-mysql:alpine-5.4.12 && docker pull zabbix/zabbix-web-nginx-mysql:alpine-5.4.12
$ docker run --name mysql-server -t -e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix_pwd" \
-e MYSQL_ROOT_PASSWORD="root_pwd" \
--network=zabbix-net \
--restart unless-stopped \
-d mysql:8.0-oracle \
--character-set-server=utf8 --collation-server=utf8_bin \
--default-authentication-plugin=mysql_native_password
$ docker run --name zabbix-java-gateway -t \
--network=zabbix-net \
--restart unless-stopped \
-d zabbix/zabbix-java-gateway:alpine-5.4.12
$ 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_pwd" \
-e MYSQL_ROOT_PASSWORD="root_pwd" \
-e ZBX_JAVAGATEWAY="zabbix-java-gateway" \
--network=zabbix-net \
-p 10051:10051 \
--restart unless-stopped \
-d zabbix/zabbix-server-mysql:alpine-5.4.12
$ docker run --name zabbix-web-nginx-mysql -t \
-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="root_pwd" \
--network=zabbix-net \
-p 80:8080 \
--restart unless-stopped \
-d zabbix/zabbix-web-nginx-mysql:alpine-5.4.12
ติดตั้งแบบ docker-compose.yml
version: "3.9"
services:
mysql-server:
image: mysql:8.0-oracle
container_name: mysql-server
environment:
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix_pwd
MYSQL_ROOT_PASSWORD: root_pwd
networks:
zabbix-net:
ipv4_address: 172.20.240.10
restart: unless-stopped
command: >
--character-set-server=utf8
--collation-server=utf8_bin
--default-authentication-plugin=mysql_native_password
zabbix-java-gateway:
image: zabbix/zabbix-java-gateway:alpine-5.4.12
container_name: zabbix-java-gateway
networks:
- zabbix-net
restart: unless-stopped
zabbix-server-mysql:
image: zabbix/zabbix-server-mysql:alpine-5.4.12
container_name: zabbix-server-mysql
environment:
DB_SERVER_HOST: mysql-server
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix_pwd
MYSQL_ROOT_PASSWORD: root_pwd
ZBX_JAVAGATEWAY: zabbix-java-gateway
networks:
- zabbix-net
ports:
- "10051:10051"
restart: unless-stopped
zabbix-web-nginx-mysql:
image: zabbix/zabbix-web-nginx-mysql:alpine-5.4.12
container_name: zabbix-web-nginx-mysql
environment:
ZBX_SERVER_HOST: zabbix-server-mysql
DB_SERVER_HOST: mysql-server
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix_pwd
MYSQL_ROOT_PASSWORD: root_pwd
networks:
- zabbix-net
ports:
- "80:8080"
restart: unless-stopped
networks:
zabbix-net:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
ip_range: 172.20.240.0/20
- เข้าสู่ระบบโดย http://localhost
user: Admin
pass: zabbix
เพิ่มเติม
- ทดสอบบน windows 10 docker-compose.yml ที่แปลงจาก docker run ด้วย chatgpt สามารถใช้งานได้จริง
Ref
- https://medium.com/@ekpicha/%E0%B8%A5%E0%B8%87-zabbix-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-docker-%E0%B9%81%E0%B8%A5%E0%B8%B0-zabbix-agent-template-item-trigger-logs-%E0%B8%9A%E0%B8%99-ubuntu-20-04-48b39118b4a5
- https://chatgpt.com/share/678fa365-61e8-8010-820d-359a95b107cd