Zabbix is an open-source monitoring software tool for diverse IT components, including networks, servers, virtual machines and cloud services. Zabbix provides monitoring metrics, among others network utilization, CPU load and disk space consumption. Zabbix has a rich set of features to enable users to monitor more than just hosts, offering great flexibility to administrators when it comes to choosing the most suitable option for each situation.
Zabbix uses XML based template which contains elements to monitor. The backend of Zabbix is written in C programming and PHP is used for the web frontend. Zabbix can send you alerts to notify the different events and issues based on metrics and thresholds defined for your IT environment. It supports agent-based and agentless monitoring. But Zabbix agents installation can help you to get detailed monitoring e.g. CPU load, network, disk space utilization.
As of the writting of this article, the latest Zabbix version is 6.0. In this guide, we will learn how to install and configure Zabbix on Ubuntu 22.04.
Before proceeding, let us make sure that our server packages are up to date with this command:
1
2
sudo apt update
sudo apt -y upgrade
Let us also install some common packages that we will need
1
sudo apt install -y vim
Install Mariadb
Zabbix requires mysql to function. Mariadb is a popular Opensource relational management system. We will use it in this guide. It is available in the default repositories as mariadb-server. For a detailed guide check out How to install and Configure Mariadb 10 in Ubuntu 22.04.
Install Mariadb :
1
sudo apt install -y mariadb-server
Once mariadb is installed, you can confirm the details using this command:
$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.6.7 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-10-20 18:48:44 UTC; 18s ago
Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/
Process: 104565ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS) Process: 104566ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 104568ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ]&&VAR=||VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`;[$? -eq 0]&& systemctl set-environment _WSREP_START_POSITION=$VAR||exit1(code=exited, status=0/SUCCESS) Process: 104607ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 104609ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS) Main PID: 104597(mariadbd) Status: "Taking your SQL requests now..." Tasks: 11(limit: 4392) Memory: 56.9M
CPU: 594ms
CGroup: /system.slice/mariadb.service
└─104597 /usr/sbin/mariadbdOct 20 18:48:44 unstable-ubuntusrv mariadbd[104597]: Version: '10.6.7-MariaDB-2ubuntu1.1' socket: '/run/mysqld/mysqld.sock' port: 3306 Ubuntu 22.04
Oct 20 18:48:44 unstable-ubuntusrv systemd[1]: Started MariaDB 10.6.7 database server.
Oct 20 18:48:44 unstable-ubuntusrv /etc/mysql/debian-start[104611]: Upgrading MySQL tables if necessary.
Oct 20 18:48:44 unstable-ubuntusrv /etc/mysql/debian-start[104614]: Looking for'mysql' as: /usr/bin/mysql
Oct 20 18:48:44 unstable-ubuntusrv /etc/mysql/debian-start[104614]: Looking for'mysqlcheck' as: /usr/bin/mysqlcheck
Oct 20 18:48:44 unstable-ubuntusrv /etc/mysql/debian-start[104614]: This installation of MariaDB is already upgraded to 10.6.7-MariaDB.
Oct 20 18:48:44 unstable-ubuntusrv /etc/mysql/debian-start[104614]: There is no need to run mysql_upgrade again for 10.6.7-MariaDB.
Oct 20 18:48:44 unstable-ubuntusrv /etc/mysql/debian-start[104614]: You can use --force if you still want to run mysql_upgrade
Oct 20 18:48:44 unstable-ubuntusrv /etc/mysql/debian-start[104622]: Checking for insecure root accounts.
Oct 20 18:48:44 unstable-ubuntusrv /etc/mysql/debian-start[104628]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
To ensure that mariadb starts on boot, enable it with this systemd command:
1
sudo systemctl enable mariadb
Once the mysql service is running, you need to secure it. Mysql provides a commandline utility that will do that:
1
sudo mysql_secure_installation
The above command will take you through prompts to secure and set a root password for the mysql instance.
To confirm the version of MariaDB installed, run the command:
1
2
$ mysql -V
mysql Ver 15.1 Distrib 10.3.32-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Create mysql user for Zabbix
We are going to create a dedicated user for zabbix. Check out this guide on managing mysql permissions here.
Connect to mysql server:
1
mysql -u root -p
After Supplying your root password, enter the following to the mysql prompt:
To complete the installation, launch your browser, and go to this URL:
1
http://server-ip/zabbix
The first page that greets you is the Zabbix welcome page that boldly displays the version you are installing. Select the installation language and click on the Next step’ button.
In the next page you get a list of prerequisites, scroll all the way down and ensure all the prerequisites get the OK’ label in the last column. It’s mandatory that all the requirements are satisfied. Then hit the Next step’ button.
On the Configure DB Connection’ page. Fill out your database details. For the database port, leave it at 0. The press Next step'.
Then specify your server’s name, confirm your time zone and feel free to select your preferred theme. Then press Next step’.
Citizix – Zabbix Server 6 Details
Confirm all the settings and if all looks well, press on Next step’ to finalize the installation.
Citizix – Zabbix Preinstall Summary
If all the settings you provided are correct, you will get a congratulatory message notifying you of the successful setup of Zabbix’s front end. Press on the Finish’ button.
Citizix – Zabbix Install success
This directs you to the Zabbix login page. Log in with the following credentials:
Username: Admin
Password: zabbix
Then click on Sign in’ to access the Zabbix dashboard. You can change the password later for added security, so don’t worry about that.
Finally, you will get access to Zabbix’s dashboard
Citizix – Zabbix 6 dashboard
That is it! We have successfully installed the Zabbix monitoring tool on Ubuntu 22.04.