Latest

Thursday, 12 December 2019

Install Zabbix Network Monitoring Server on CentOS 8

Install Zabbix 4.4 Server on CentOS 8

 

Zabbix is a free server based network monitoring software. In this article, you will learn how to install Zabbix network monitoring server on CentOS 8.

 

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 distibuted under GPLv2 license.

Install Zabbix 4.4 Server on CentOS 8

 

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.

 

Environment 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 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

 

Installing Zabbix Yum Repository on CentOS 8:

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.

 

Installing Zabbix Network Monitoring Server on CentOS 8:

We have setup the Zabbix yum repository, therefore, we can easily install Zabbix packages 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.

 

Installing Zabbix Agent Software 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.

01-install-zabbix-centos-8-setup-welcome

Click on Next Step.

02-install-zabbix-centos-8-prerequisite-check

Review that all required PHP settings are OK. Click on Next Step.

03-install-zabbix-centos-8-db-connection

Enter MySQL Database connectivity parameters and click on Next Step.

04-install-zabbix-centos-8-server-details

Click on Next Step.

05-install-zabbix-centos-8-summary

Click on Next Step.

06-install-zabbix-centos-8-congratulation

Click on Finish.

07-install-zabbix-centos-8-login

Login using Zabbix default username/password i.e. admin/zabbix.

08-install-zabbix-centos-8-dashboard

We are reached at the Dashboard of Zabbix server.

We have successfully installed Zabbix server on CentOS 8. If you want to explore Zabbix software, then we highly recommend you to buy Zabbix 4 Network Monitoring by Packt Publishing.

If you find this article useful? Don't you mind support us by Buy Me A Coffee


8 comments:

  1. I installed exactly as your post but after some time shows me the the zabbix server is not running

    ReplyDelete
    Replies
    1. 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.

      Delete
  2. 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 ??

    ReplyDelete
    Replies
    1. 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.

      Delete
  3. grep zabbix_t /var/log/audit/audit.log | audit2allow -M zabbix_server_custom

    it returns: "Nothing to do.".

    May you help me, please?

    ReplyDelete
    Replies
    1. It means you don't have any policy violations. Skip this step and continue.

      Delete
  4. 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?

    ReplyDelete
    Replies
    1. It is a generic error. Please execute

      systemctl status zabbix-server.service

      and you may find the actual cause of the error.

      Delete

© 2022 CentLinux. All Rights Reserved.