Thursday, March 28, 2024
HomeLinuxHow to install and configure Zabbix in RHEL 7/CentOS 7

How to install and configure Zabbix in RHEL 7/CentOS 7

Zabbix is an enterprise-class open source distributed monitoring solution that can be used to monitor and track performance and availability of network servers, devices and other IT resources. It supports distributed and WEB monitoring, auto-discovery, and more.

Zabbix package will not be in default repositories, so we will add epel and zabbix repository to install zabbix.

Step 1: install EPEL and configure zabbixzone package repository,

To install EPEL,

# yum install epel-release –y

To configure zabbixzone package repo with GPG key,

# rpm –import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX# rpm –Uv ttp://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm

Retrieving http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm

Preparing packages…

zabbix-release-2.4-1.el7.noarch

now we can install zabbix with required agents,

# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway

Step 2: Update Timezone 

Once installation completed successfully, now we need to update the timezone, in apache

In zabbox.conf we need to update the our appropriate timezone,

# vim /etc/httpd/conf.d/zabbix.conf

In line 18, uncomment and change/update the timezone, for asia timezone

php_value date.timezone Asia/Kolkata

once timezone updated successfully, we need to restart apache,

# systemctl restart httpd

Step 3: Create Database and User for Zabbix in MySQL

Login to MariaDB prompt with command:

# mysql -u root –p

zabbix

Step 4: Import Zabbix template to Zabbix database 

While import the templates. It will ask you the zabbixuser’s password. In /usr/share/doc/zabbix-server-mysql-x.x.x/create/ directory you will get zabbix templates, we need import all the templates to mariaDB.. In this x will replace you zabbix version.Make sure you are importing following order,

# mysql -u zabbixuser -p zabbixdb < /usr/share/doc/zabbix-server-mysql-2.4.7/create/schema.sql

# mysql -u zabbixuser -p zabbixdb < /usr/share/doc/zabbix-server-mysql-2.4.7/create/images.sql

# mysql -u zabbixuser -p zabbixdb < /usr/share/doc/zabbix-server-mysql-2.4.7/create/data.sql

Step 5: Configure Zabbix

In zabbix.conf file we need modify the database details in that,

# vim /etc/zabbix/zabbix_server.conf […]

DBName=zabbixdb[…]

DBUser=zabbixuser[…]

DBPassword=password[…]

Once you changed save and close the file.

Now enter the server details in agents conf file

# vim /etc/zabbix/zabbix_agentd.conf

#### Specify Zabbix server ####

Server=127.0.0.1

### Specify Zabbix server ####

ServerActive=127.0.0.1

Specify Zabbix server Hostname or IP address 

Hostname=foxutech.zabbix

Adjust PHP Settings 

We should adjust php.ini file as per recommendation by zabbix. Below mentioned recommended settings, please check and replace it, if those lines are not existed, just those lines in this php.ini file.

# vim php.ini

max_execution_time = 600

max_input_time = 600

memory_limit = 256M

post_max_size = 32M

upload_max_filesize = 16M

date.timezone = Asia/Kolkata

Step 6: Setup SELinux (Only if enabled)

Now we need to adjust IPtables to allow zabbix ports 10050 & 10051

# firewall-cmd –permanent –add-port=10050/tcp

# firewall-cmd –permanent –add-port=10051/tcp

Restart firewall to take effect the changes.

# systemctl restart firewalld

Step 7: Start the Zabbix

To start and enable the service

# systemctl start zabbix-server

# systemctl start zabbix-agent

# systemctl restart httpd

# systemctl restart mariadb

# systemctl enable zabbix-server

# systemctl enable zabbix-agent

Step 8: Configure Web Console 

We completed installation and configurations of zabbix. Now let me start configure web console. We can access through web browser, like http://IP-ADDRESS/zabbix

Click next to proceed, next screen will be pre-requisites. Here make sure you got all ok. Once you confirm click next.

Here we need to give me database details, once filled all required field, ‘Test Connection’ Once you got OK, proceed next.

Then we need to fill server details,

Next screen will contain, all the details which we given, here we can check and confirm. If there is any changes we can edit it, by clicking previous button, or we can click next proceed.

Congrats!!!, now you have completed installation of zabbix. Click finish to complete it.

Once we given finish, it will redirect to login page of zabbix. Once you logged in you will get below screen.

Normally, zabbix server monitoring will be disabled, for this can we need to login and enable the zabbix, To login default username and password is admin/zabbix.

Once you logged in go to configuration and hosts. In that click on disabled, it will popup to confirm enable the service.       

Client Side configuration: 

Installation: Follow the below steps for configure zabbix in client side

# rpm –import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX

# rpm -Uv http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm

# yum install zabbix-agent –y

Configuration:  

Now edit configuration file. Add server IP and hostname

# vim /etc/zabbix/zabbix_agentd.conf

### Specify Zabbix’s server IP address

###Server=192.168.0.3[…]

###Specify Zabbix’s server IP address

###ServerActive=192.168.0.3

## Specify client system hostname

##Hostname=zabbix.server[…]  

Where 192.168.0.3 – Zabbix Server IP

Zabbix.server – Zabbix server hostname

Once configure, start and enable the service.

# systemctl start zabbix-agent

# systemctl enable zabbix-agent

Add monitoring hosts: 

Now go to server zabbix dashboard,  In that to add a host Configuration => hosts, here provide the server hostname and IP details and in template tab select required monitoring service. Once selected click add to complete. Once we added we will get following screen

Zabbix Client

In dashboard we can see any failure and alerts. We can see latest data in latest data tab. For more details about configuration visit Zabbix official page

RELATED ARTICLES
- Advertisment -

Most Popular

Recent Comments