Configuring Zabbix Client on Linux (RHEL/CentOS)


In my last post, I demonstrated how to install & set-up Zabbix server on Linux. In this tutorial, I will explain to you how to configure our Linux client nodes that we want to be monitored by Zabbix. So, let’s start πŸ™‚

Install SNMP.

As I had mentioned in the last post, Zabbix depends on SNMP(Server Network Monitoring Protocol). So, we need to install net-snmpd package on all the client nodes. Also, configure it to run at server boot-up.

[root@server zabbix]# yum install net-snmpd* -y
[root@server zabbix]# service snmpd start
[root@server zabbix]# chkconfig snmpd on

Install Zabbix Agent.

Now we need to install Zabbix & its agent packages. These are available from Zabbix official website as RPM files. Just make sure to install the same version as Zabbix server. In this tutorial, I have used version 2.4.5.

Configure Zabbix.

Log-on to your Zabbix server & open the browser. Now open localhost/zabbix. Now click Configuration tab & then click Hosts. By default, your Zabbix server will be listed here. If you want to edit/enable your server, click its link. Leave the options as default, just check the Enabled check-box. Next tab is Templates. Here we can define what we want to monitor. Add the templates from the list. Not all templates are applicable to your server. Choose Template App Zabbix Server, Template App Zabbix Agent & Template OS Linux to get started. Of course, you may choose any template that you want. Feel free to experiment πŸ˜‰ Once you are done, click Update to save the changes.

Zabbix Configuration

Zabbix Configuration1

Zabbix Configuration2

Zabbix Configuration9

Zabbix Configuration8

Zabbix Configuration7

To configure clients, go back to the home-page. Click Configuration tab & then click Hosts link. Then click Create host link to add your node to be monitored. Just make sure to enter the IP address of the node. Rest of the configuration is just the same. Do it for all the nodes you wish to monitor.

As with any other monitoring software, Zabbix needs some time before it starts displaying meaningful graphs. With insufficient data, it will show only blank graphs with “no data”. Wait for 15-20 minutes & then we can see our beautiful graphs like below πŸ˜€

These are my graphs πŸ˜‰

Zabbix Configuration3

Zabbix Configuration4

Zabbix Configuration5

Zabbix Configuration6

Install & Setup Zabbix Monitoring Server on Linux (RHEL/CentOS)


In my previous 2 posts, I had shown you how to setup Cacti monitoring server & configure it to monitor Linux clientΒ machines. In this post, I will explain to you how to install & setup Zabbix monitoring server on Linux. This post will be 1stΒ half of this series. In 2nd post, I will explain how to configure Zabbix server & agents(clients).

Zabbix is an agent-based(Zabbix agent is to be installed on all nodes that we wish to monitor) server Monitoring &Β alerting tool available for a variety of OS. Unlike Cacti, Zabbix can also notify you of incidents/errors through Email,Β SMS & Jabber. You can customize when would you like to receive alerts. And of course, you would need a mail server toΒ receive alert emails. Much like Cacti, Zabbix is also PHP-Apache-MySQl based application & plots graphs using the dataΒ stored in its MySQL database.

Let’s begin this step-by-step tutorial now πŸ™‚

Install required packages.

I am listing a few pre-required packages below. If there is something missing, then Zabbix willΒ show that at the time of Zabbix front-end installation. Make sure all components are installed for PHP & MySQL.

php
mysql
httpd
net-snmp.x86_64
net-snmp-devel.x86_64
net-snmp-utils.x86_64

Start the respective services & make sure to enable them to start at boot-up.

Create the zabbix group & user.

Issue below commands to get this done.

[root@server zabbix]#groupadd zabbix
[root@server zabbix]#useradd -g zabbix zabbix

Download Zabbix.

Download it from Zabbix official website. This tutorial explains installing using source code. So,Β download the source tarball & copy it to any location of your choice. Now unpack it. In my setup, its /shashank/zabbix.

[root@server zabbix]# tar -xf zabbix-2.4.6rc1.tar.gz

Then go inside the unpacked directory.

[root@server ~]# cd /shashank/zabbix/zabbix-2.4.6rc1

Now issue below command to configure its installer. You might run into a few errors related to libcurl & libxml

[root@server zabbix]# ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --withΒ libxml2

If you run into errors related to libcurl & libxml, then install libxml2-devel.x86_64 & libcurl-devel.x86_64 packages &Β re-issue above command. It will be successfully configured now πŸ™‚

Install Zabbix.

Now that installer is ready, its time to install it. Just issue make install & go have a cup of coffee orΒ something to eat πŸ˜‰ Its quite time-taking step πŸ™‚

Create Zabbix database & its database user.

Time to setup database for Zabbix. For this, log in to MySQL as root & issue below queries.

[root@server ~]# mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '';
mysql> quit;

Let’s populate Zabbix database with pre-defined SQL scripts. Exit from MySQL prompt & issue below commands on the shell.

