Tutorial-9122023

How to Install Zabbix Monitoring Tool on Ubuntu 22.04

How to Install Zabbix Monitoring Tool on Ubuntu 22.04

Zabbix is a powerful open-source monitoring solution to monitor IT infrastructure. With Zabbix, you can monitor various IT components, including networks, servers, virtual machines, and cloud services. Zabbix provides a web-based user interface to track and monitor metrics such as network utilization, CPU load, and disk space consumption. You can use these metrics to check the current health of your IT infrastructure and detect problems with hardware or software components. Zabbix offers agent software on the monitored server to gather data and send it to the Zabbix server.

This tutorial will show you how to install the Zabbix monitoring server on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A root password is configured on the server.

Install Zabbix Repository

The Zabbix package is not available in the Ubuntu 22.04 default repository. So you will need to download and install the Zabbix official repository on your server.

First, download the Zabbix 6 repository package from their official website using the following command:
wget https://repo.zabbix.com/zabbix/6.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.2-4%2Bubuntu22.04_all.deb

Next, install it using the following command:
dpkg -i zabbix-release_6.2-4+ubuntu22.04_all.deb

Once the Zabbix repository is added to APT, you can proceed to install the Zabbix server.

Install Zabbix Monitoring Server

First, update the Zabbix repository using the following command:
apt-get update -y

Next, install the Zabbix server including other required components using the following command:
apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent zabbix-frontend-php zabbix-apache-conf -y

After installing all packages, edit the PHP configuration file and set your timezone:
nano /etc/php/8.1/apache2/php.ini

Change the following line:
date.timezone = UTC

Save and close the file when you are finished.

Configure MariaDB Database

Zabbix uses a MariaDB as a database backend. You can install the MariaDB database server by running the following command:
apt-get install mariadb-server -y

Once the MariaDB server is installed, secure the MariaDB installation and set the root password with the following command:
mariadb-secure-installation

