Zabbix + Docker Containers Rocks
How to Install Zabbix on Ubuntu 20.04 LTS As Docker at WSL 2— DockerSeries — Episode 00
In this post, we will install Zabbix on a Docker using Ubuntu 20.04 LTS and MS WSL 2.
Created by Alexey Vladyshev, supported by Zabbix SIA, Zabbix is an Enterprise-Class Open Source Monitoring Solution.

What can Zabbix monitor?
. Network;
. Server (Health & Integrity);
. Machines, VMs;
. Apps;
. Services;
. Databases;
. Websites;
. The clouds
. And more...
What Zabbix offers:
. Excellent Reporting;
. Data Visualisation Features based on the stored data
. Zabbix API
Zabbix is ideal for Capacity Planning.
Zabbix is free of cost, distributed under GLP license v2 (source is freely distributed:)
Features:
. Data gathering
. Support SNMP - Simple Network Management Protocol
IPMI - Intelligent Platform Management Interface
JMX - Java Management Extensions
cloud computing
. Metric Collection
. Problem Detection
. Visualisation
. Notification & Remediation
. Security & Authentication
. Effortless deployment
. Auto Discovery
. Distributed Monitoring
Let’s Practice right now!
In the end of these steps you should be running Zabbix instance on your Windows 10 platform and you will have more conditions to study this brilliant monitoring solution in-depth and locally :)
Simply perform these procedures below:
00# Step — Install Windows Subsystem for Linux Installation Guide for Windows 10;
Please follow the Microsoft tutorial.
01 # Step — Now you can install Windows Terminal.
This tool has become a standard service for users who now access tools such as Command Prompt, Windows Power shell, and Windows Subsystem for Linux.
How To Install Windows Terminal?
Open the Windows Store and search for “Windows Terminal”:)
Open the Windows Terminal, Click on the drop-down icon (1) and choose Settings (2):


Please Choose Ubuntu 20.04 LTS at MS Store:

02# Step — Installing Docker machine;
Type as admin at prompt:
sudo apt-get update
curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.sh# If you would like to use Docker as a non-root user, you should now # consider adding your user to the “docker” group with somethingsudo usermod -aG docker <your-user>
03 # Step — Now run these scripts commands on Ubuntu 20:
Installing Zabbix docker on Ubuntu 20.04 LTS
#Container #1
docker run --name mysql-server -t -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="jaythree123" -e MYSQL_ROOT_PASSWORD="2fe04e524ba40505a82e03a2819429cc" -d mysql --character-set-server=utf8 --collation-server=utf8_bin --default-authentication-plugin=mysql_native_password
#Container #2
docker run --name zabbix-java-gateway -t --restart unless-stopped -d zabbix/zabbix-java-gateway
#Container #3
This Container #3 needs 2–3 minutes to be consolidated! Do it calmly!
docker run --name zabbix-server-mysql -t -e DB_SERVER_HOST="mysql-server" -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="jaythree123" -e MYSQL_ROOT_PASSWORD="2fe04e524ba40505a82e03a2819429cc" -e ZBX_JAVAGATEWAY="zabbix-java-gateway" --link mysql-server:mysql --link zabbix-java-gateway:zabbix-java-gateway -p 10051:10051 --restart unless-stopped -d zabbix/zabbix-server-mysql
#Container #4
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="jaythree123" -e MYSQL_ROOT_PASSWORD="2fe04e524ba40505a82e03a2819429cc" --link mysql-server:mysql --link zabbix-server-mysql:zabbix-server -p 80:8080 --restart unless-stopped -d zabbix/zabbix-web-nginx-mysql
#Container #5
docker run --name zabbix-agent --link mysql-server:mysql --link zabbix-server-mysql:zabbix-server -e ZBX_HOSTNAME="Zabbix server" -e ZBX_SERVER_HOST="zabbix-server" -d zabbix/zabbix-agent
# Checking the containers and discovering IP Addresses:
docker ps -a
sudo apt install net-tools
ifconfig [note eth0 address and browse it]
docker inspect zabbix-agent | grep "IPAddress\":"
Make Yourself Wait, just relax :)
Execute each script in that order. Everything must work alright!
04# Step — Go to your browser and type the container IP, Access Zabbix with these credentials:
Admin
zabbix
And this screen will open:

That’s all for now!
In the next zabbixSeries Episode, we will connect our home laptops and monitor each one in our machine.
Be tuned!
Bye!

Troubleshooting
In case it doesn’t work for the first time, do not give up! just execute these lines:
To get rid of all containers and trying it again:
# Stop & Removing Containers
docker ps
docker stop <container_number_spaced_separated>
docker rm <container_number_spaced_separated>Example:
docker stop 47d1a3824aa2
175b2de3e7ff 581ced4e1f98 49436c7741ef d9f59ceb13ebdocker rm 47d1a3824aa2 175b2de3e7ff 581ced4e1f98 49436c7741ef d9f59ceb13eb# Removing Images (optional)
docker ps -a
docker rmi zabbix/zabbix-server-mysql
docker rmi alpine-5.2-latest
docker rmi 26a00dcbab80
To Restart the Docker (in case your PC is power-off)
# Daemon restart (or goto Control Docker with systemd)
sudo /3etc/init.d/docker start
docker ps -a
docker start <container_number_spaced_separated>
or
sudo systemctl start docker
or
sudo service docker start# Note: you will need to initialize the containers in that order:
# First: mysql and
# Second: zabbix-java-gateway
# Third: zabbix-server-mysql
# Forth: nginx
# Fifth: agentdocker start <mysql_Container_ID>
docker start <zabbix/zabbix-java-gateway_Container_ID>
docker start <zabbix/mysql_Container_ID>
docker start <zabbix/zabbix-web-nginx-mysql_Container_ID>
docker start <zabbix/zabbix-agent_Container_ID>
In case you would like to run in the desktop:
# Install Docker Desktop for windows, from:
https://www.docker.com/products/docker-desktop
Configure Docker to start on boot
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
How to Unregister and Reset Windows Subsystem for Linux (WSL) Distro in Windows 10
During my studies I ended up loading Ubuntu (that way, no version):/I've got several errors, and I couldn't install the docker... Until the colleague Ronaldo Moronha sent me to the right path:)I used these commands based on this post to get rid of the old register and make way for the Ubuntu 20.04 LTS, the focus of this study:wsl --list --all
wsl --unregister <DistributionName>
Credits & References
Ronaldo Moronha by LinkedIn — Analista de Telecom — Thank you, my friend!
What is Zabbix by Zabbix.com (Demo video is awesome!)
Zabbix Docker Containers by Youtube
Zabbix — Docker Installation on Ubuntu Linux by https://techexpert.tips/
Welcome to the Midnight Commander Development Center by MC.org
Windows Subsystem for Linux Installation Guide for Windows 10 by Microsoft
How To Install Windows Terminal? by Nicolas
How to search Powershell command history from previous sessions by StackExchange
WSL commands and launch configurations by microsoft.com
Zabbix/Zabbix-docker by Github
Docker by docker.com
Control Docker with systemd by docs.docker.com
Configure Docker to start on boot by docs.docker.com
Ubuntu 20.04.1 LTS (Focal Fossa) by ubuntu.com
nginx by docker.com
How to Unregister and Reset Windows Subsystem for Linux (WSL) Distro in Windows 10 by tenforums.com
Install Docker Engine on Ubuntu by docker.com


Related Posts
00#Episode — DockerSerie — Zabbix + Docker Containers Rocks —How to Install Zabbix on Ubuntu 20.04 LTS As Docker at WSL 2 (this one)
01#Episode — Soon! Be tuned!
Update: 2021/Apr/04 — Thanks to Hilton Travis — error at the end of Step 3 with the “docker inspect” line — it is missing a trailing double (docker inspect zabbix-agent | grep “IPAddress\”:”)