[root@server ~]# mysql -uzabbix -p zabbix < database/mysql/schema.sql
[root@server ~]# mysql -uzabbix -p zabbix < database/mysql/images.sql
[root@server ~]# mysql -uzabbix -p zabbix < database/mysql/data.sql

A note about Zabbix agent : – Zabbix agent is a package/service that is used to send data to Zabbix server. If we needΒ Zabbix server to monitor itself, the agent needs to be enabled on the server as well(that’s why I enabled it while configuring).

Copy PHP scripts to Apache Document Root.

Create zabbix directory in your Apache’s Document Root & then copy Zabbix PHP scriptsΒ to it.

[root@server zabbix]# cp -r /shashank/zabbix/zabbix-2.4.6rc1/frontends/php/* /var/www/html/zabbix

Edit configuration files.

For some reason, I needed to edit 2 configuration files for both server & agent. One, whereΒ Zabbix was unpacked & two, where Zabbix was installed(usr/local/etc).

[root@server php]# locate zabbix_agentd.conf
/shashank/zabbix/zabbix-2.4.6rc1/conf/zabbix_agentd.conf
/usr/local/etc/zabbix_agentd.conf
[root@server php]# locate zabbix_server.conf
/shashank/zabbix/zabbix-2.4.6rc1/conf/zabbix_server.conf
/usr/local/etc/zabbix_server.conf

So edit these 2 files with required information. zabbix_server.conf holds database information. Most of the values areΒ commented out. Just uncomment the DBPassword line & enter the password. The values mentioned here will be used while installing Zabbix front-end.

zabbix_agentd.conf file defines the hostname/IP address of Zabbix server to be used. In our example, currently, ZabbixΒ server is monitoring itself. So, mention the hostname & IP address of Zabbix server here.

Below are the contents of my conf files.

Server Configuration File.

### Option: DBName
# Database name.
# For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.
#
# Mandatory: yes
# Default:
# DBName=

DBName=zabbix

### Option: DBSchema
# Schema name. Used for IBM DB2 and PostgreSQL.
#
# Mandatory: no
# Default:
# DBSchema=

### Option: DBUser
# Database user. Ignored for SQLite.
#
# Mandatory: no
# Default:
# DBUser=

DBUser=zabbix

### Option: DBPassword
# Database password. Ignored for SQLite.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=zabbix

Agent Configuration File.

### Option: Server
# List of comma delimited IP addresses (or hostnames) of Zabbix servers.
# Incoming connections will be accepted only from the hosts listed here.
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally.
#
# Mandatory: no
# Default:
# Server=

Server=192.168.0.123

### Option: Hostname
# Unique, case sensitive hostname.
# Required for active checks and must match hostname as configured on the server.
# Value is acquired from HostnameItem if undefined.
#
# Mandatory: no
# Default:
# Hostname=

Hostname=server

Start Zabbix server & its agent.

Just issue zabbix_server & zabbix_agentd commands to start it.

Install Zabbix web front-end.

Follow below instructions to install Zabbix front-end.

Disable your SELinux by issuing setenforce 0 command. Then, point your browser to localhost/zabbix. You will see below screen. Click Next now.

Zabbix Installaiton & Configuration (1)

Zabbix Installaiton & Configuration (2)

At this step, you will most probably see errors (Fail in red) on the installation screen. Some of these errors is due to incorrect settings inΒ /etc/php.ini file. Just click the error links to find out what to modify & then edit/etc/php.ini file to fix the issues. ForΒ some reasons, I wasn’t able to setup Zabbix correctly using IST timezone in/etc/php.ini.

So, I set date.timezone = GMT. Other errors are due to missing PHP modules. If you see gd, bcmath, xmlreader/writer/ mbstring errors, then install bcmath &Β mbstring rpm packages. I have downloaded these packages from the internet. They were not found in my YUM repository. Make sureΒ to choose/search for rpm files relevant to your PHP version. In my case, it was PHP 5.3.3-3.el6_1.3.

xmlreader/writerΒ modules are available as YUM packages. Just do a yum install php-xml.x86_64 -y & yum install php-gd.x86_64 -y.

Now click Retry button after restarting httpd service. You will see all the required fields in green & you can move forward toΒ install Zabbix front-end. Just follow the instructions πŸ™‚

Zabbix Installaiton & Configuration (3)

Issues fixed.

Make sure to use the same details as in zabbix_agentd.conf fileΒ for the database.

Zabbix Installaiton & Configuration (4)

Leave it as it is.

Zabbix Installaiton & Configuration (5)

Zabbix Installaiton & Configuration (6)

If it says Fail, Download the configuration file & place it at the location mentioned.

Zabbix Installaiton & Configuration (7)

Zabbix Installaiton & Configuration (8)

Login with credentials Admin/zabbix.

Zabbix Installaiton & Configuration (9)

Congratulations!!! Zabbix has been installed & setup successfully πŸ™‚

Zabbix Installaiton & Configuration (10)

That’s all for this post πŸ™‚ Zabbix is up & running fine. In the next post of this tutorial, I will explain how to configure Zabbix agent to start monitoring Linux client nodes.

Till then, see you πŸ™‚