Docker Run Zabbix Server 6.0 LTS
- Ubuntu 20.04 Install Docker
- Docker Run Zabbix Server 6.0 Containers
- Docker Compose Run Zabbix Server 6.0 Containers
- Access Zabbix Server 6.0 Web UI
- Zabbix Server 6.0 Monitor Docker Host
Zabbix Hub docker
https://hub.docker.com/u/zabbix
1,Ubuntu 20.04 Install Docker
(1)Docker Host Version
代码语言:javascript复制root@docker-node01:/# lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
(2)Initialize the system
代码语言:javascript复制#Uninstall old version docker
sudo apt-get remove docker docker.io containerd runc
#Configure docker source
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
#Update source
sudo apt-get update
(3)Docker Install
代码语言:javascript复制sudo apt-get install docker-ce docker-ce-cli containerd.io
(4) Start Docker Service
代码语言:javascript复制sudo systemctl start docker
sudo systemctl enable --now docker
(5)Check Docker version
代码语言:javascript复制docker version
(6)Check Docker info
代码语言:javascript复制docker info
2,Docker Run Zabbix Server 6.0 Containers
Zabbix Server 6.0 Containers
- mysql-server
- zabbix-server-mysql
- zabbix-web-nginx-mysql
- zabbix-agent (Optional)
- zabbix-proxy-mysql(Optional)
- zabbix-java-gateway(Optional)
(1)Create Zabbix private network
代码语言:javascript复制docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 zbx_net
Check Docker network
代码语言:javascript复制docker network list
(2)mysql-server containers
代码语言:javascript复制docker run --name mysql-server -t
-e MYSQL_DATABASE="zabbix"
-e MYSQL_USER="zabbix"
-e MYSQL_PASSWORD="Passw0rd"
-e MYSQL_ROOT_PASSWORD="Password"
--network=zabbix-net
-d mysql
--character-set-server=utf8 --collation-server=utf8_bin
--default-authentication-plugin=mysql_native_password
(3)zabbix-server-mysql containers
代码语言:javascript复制docker run --name zabbix-server-mysql -t
-e DB_SERVER_HOST="mysql-server"
-e MYSQL_DATABASE="zabbix"
-e MYSQL_USER="zabbix"
-e MYSQL_PASSWORD="Passw0rd"
-e MYSQL_ROOT_PASSWORD="Password"
--network=zabbix-net
-p 10051:10051
--restart unless-stopped
-d zabbix/zabbix-server-mysql:ubuntu-6.0-latest
(4)zabbix-web-nginx-mysql containers
代码语言:javascript复制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="Passw0rd"
-e MYSQL_ROOT_PASSWORD="Password"
--network=zabbix-net
-p 80:8080
--restart unless-stopped
-d zabbix/zabbix-web-nginx-mysql:ubuntu-6.0-latest
(5)zabbix-agent containers
代码语言:javascript复制docker run --name zabbix-agent01 -e ZBX_HOSTNAME="zabbix-agent01"
-e ZBX_SERVER_HOST="zabbix-server-mysql" -p 10055:10050
--network=zabbix-net -d zabbix/zabbix-agent:ubuntu-6.0-latest
3,Docker Compose Run Zabbix Server 6.0 Containers
(1)docker-compose download
代码语言:javascript复制# Install curl wget
sudo apt update
sudo apt install -y curl wget
sudo wget https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-linux-x86_64
(2)mv file
代码语言:javascript复制sudo mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
(3)Give executable permission
代码语言:javascript复制sudo chmod x /usr/local/bin/docker-compose
(4)Create soft link
代码语言:javascript复制sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
(5)docker-compose version
代码语言:javascript复制sudo docker-compose --version
(6)docker-compose config
sudo vim docker-compose.yml
代码语言:javascript复制version: '3.5'
services:
mysql-server:
container_name: mysql-server
image: mysql
networks:
- zbx_net
command:
- mysqld
- --character-set-server=utf8
- --collation-server=utf8_bin
- --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_USER=zabbix
- MYSQL_DATABASE=zabbix
- MYSQL_PASSWORD=PasswOrd
- MYSQL_ROOT_PASSWORD=Password
zabbix-server-mysql:
container_name: zabbix-server-mysql
image: zabbix/zabbix-server-mysql:ubuntu-6.0-latest
networks:
- zbx_net
ports:
- 10051:10051
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- DB_SERVER_HOST=mysql-server
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=Passw0rd
- MYSQL_ROOT_PASSWORD=Password
depends_on:
- mysql-server
zabbix-web-nginx-mysql:
container_name: zabbix-web-nginx-mysql
image: zabbix/zabbix-web-nginx-mysql:ubuntu-6.0-latest
networks:
- zbx_net
ports:
- 80:8080
- 443:8443
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- ZBX_SERVER_HOST=zabbix-server-mysql
- DB_SERVER_HOST=mysql-server
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=Passw0rd
- MYSQL_ROOT_PASSWORD=Password
depends_on:
- mysql-server
- zabbix-server-mysql
networks:
zbx_net:
driver: bridge
(7)docker-compose up
代码语言:javascript复制sudo docker-compose up -d
(8)docker-compose ps
代码语言:javascript复制sudo docker-compose ps
4,Access Zabbix Server 6.0 Web UI
http://IP_address
Default username password
Admin zabbix
5,Zabbix Server 6.0 Monitor Docker Host
(1)zabbix-agent2 Install
代码语言:javascript复制wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1 ubuntu20.04_all.deb
sudo dpkg -i zabbix-release_6.0-1 ubuntu20.04_all.deb
sudo apt update
sudo apt install zabbix-agent2 zabbix-sender
(2)zabbix-agent2 config
代码语言:javascript复制sudo vim /etc/zabbix/zabbix_agent2.conf
Server=172.18.0.3
ServerActive=172.18.0.3
Hostname=docker-node01
(3)start zabbix-agent2
代码语言:javascript复制sudo systemctl start zabbix-agent2.service
sudo systemctl enable zabbix-agent2.service
(4)zabbix_agent2 -t test
代码语言:javascript复制root@docker-node01:/# sudo zabbix_agent2 -t agent.ping
root@docker-node01:/# sudo zabbix_agent2 -t docker.info
(5)Access zabbix-server-mysql Containers zabbix_get test
代码语言:javascript复制#View Containers ID/Name
sudo docker ps
#Access zabbix-server-mysql Containers
sudo docker exec -it zabbix-server-mysql /bin/bash
(6)Add a host link "Docker by Zabbix agent 2" template
(7)Latest data of docker host