Answer all the questions as shown below:
Enter current password for root (enter for none):
Switch to unix_socket authentication [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Next, connect to the MariaDB shell using the following command:
mysql -u root -p

Once you are logged in, create a database and user for Zabbix with the following command:
MariaDB [(none)]> CREATE DATABASE zabbix character set utf8mb4 collate utf8mb4_bin;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'password';

Next, flush the privileges and exit from the MariaDB with the following command:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Once you are finished, you can proceed to the next step.

Configure Zabbix Server

Next, edit the Zabbix configuration file and define your database with the following file:
nano /etc/zabbix/zabbix_server.conf

Change the following lines:
DBName=zabbix
DBUser=zabbix
DBPassword=password

Save and close the file when you are finished. Next, import the Zabbix data with the following command:
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix

Finally, restart and enable all the services using the following command:
systemctl restart apache2
systemctl enable zabbix-server zabbix-agent apache2
systemctl restart zabbix-server zabbix-agent

You can now check the Zabbix server status using the following command:
systemctl status zabbix-server

You will get the following output:
? zabbix-server.service - Zabbix Server
Loaded: loaded (/lib/systemd/system/zabbix-server.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2022-11-28 16:17:18 UTC; 6s ago
Process: 13840 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 13844 (zabbix_server)
Tasks: 48 (limit: 464122)
Memory: 85.3M
CGroup: /system.slice/zabbix-server.service
??13844 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
??13853 "/usr/sbin/zabbix_server: ha manager" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
??13854 "/usr/sbin/zabbix_server: service manager #1 [processed 0 events, updated 0 event tags, deleted 0 problems, synced 0 ser>
??13855 "/usr/sbin/zabbix_server: configuration syncer [synced configuration in 0.226889 sec, idle 60 sec]"
??13858 "/usr/sbin/zabbix_server: alert manager #1 [sent 0, failed 0 alerts, idle 5.100929 sec during 5.101308 sec]"
??13859 "/usr/sbin/zabbix_server: alerter #1 started" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
??13860 "/usr/sbin/zabbix_server: alerter #2 started" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
??13861 "/usr/sbin/zabbix_server: alerter #3 started" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
??13862 "/usr/sbin/zabbix_server: preprocessing manager #1 [queued 0, processed 5 values, idle 5.024623 sec during 5.027861 sec]"
??13863 "/usr/sbin/zabbix_server: preprocessing worker #1 started" ""
??13864 "/usr/sbin/zabbix_server: preprocessing worker #2 started" ""
??13865 "/usr/sbin/zabbix_server: preprocessing worker #3 started" ""
??13866 "/usr/sbin/zabbix_server: lld manager #1 [processed 0 LLD rules, idle 5.006720sec during 5.006902 sec]"
??13867 "/usr/sbin/zabbix_server: lld worker #1 started" "" "" "" "" "" "" "" "" "" "" ""
??13868 "/usr/sbin/zabbix_server: lld worker #2 started" "" "" "" "" "" "" "" "" "" "" ""
??13869 "/usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]"
??13870 "/usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.001594 sec, idle 41 sec]"
??13872 "/usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000712 sec, idle 5 sec]"
??13873 "/usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.000529 sec, idle 60 sec]"
??13875 "/usr/sbin/zabbix_server: history syncer #1 [processed 0 values, 0 triggers in 0.000020 sec, idle 1 sec]"
??13877 "/usr/sbin/zabbix_server: history syncer #2 [processed 4 values, 2 triggers in 0.001925 sec, idle 1 sec]"
??13878 "/usr/sbin/zabbix_server: history syncer #3 [processed 0 values, 0 triggers in 0.000013 sec, idle 1 sec]"
??13879 "/usr/sbin/zabbix_server: history syncer #4 [processed 0 values, 0 triggers in 0.000025 sec, idle 1 sec]"
??13880 "/usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.000911 sec, idle 3 sec]"
??13881 "/usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000057 sec, idle 5 sec]"
??13882 "/usr/sbin/zabbix_server: self-monitoring [processed data in 0.000031 sec, idle 1 sec]"
??13883 "/usr/sbin/zabbix_server: task manager [processed 0 task(s) in 0.006489 sec, idle 5 sec]"

To check the Zabbix agent status, run the following command:
systemctl status zabbix-agent

You will get the following output:
? zabbix-agent.service - Zabbix Agent
Loaded: loaded (/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2022-11-28 16:17:18 UTC; 37s ago
Process: 13842 ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 13846 (zabbix_agentd)
Tasks: 6 (limit: 464122)
Memory: 6.0M
CGroup: /system.slice/zabbix-agent.service
??13846 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
??13847 "/usr/sbin/zabbix_agentd: collector [idle 1 sec]" "" "" "" "" "" "" "" "" "" ""
??13848 "/usr/sbin/zabbix_agentd: listener #1 [waiting for connection]"
??13849 "/usr/sbin/zabbix_agentd: listener #2 [waiting for connection]"
??13850 "/usr/sbin/zabbix_agentd: listener #3 [waiting for connection]"
??13851 "/usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]" "" "" ""

Nov 28 16:17:17 ubuntu22041 systemd[1]: Starting Zabbix Agent...
Nov 28 16:17:18 ubuntu22041 systemd[1]: Started Zabbix Agent.

To check the Apache status, run the following command:
systemctl status apache2

You will get the following output:
? apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2022-11-28 16:17:08 UTC; 1min 5s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 13828 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 13832 (apache2)
Tasks: 6 (limit: 464122)
Memory: 12.3M
CGroup: /system.slice/apache2.service
??13832 /usr/sbin/apache2 -k start
??13833 /usr/sbin/apache2 -k start
??13834 /usr/sbin/apache2 -k start
??13835 /usr/sbin/apache2 -k start
??13836 /usr/sbin/apache2 -k start
??13837 /usr/sbin/apache2 -k start

Nov 28 16:17:08 ubuntu22041 systemd[1]: Starting The Apache HTTP Server...

Access Zabbix Dashboard

Now, open your web browser and access the Zabbix web interface using the URL http://your-server-ip/zabbix. You should see the Zabbix language selection page:

Select your language and click on the Next step. You should see the pre-requisites check page:

If all checks are ok then click on the Next step button. You should see the database connection page:

Provide your database information and click on the Next step button. You should see the Settings page:

Define your Zabbix server name, timezone, theme, and click on the Next step button. You should see the installation summary page:

If everything is fine, click the Next step button to start the installation. Once the Zabbix is installed, you should see the following page:

Click on the Finish button to finish the installation. You should see the Zabbix login page:

Provide the default username as Admin and the password as zabbix then click on the Sign in button. You should see the Zabbix dashboard on the following page:

Conclusion

Congratulations! You have successfully installed the Zabbix monitoring server on Ubuntu 22.04. You can now install the Zabbix agent on the remote servers and start monitoring them from the Zabbix dashboard. Feel free to ask me if you have any questions.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !