
Install and configure zabbix server and zabbix agent
In this blog, we will explain you the step by step to Install and configure zabbix server and zabbix agent.
Zabbix is an open source software for networks and application monitoring like HTTPD, FTP and etc,.
Zabbix agents are using to monitor remote hosts.
1. Install zabbix requirements LAMP as below.
[root@zabbix ~] # yum install httpd httpd-devel
[root@zabbix ~] # yum install mysql mysql-server
[root@zabbix ~] # yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml
—
Apache installed version:
Server version: Apache/2.4.6 (CentOS)
—
Mariadb version:
mysql Ver 15.1 Distrib 5.5.52-MariaDB, for Linux (x86_64) using readline 5.1
—
PHP version:
PHP 5.6.31 (cli) (built: Jul 7 2017 06:28:10)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
2. Start the services.
[root@zabbix ~] # service httpd start
[root@zabbix ~] # service mysqld start
3. Configure YUM repository.CentOS/RHEL 7:
# rpm -Uvh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm CentOS/RHEL 6: # rpm -Uvh http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-release-3.2-1.el6.noarch.rpm
4.Install Zabbix Server with MySQL.
[root@zabbix ~] # yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway
5. Configure MySQL and create database for Zabbix server.
[root@zabbix ~] # mysql_secure_installation
MariaDB [(none)]> create database zabbix;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@’localhost’ identified by ‘password’;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@’%’ identified by ‘password’;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
[root@zabbix ~]# cd /usr/share/doc/zabbix-server-mysql-*/
[root@zabbix zabbix-server-mysql-3.2.0]# gunzip create.sql.gz
[root@zabbix zabbix-server-mysql-3.2.0]# mysql -u root -p zabbix < create.sql
Enter password:
Configure and start Zabbix Server.
[root@zabbix ~]# vi /etc/zabbix/zabbix_server.conf
# line 82: add
DBHost=localhost
# line 116: add DB password for Zabbix
DBPassword=password
[root@zabbix ~]# systemctl start zabbix-server
[root@zabbix ~]# systemctl enable zabbix-server
Configure and start Zabbix Agent to monitor Zabbix Server itself.
[root@zabbix ~]# vi /etc/zabbix/zabbix_agentd.conf
# line 95: specify Zabbix server
Server=127.0.0.1
# line 136: specify Zabbix server
ServerActive=127.0.0.1
# line 147: change to the own hostname
Hostname=zabbix.blog.assistanz.com
[root@zabbix ~]# systemctl start zabbix-agent
[root@zabbix ~]# systemctl enable zabbix-agent
Change httpd settings like follows.
[root@zabbix ~]# vi /etc/httpd/conf.d/zabbix.conf
# line 10: add access permittion for Zabbix Web frontend
#Require all granted
Require ip 127.0.0.1 10.0.0.0/24
# line 20: uncomment and change to your timezone
php_value date.timezone Asia/Tokyo
[root@zabbix ~]# systemctl restart httpd
6.Zabbix: Initial setup
URL: http://192.168.226.246/zabbix i.We need to go through these below steps to complete the initial setup.

ii. Installer will check for necessary prerequisites. If everything seems OK, click Next to continue, else go back and install the necessary packages.

iii. Enter the zabbix database name, database user and password and click Test connection. If you entered the correct values, it will show a message that says: OK.
Click Next to continue.

iv. you’ll be redirected to the zabbix web console page. Enter the username and password.
The default username/password is admin/zabbix.

v. Note: If the “zabbix server is running” value status show NO . Then please check and change the SElinux parameters like below :
#setsebool -P httpd_can_network_connect on
#setsebool -P httpd_can_connect_zabbix 1
#setsebool -P zabbix_can_network 1
After all, restart the services:
#service zabbix-server restart
#service httpd restart
7. Activate Zabbix server
Initially, the zabbix server is deactivated from being monitored.
To activate it, go to Configuration -> Hosts. Select the host (zabbix server) and choose Activate selected from the drop-down box and click Go.
Now, you should see your Zabbix server is being monitored.

8. Check Zabbix server Statistics:
To view the screens, go to Monitoring -> Screens from the Zabbix’s dashboard.
9.Client Side Configuration:
Let us install zabbix agent on our client systems.
To install zabbix agent packages on Fedora/RHEL clients, enter the following commands in Terminal:
rpm –import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
rpm -Uvh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-agent-3.2.1-1.el7.x86_64.rpm
[root@webserver] # yum install zabbix-agent -y
i. Configure Clients
Next edit file /etc/zabbix/zabbix_agentd.conf,
sudo vi /etc/zabbix/zabbix_agentd.conf
Add the server ip address and client hostname.
## Specify Zabbix’s server IP address ##
===
Server=192.168.1.150 [Zabbix server IP]
ServerActive=192.168.1.150
Hostname=server.webserver.com [Agent server name]
===
ii. Restart zabbix-agent:
[root@webserver] # systemctl start zabbix-agent
[root@webserver] # systemctl enable zabbix-agent
iii. Add Monitoring hosts
Go to your zabbix server dashboard.
To add a monitoring target, navigate to Configuration -> Hosts. Click on Create Host on the right side.

iv. Next, In the Templates section select your Template.
v. Select the template which is need to monitor. After selecting your Template choice click Select button in the bottom.
vi. In the next window, click Add and click Update buttons.
vii. Now, you will see that the new host has been added to the Monitoring list. That’s it.
viii. If there is any problem in the Client system, you can view them in the main Dashboard of your Zabbix’s server.

Zabbix installation and configuration is completed now.

D KarthiKeyan