fbpx

Zabbix 5 Installation and Configuration on CentOS 8

· >
Zabbix 5 Installation and Configuration on CentOS 8

Zabbix is an open-source monitoring solution that can help you monitor the performance and availability of your IT infrastructure, including servers, networks, and applications. This tutorial will guide you through the process of installing and configuring Zabbix 5 on CentOS 8.

Prerequisites

Before you start, you need to ensure that you have the following prerequisites in place:

  • A CentOS 8 server with root access
  • An internet connection
  • A user with sudo privileges

Step 1: Update the system

The first step is to update your system to ensure that you have the latest security updates and bug fixes. Run the following command to update your system:

sudo yum update

Step 2: Install the necessary packages

Zabbix requires several packages to be installed on your system. Run the following command to install these packages:

sudo yum install epel-release
sudo yum install httpd php php-mysqlnd php-gd php-xml php-bcmath php-mbstring mariadb mariadb-server zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent

This command will install Apache, PHP, MariaDB, and the Zabbix server and agent.

Step 3: Configure MariaDB

Zabbix requires a database to store its data. In this tutorial, we will use MariaDB. Run the following command to start the MariaDB service:

sudo systemctl start mariadb

Next, run the following command to secure the MariaDB installation:

sudo mysql_secure_installation

Follow the prompts to set a root password and remove anonymous users, test database, and remote root login.

After you have secured the MariaDB installation, run the following commands to create a new database and user for Zabbix:

sudo mysql -u root -p

Enter the root password you set earlier and run the following commands to create a new database and user for Zabbix:

CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;
CREATE USER 'zabbixuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbixuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;

Replace “your_password” with a strong password of your choice.

Step 4: Configure Zabbix Server

The next step is to configure the Zabbix server. Open the Zabbix server configuration file:

sudo nano /etc/zabbix/zabbix_server.conf

Uncomment and set the following lines:

DBHost=localhost
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=your_password

Replace “your_password” with the password you set earlier.

Save and close the file.

Step 5: Initialize the Zabbix database

Now, run the following command to initialize the Zabbix database:

sudo zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbixuser -p zabbixdb

Enter the password you set earlier when prompted.

Step 6: Start and enable the Zabbix server and agent

Run the following commands to start and enable the Zabbix server and agent:

sudo systemctl start zabbix-server
sudo systemctl enable zabbix-server
sudo systemctl start zabbix-agent
sudo systemctl enable zabbix-agent

Step 7: Configure the Zabbix web interface

The Zabbix web interface is served by Apache. Open the Apache configuration file:

sudo nano /etc/httpd/conf.d/zabbix.conf

Uncomment and set the following lines:

php_value datephp_value max_execution_time 300

This will increase the maximum execution time for PHP scripts to 300 seconds.

Save and close the file.

Next, restart the Apache service:

sudo systemctl restart httpd

Step 8: Access the Zabbix web interface

Now that you have installed and configured Zabbix, you can access the web interface by entering your server’s IP address or hostname in your web browser followed by “/zabbix”. For example, if your server’s IP address is “192.168.1.100”, enter the following URL in your web browser:

http://192.168.1.100/zabbix

You will see the Zabbix login page. Enter the default username and password:

  • Username: Admin
  • Password: zabbix

You will be prompted to change the password.

Step 9: Configure Zabbix Monitoring

Now that you have access to the Zabbix web interface, you can start configuring monitoring for your IT infrastructure.

Adding a Host

The first step is to add a host that you want to monitor. To do this, go to the “Configuration” tab and click “Hosts”. Click the “Create host” button.

Enter a name for the host and its IP address or hostname. In the “Groups” field, select the group to which the host belongs. You can also add a template for the host. Click the “Add” button to add the host.

Adding Items

Next, you need to add items to monitor on the host. Go to the “Configuration” tab and click “Items”. Click the “Create item” button.

Enter a name for the item and select the type of item you want to monitor. For example, if you want to monitor the CPU usage, select “CPU load” from the “Type” dropdown menu. In the “Key” field, enter the item key. For example, if you want to monitor the CPU usage on a Linux host, enter “system.cpu.load[all,avg1]”.

Set the item’s update interval and its application. Click the “Add” button to add the item.

Adding Triggers

Triggers are used to define conditions that will generate an alert if they are met. To add a trigger, go to the “Configuration” tab and click “Triggers”. Click the “Create trigger” button.

Enter a name for the trigger and select the item you want to monitor. Set the trigger expression by entering a mathematical or logical expression that defines the condition that will trigger the alert. For example, if you want to trigger an alert when the CPU load is above 80%, enter “{host:system.cpu.load[all,avg1].last()}>80”.

Set the trigger’s severity and add a description. Click the “Add” button to add the trigger.

Adding Actions

Actions define what happens when a trigger is fired. To add an action, go to the “Configuration” tab and click “Actions”. Click the “Create action” button.

Enter a name for the action and select the trigger that will activate the action. Add a condition that defines when the action will be executed. For example, you can specify that the action will only be executed during business hours.

Set the action’s operation, which defines what happens when the action is executed. For example, you can send an email or execute a script.

Click the “Add” button to add the action.

Conclusion

In this tutorial, you learned how to install and configure Zabbix 5 on CentOS 8. You also learned how to configure monitoring for your IT infrastructure using Zabbix. Zabbix is a powerful monitoring

and alerting system that can be used to monitor servers, network devices, and applications. It provides a web-based interface that allows you to configure and manage monitoring easily. With Zabbix, you can keep track of the performance and availability of your IT infrastructure and respond quickly to any issues that arise.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments