Edited 3 weeks ago by ExtremeHow Editorial Team
MonitoringZabbixSystem AdministrationNetwork MonitoringServersAlertsConfigurationDashboardsPerformanceTools
This content is available in 7 different language
Zabbix is an open-source monitoring tool designed to monitor and track the status of various network services, servers, and other network hardware. It provides monitoring metrics such as CPU load, network usage, and disk space consumption. Zabbix also provides notifications based on customizable alerts for certain thresholds.
This guide will introduce you to the process of installing and configuring Zabbix on a Linux-based system. The instructions will cover the steps required to get the Zabbix server up and running, as well as how to set up the Zabbix agent on a client machine to collect monitoring data.
Before installing Zabbix, make sure your system meets the following requirements:
Before installing Zabbix, it is important to update the package repository and installed packages to ensure you have the latest versions. Run the following commands depending on your Linux distribution:
sudo apt update
sudo apt upgrade -y
sudo yum update
Zabbix requires a web server, a database, and PHP to work. We will use Apache as the web server and MySQL (or MariaDB) as the database. Run the following commands to install these packages:
Install Apache:
sudo apt install apache2 -y
Install the MySQL server:
sudo apt install mysql-server -y
Secure MySQL Installation:
sudo mysql_secure_installation
Install PHP and required extensions:
sudo apt install php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql -y
Install Apache:
sudo yum install httpd -y
Install MariaDB (use MySQL if desired):
sudo yum install mariadb-server -y
Start and secure MariaDB:
sudo systemctl start mariadb
sudo mysql_secure_installation
Install PHP and required extensions:
sudo yum install php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysqlnd -y
The next step is to install the Zabbix repository on your system. This is necessary as Zabbix packages may not be available in the default repository. Run the appropriate command for your system:
wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1%2Bubuntu20.04_all.deb
sudo dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb
sudo apt update
sudo rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
sudo yum clean all
Now it's time to install the Zabbix server, web frontend, and agent. Make sure you have installed the Zabbix repository before running these commands.
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent -y
sudo yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-apache-conf -y
The Zabbix server needs a database to store its data. You must create the database and configure Zabbix to use it.
Log into the MySQL shell:
mysql -u root -p
Create the Zabbix database:
CREATE DATABASE zabbix character set utf8mb4 collate utf8mb4_bin;
Create a database user for Zabbix:
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password';
Grant privileges to the Zabbix user:
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
Reload the privilege tables and exit:
FLUSH PRIVILEGES;
EXIT;
After the database is ready, you need to import the initial schema and configure the Zabbix server.
Run the following command to import the schema:
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbix
Note: You will be asked for the password you set when creating the zabbix user in MySQL.
Open the Zabbix server configuration file:
sudo nano /etc/zabbix/zabbix_server.conf
Find the following lines and update them accordingly:
Set DBName:
DBName=zabbix
Set up DBUser:
DBUser=zabbix
Set DBPassword (remove the comment and set your own password):
DBPassword=password
Edit the PHP configuration file for Zabbix to make sure it meets the minimum requirements.
Edit php.ini for Apache:
sudo nano /etc/zabbix/apache.conf
Set the correct time zone (replace 'your/timezone' with your actual time zone, for example, 'America/New York'):
php_value date.timezone Europe/Riga
Open the php.ini file:
sudo nano /etc/php.ini
Set the correct time zone:
date.timezone = Europe/Riga
After installing and configuring the required components, you need to start the Zabbix server and frontend processes.
sudo systemctl restart zabbix-server zabbix-agent httpd
sudo systemctl enable zabbix-server zabbix-agent httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl restart apache2
sudo systemctl enable apache2
With the Zabbix server running, you can now access the Zabbix web interface to complete the configuration via your web browser. The interface is typically accessed on port 80.
Open your browser and go to the following URL:
http://your_server_ip/zabbix
You will see the Zabbix welcome screen. Click "Next Step" to continue.
On the configuration page, configure the database connection details using the database we set up earlier. If it is on the same machine as the server, use "localhost" as the database host.
Click “Next Step” to continue.
Configure the frontend settings, then proceed to the next step.
Click "Next Step" to go to the "Finish Installation" page.
During the final step, confirm all details are correct, then click "Finish" to complete the installation.
Once Zabbix is installed, log in to your dashboard using the default credentials:
The Zabbix agent is a component used to collect data from the monitored device; it then sends this data back to the server. Here's how to set up the Zabbix agent on the monitored host:
sudo apt install zabbix-agent -y
sudo yum install zabbix-agent -y
Edit the Zabbix agent configuration file:
sudo nano /etc/zabbix/zabbix_agentd.conf
Modify the following parameters:
Set the server parameter to your Zabbix server IP address:
Server=your_zabbix_server_ip
Set the ServerActive parameter (optional):
ServerActive=your_zabbix_server_ip
Set the hostname parameter to the name of the host to be monitored:
Hostname=my-monitored-host
Start the Zabbix agent and enable it to start at boot time:
sudo systemctl start zabbix-agent
sudo systemctl enable zabbix-agent
You have successfully installed and configured the Zabbix server and agent. Zabbix is now running on your system, ready to monitor your network infrastructure. With its easy setup and powerful features, Zabbix can help keep your IT infrastructure running smoothly by providing real-time monitoring, alerts, and analysis of all your critical systems and applications.
Explore Zabbix's detailed documentation to get the most out of its features, and consider configuring additional agents and host monitoring to suit your network's needs.
If you find anything wrong with the article content, you can