Content

Zabbix 3.0 on CentOS 6

Zabbix 3.0 is the enterprise-level software designed for monitoring availability and performance of IT infrastructure components. It is open source without any cost. We will install it in a server and then install a client system in a separate machine that will be monitored by the server.

The prerequisites for installing it is to have LAMP server is already configured.

1. Install LAMP

Let us first install and configure LAMP stack on the server starting with apache.
Install Apache

# yum install httpd httpd-devel

Install Apache

 

Install MySQL

# yum install mysql mysql-server

Install MySQL

 

Install PHP

# yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml

Install php

 

Enable Apache and MySQL during boot.

# chkconfig httpd on
# chkconfig mysqld on
# service httpd start
# service mysqld start

Run httpd and mysql during boot

 

Execute mysql secure installation script to make it secure.

# mysql_secure_installation

Configure IPTABLE to allow traffic to apache. Execute the following command in the terminal terminal to allow traffic to port no 80

# iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# service iptables save
# service iptables restart

LAMP server is configured in your server.

 

2. Install Zabbix 3.0 repository

To install it, add EPEL repository, download the EPEL rpm repository using wget and then install it using rpm -ivh

# wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm

Install EPEL repository

 

3. Install Zabbix 3.0

Now update the repository and install it.

# yum update 
# yum install zabbix-server-mysql zabbix-agent zabbix-web-mysql

Install zabbix server

 

The server is installed in your system, let us now configure it.

4. Configure Zabbix 3.0

We will first create a MySQL database and a mysql user.

# mysql -u root -p
# create database zab;
# GRANT ALL ON zab.* TO zab-user@localhost IDENTIFIED BY 'somepassword';
# flush privileges;
# exit

Now import templates to the database

# mysql -uzab -p somepassword < /usr/share/doc/zabbix-server-mysql-1.8.22/create/schema/mysql.sql
# mysql -uzab -p somepassword < /usr/share/doc/zabbix-server-mysql-1.8.22/create/data/data.sql
# mysql -uzab -p somepassword < /usr/share/doc/zabbix-server-mysql-1.8.22/create/data/images_mysql.sql

Edit the file /etc/zabbix/zabbix_server.conf, Write the database name, user and password that you’ve created in step 3

[...]
DBName=zab
[...]
DBUser=zab-user
[...]
DBPassword=somepassword
[...]

Also edit file /etc/zabbix/zabbix_agentd.conf and edit the server hostname.

[...]
Hostname=Demo server
[...]

Though it is not mandatory to configure hostname but setting this value can easily let you choose a particular host when the server is monitoring large no of clients.

Edit PHP setting and uncomment/add following values

max_execution_time = 600
max_input_time = 600
memory_limit = 512M
post_max_size = 32M
upload_max_filesize = 16M
date.timezone = Asia/Singapore

Set timezone for zabbix

 

Configure IPTABLE to allow traffic to ports 10050 and 10051. Edit /etc/sysconfig/iptables and add the following lines

[...]
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT
[...]

Configure firewall for zabbix

 

Restart IPTABLE service to reload new configuration.

# service iptables restart

Restrict webconsole

If you want to restrict web console to particular IP address/ranges then edit /etc/httpd/conf.d/zabbix.conf and add “Allow from” directive inside <directory>…</directory> tag

Alias /zabbix /usr/share/zabbix
<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from 192.168.3.11/24 or Allow from all
</Directory>

Configure zabbix apache

 

Our settings allow web console to be accessed from anywhere. Start/Restart the following services and configure them to start on reboot.

# service zabbix-server start
# service zabbix-agent start
# service httpd restart
# service mysqld restart
# chkconfig zabbix-server on
# chkconfig zabbix-agent on

Start all services

 

5. Web Installer

Access web installer using http://demohost.com/zabbix/ and follow the steps as per given instructions.

 

Zabbix installation welcome page

 

Click “Next”
Zabbix installation accept licence

 

Accept license and click “Next”

 

Zabbix installation check prerequisite

 

Check for all prerequisite and click “Next”

 

Zabbix installation configure DB connection

 

Provide MySQL database details/user/password, test the connection and click “Next”

 

Set zabbix server details

 

Set host name and port no. We will keep the default port no as we have already added this port number to IPTABLE.

 

zabbix installation pre installation summary.png

 

Check the pre-installation settings / parameters and click “Next”

 

Install Zabbix

 

Click “Next”

 

Zabbix installation complete

 

The installation is now complete. Click Finish to complete the installation. You’ll be redirected to the login page. Provide the username and password. The default username/password is admin/zabbix.

 

Zabbix login page

 

Click “Enter”, You will be redirected to dashboard.

 

Zabbix admin dashboard

 

Activate the server. The server is by default deactivated from being monitored. To activate it, go to Configuration and then Hosts. Select the host by the name and choose Activate selected from the drop-down box and click Go.

 

Activate Zabbix server

 

You should find that the host is being monitored

 

zabbix host status updated

 

6. Client side configuration

Now we will install agent in client systems. Install the client packages on Fedora/RHEL clients, execute the following command in the terminal. Here for simplicity we will choose the server itself ( demohost.com )as client system. You can replicate the following steps in any client system in the network.

# sudo yum install zabbix-agent

On Ubuntu/Debian clients:

# sudo apt-get install zabbix-agent

Next edit file /etc/zabbix/zabbix_agentd.conf and add the following lines in it. Add the server IP address and client hostname.

[...]
Server=demohost.com
[...]
Hostname=Demo client
[...]

Configure zabbix client

 

Where, demohost.com is the server that we have installed in step 4

Restart  the agent

# sudo service zabbix-agent start

Restart zabbix agent

 

Add Monitoring host
Navigate to dashboard. Click Configuration and then Hosts and finally Click on Create Host on the right side.

 

Create Host

 

Provide hostname, groups and IP address, the agent port no as shown below. When you click “Add” button ( numbered 7), a pop-up window will appear to select the template. We will select “Linux template”( numbered 8 in the image). And finally click the “Save” button ( numbered 9 )

 

Provide zabbix client details

Select template linux

 

You will now find that new client host is being monitored.

 

Zabbix host added

 

Now you can explore all the options and modify them that suits your requirements on your newly installed Zabbix 3.0 Server.

Was this article helpful to you?

DD2016

Comments are closed.