Learn how to install Zabbix on CentOS 8 with our comprehensive step-by-step guide. Set up and configure Zabbix for efficient network monitoring and management. #centlinux #linux #zabbix
Table of Contents
What is Zabbix?
Zabbix is a free and open-source networking monitoring software. With Zabbix, we can monitor networks, servers, virtual machines and cloud services. Zabbix provides monitoring metrics, among others network utilization, CPU load and disk space consumption.
Zabbix network monitoring software backend is written in C language and web frontend is written in PHP. Zabbix can use MySQL, MariaDB, PostgreSQL, SQLite, Oracle, IBM DB2 to store data.
Zabbix software is developed and maintained by Zabbix LLC and distributed under GPLv2 license.
Read Also: How to install Zabbix on Rocky Linux 9
Zabbix Server Features:
Some of the distinct features of Zabbix are:
- Distributed monitoring with centralized web administration.
- Auto-discovery of servers and network devices and interfaces
- High performance, high capacity (able to monitor hundreds of thousands of devices).
- SLA, and ITIL KPI metrics on reporting.
- Native high performance agents (client software for Linux, Solaris, HP-UX, AIX, FreeBSD, OpenBSD, OS X, Tru64/OSF1, Windows 2000, Windows Server 2003, Windows XP, Windows Vista, Windows Server 2008, Windows 7)
Zabbix Server Prerequisites:
Zabbix server requires following software packages.
- Database Backend – MySQL Server (5.0.3 – 8.0.x)
- Web Server – Apache Web Server (1.3.12 or later)
- PHP Support (5.4 or later)
Hardware requirements may vary based on the number of devices that you want to monitor via Zabbix server. For complete information about Zabbix requirements, you can visit Zabbix documentation.
Recommended Training for You: Zabbix Server: Installing and Configuring from Scratch
Zabbix vs LibreNMS
Zabbix and LibreNMS are both powerful network monitoring tools, but they cater to slightly different needs and have distinct features. Here’s a comparison to help you understand the differences and choose the right tool for your needs:
Zabbix
Overview
- Purpose: Comprehensive monitoring solution for networks, servers, cloud services, and applications.
- Strengths: Robust alerting, flexible data collection, extensive integration options, strong scalability, and a powerful agent system.
Features
- Data Collection: Collects data via agents, SNMP, IPMI, JMX, SSH, and more.
- Alerting: Highly customizable alerts with multiple notification channels (email, SMS, script execution).
- Scalability: Suitable for small to large environments, capable of handling thousands of monitored devices.
- Dashboard: Advanced visualization with customizable dashboards, graphs, and maps.
- Configuration: Offers templates for easy setup and configuration.
- Scripting and Automation: Supports custom scripts for monitoring and automation.
Pros
- Versatile and highly customizable.
- Strong community and commercial support.
- Extensive documentation and user community.
Cons
- Steeper learning curve for beginners.
- More complex initial setup compared to some other tools.
LibreNMS
Overview
- Purpose: Network monitoring system focusing on ease of use and comprehensive device support.
- Strengths: Autodiscovery, ease of setup, excellent device support through SNMP, and a strong community.
Features
- Data Collection: Primarily SNMP-based, with additional support for IPMI, and various APIs.
- Alerting: Supports alerting via email, Slack, Webhooks, and more.
- Scalability: Suitable for small to medium-sized networks, with growing support for larger environments.
- Dashboard: User-friendly interface with customizable dashboards and widgets.
- Configuration: Autodiscovery of devices simplifies the setup process.
- Scripting and Automation: Supports custom extensions and integrations.
Pros
- Easy to install and configure.
- Great autodiscovery and device compatibility.
- Active and supportive user community.
Cons
- Primarily SNMP-based, which may limit some advanced monitoring scenarios.
- Less customizable compared to Zabbix in terms of complex data collection and alerting configurations.
Conclusion
Both Zabbix and LibreNMS are excellent network monitoring solutions, but your choice depends on your specific needs and expertise:
- Choose Zabbix if you need a highly customizable and scalable monitoring solution with advanced alerting, data collection, and automation capabilities.
- Choose LibreNMS if you prefer a straightforward, easy-to-setup solution with strong SNMP support and a user-friendly interface for small to medium-sized networks.
Assess your specific requirements, the size of your network, and the complexity of your monitoring needs to make the best choice for your environment.
Linux Server Specification
We have provisioned a CentOS 8 virtual machine for this tutorial.
- CPU – 3.4 Ghz (2 cores)
- Memory – 2 GB
- Storage – 20 GB
- Operating System – CentOS Linux 8.0
- Hostname – zabbix-01.recipes.com
- IP Address – 192.168.116.207 /24
Installing LAMP Stack on CentOS 8
Connect to zabbix-01.recipes.com as root user by using a ssh client.
Zabbix is PHP based network monitoring tool thus requires a PHP application server to run.
Therefore, we are installing Apache web server, MySQL database server and PHP support by using a single dnf command.
# dnf install -y httpd mysql-server php php-mysqlnd php-mbstring php-pdo php-gd
Enable and start Apache service.
# systemctl enable --now httpd.service Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service â /usr/lib/systemd/system/httpd.service.
Allow Apache service to accept incoming traffic in Linux firewall.
# firewall-cmd --permanent --add-service=http ; firewall-cmd --reload success success
Enable and start MySQL database service.
# systemctl enable --now mysqld.service Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service â /usr/lib/systemd/system/mysqld.service.
Configure MySQL server instance as follows.
# mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2 Please set the password for root here. New password: Re-enter new password: Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
Edit PHP configurations to customize it according to your environment.
# vi /etc/php.ini
Uncomment and set following directive.
date.timezone = Asia/Karachi
Install Zabbix Yum Repository
As described in Zabbix documentation, we can install Zabbix yum repository in our CentOS 8 server as follows.
# cd /tmp # wget https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm --2019-12-10 22:32:00-- https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm Resolving repo.zabbix.com (repo.zabbix.com)... 162.243.159.138, 2604:a880:1:20::b82:1001 Connecting to repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 17876 (17K) [application/x-redhat-package-manager] Saving to: âzabbix-release-4.4-1.el8.noarch.rpmâ zabbix-release-4.4- 100%[===================>] 17.46K --.-KB/s in 0s 2019-12-10 22:32:01 (229 MB/s) - âzabbix-release-4.4-1.el8.noarch.rpmâ saved [17876/17876]
Install downloaded RPM by using dnf command.
# dnf install -y zabbix-release-4.4-1.el8.noarch.rpm
Build yum package manager cache for Zabbix yum repository.
# dnf makecache CentOS-8 - AppStream 3.8 kB/s | 4.3 kB 00:01 CentOS-8 - Base 2.3 kB/s | 3.9 kB 00:01 CentOS-8 - Extras 546 B/s | 1.5 kB 00:02 Zabbix Official Repository - x86_64 1.7 kB/s | 2.9 kB 00:01 Zabbix Official Repository non-supported - x86_ 2.8 kB/s | 3.0 kB 00:01 Metadata cache created.
Install Zabbix on CentOS 8
We have setup the Zabbix yum repository, therefore, we can easily install Zabbix on CentOS 8 by using dnf command. Here, we are installing Zabbix with MySQL database support by using following command.
# dnf install -y zabbix-server-mysql
Install Zabbix frontend with MySQL and Apache support.
# dnf -y install zabbix-web-mysql zabbix-apache-conf
Create a MySQL database user to own Zabbix server data.
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 9 Server version: 8.0.17 Source distribution Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> create database zabbix; Query OK, 1 row affected (0.04 sec) mysql> create user 'zabbix'@'localhost' identified by 'Zabbix@1234'; Query OK, 0 rows affected (0.14 sec) mysql> grant ALL on zabbix.* to 'zabbix'@'localhost'; Query OK, 0 rows affected (0.02 sec) mysql> flush privileges; Query OK, 0 rows affected (0.03 sec) mysql> exit Bye
Create Zabbix database by using the script provided with Zabbix server installation files.
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -D zabbix -pZabbix@1234 mysql: [Warning] Using a password on the command line interface can be insecure.
Configure Zabbix server settings.
# vi /etc/zabbix/zabbix_server.conf
And set following directives therein.
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=Zabbix@1234
Configure SELinux settings for Zabbix on CentOS 8. Make sure you have installed policoreutils-python package before executing following commands.
# grep zabbix_t /var/log/audit/audit.log | audit2allow -M zabbix_server_custom ******************** IMPORTANT *********************** To make this policy package active, execute: semodule -i zabbix_server_custom.pp # semodule -i zabbix_server_custom.pp # rm -f zabbix_server_custom.* # setsebool -P httpd_can_connect_zabbix on # setsebool -P httpd_can_network_connect_db on
Enable and start Zabbix service.
# systemctl enable --now zabbix-server Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service â /usr/lib/systemd/system/zabbix-server.service.
We have successfully install Zabbix on CentOS 8.
Install Zabbix Agent on CentOS 8
Zabbix is agent based server monitoring software. Therefore, we need to install Zabbix agent software on each server that need to be monitored.
Install Zabbix Agent on the same Linux server.
# dnf install -y zabbix-agent
Enable and start Zabbix agent service.
# systemctl enable --now zabbix-agent Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service â /usr/lib/systemd/system/zabbix-agent.service.
Allow Zabbix agent service ports in Linux firewall.
# firewall-cmd --permanent --add-port={10051/tcp,10050/tcp} success # firewall-cmd --reload success
Open URL http://zabbix-01.recipes.com/zabbix/ in a web browser.
Click on Next Step.
Review that all required PHP settings are OK. Click on Next Step.
Enter MySQL Database connectivity parameters and click on Next Step.
Click on Next Step.
Click on Next Step.
Click on Finish.
Login using Zabbix default username/password i.e. admin/zabbix.
We are reached at the Zabbix Dashboard.
If you want to explore Zabbix software, then we highly recommend you to buy Zabbix 4 Network Monitoring (PAID LINK) by Packt Publishing
Final Thoughts
Installing Zabbix on CentOS 8 can significantly enhance your network monitoring and management capabilities. By following the right steps, you can set up and configure Zabbix to ensure efficient performance and comprehensive oversight of your systems. Whether you’re a system administrator or a network manager, mastering Zabbix will enable you to maintain the health and security of your network infrastructure.
If you need professional assistance or a more detailed guide to install Zabbix on any Linux Distro, I offer expert services on Fiverr. Visit my Fiverr profile: Season Linux Administrator to get personalized help and ensure a smooth and successful installation process.
I installed exactly as your post but after some time shows me the the zabbix server is not running
Try to start the Zabbix service and checkout the error.
For further guidance, contact me at our Facebook Page along with the screenshot of the error.
dnf -y install zabbix-web-mysql zabbix-apache-conf while giving this command i am getting the following error
[root@localhost tmp]# dnf -y install zabbix-web-mysql zabbix-apache-conf
Zabbix Official Repository – x86_64 1.0 kB/s | 41 kB 00:41
Failed to synchronize cache for repo 'zabbix', ignoring this repo.
Last metadata expiration check: 0:15:05 ago on Mon 30 Dec 2019 04:06:23 AM EST.
No match for argument: zabbix-web-mysql
No match for argument: zabbix-apache-conf
Error: Unable to find a match
CAN U HELP ??
This is caused due to the IPv6 configuration in CentOS / RHEL 8. If you are not using IPv6 then you should disable it using following command.
# sysctl -w net.ipv6.conf.all.disable_ipv6=1
Now execute your dnf command again.
grep zabbix_t /var/log/audit/audit.log | audit2allow -M zabbix_server_custom
it returns: "Nothing to do.".
May you help me, please?
It means you don't have any policy violations. Skip this step and continue.
Hi, Great tutorial but I getting this message when I wnat to enable and start Zabbix service.
Job for zabbix-server.service failed because the control process exited with error code.
See "systemctl status zabbix-server.service" and "journalctl -xe" for details.
Any ideas what it could be?
It is a generic error. Please execute
systemctl status zabbix-server.service
and you may find the actual cause of the error.