Docker Run Zabbix Server 6.0 LTS
Zabbix Hub docker
https://hub.docker.com/u/zabbix
1,Ubuntu 20.04 Install Docker
(1)Docker Host Version
root@docker-node01:/# lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
(2)Initialize the system
#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
sudo apt-get install docker-ce docker-ce-cli containerd.io
(4) Start Docker Service
sudo systemctl start docker
sudo systemctl enable --now docker
(5)Check Docker version
docker version
(6)Check Docker info
docker info
2,Docker Run Zabbix Server 6.0 Containers
Zabbix Server 6.0 Containers
(1)Create Zabbix private network
docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 zbx_net
Check Docker network
docker network list
(2)mysql-server containers
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
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
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
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
# 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
sudo mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
(3)Give executable permission
sudo chmod +x /usr/local/bin/docker-compose
(4)Create soft link
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
(5)docker-compose version
sudo docker-compose --version
(6)docker-compose config
sudo vim docker-compose.yml
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
sudo docker-compose up -d
(8)docker-compose ps
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
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
sudo vim /etc/zabbix/zabbix_agent2.conf
Server=172.18.0.3
ServerActive=172.18.0.3
Hostname=docker-node01
(3)start zabbix-agent2
sudo systemctl start zabbix-agent2.service
sudo systemctl enable zabbix-agent2.service
(4)zabbix_agent2 -t test
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
#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