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 you how to configure our Linux client nodes that we want to be monitored by Zabbix. So, lets start 🙂

Install SNMP. As I had mentioned in 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 system 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. Ofcourse, 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 showed you how to setup Cacti monitoring server & configure it to monitor Linux client machines. In this post, I will explain 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.

Lets 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.


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

Create 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 to its 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 🙂

Build Zabbix database & user. Time to setup database for Zabbix. For this, login 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;

Lets populate Zabbix database with pre-defined SQL scripts. Exit from MySQL & issue below commands on 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, agent needs to be enabled on 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 & copy Zabbix PHP scripts to it. Below directory is where I had unpacked my Zabbix tarball.

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

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
[root@server php]# locate zabbix_server.conf

So edit these 2 files with required information. zabbix_server.conf holds database information. Most of the values are default. Just uncomment db password line. 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 contents of my conf files.

Agent Configuration File.

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


### 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=


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

Server 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 '', '::', '::ffff:' are treated equally.
# Mandatory: no
# Default:
# Server=


### 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=


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 installation screen. A few errors are due to incorrect settings in /etc/php.ini file. Just click the error links to find out what to modify & then edit php.ini file to fix the issues. For some reasons, I wasn’t able to setup Zabbix correctly using IST time zone in php.ini. So, I set date.timezone = GMT. A few 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 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 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 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)

Congartulations!!! Zabbix has been installed & setup successfully 🙂

Zabbix Installaiton & Configuration (10)

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

Till then, see you 🙂

Cacti Client Configuration on RHEL/CentOS

In my last post, I showed you how to install & setup Cacti Monitoring server on RHEL/CentOS. Here I will demonstrate how we can configure Cacti clients that will be monitored centrally through Cacti server.

First of all, as I mentioned in last post, install net-snmp package on all the nodes that you want to monitor by issuing yum install net-snmp command. Then, start snmpd service by executing service snmpd service. Make sure to execute chkconfig snmpd on so that the service starts at boot time.
One point worth noting is that if you have nodes in different zones, then you will need to open UDP port 23 (change it in accordance to your setup, that I will describe in a while) from firewall, if it is present.

Lets now edit the /etc/snmp/snmpd.conf file on Cacti Server to allow clients to talk to Cacti. Backup the existing file, nullify it & paste below contents in the file. IP address is of our Cacti Server itself. cacti_snmp is community name that is used in case we choose SNMP version other than Not in Use. This has been explained later in this post. You can include the whole network by using network subnet.

com2sec AllUser cacti_snmp

# Map 'ConfigUser' to 'ConfigGroup' for SNMP Version 2c
# Map 'AllUser' to 'AllGroup' for SNMP Version 2c
# sec.model
group AllGroup v1 AllUser

# Define 'SystemView', which includes everything under . (or .
# Define 'AllView', which includes everything under .1
# incl/excl subtree
view SystemView included .
view SystemView included .
view AllView included .1

# Give 'ConfigGroup' read access to objects in the view 'SystemView'
# Give 'AllGroup' read access to objects in the view 'AllView'
# context model level prefix read write notify
access AllGroup "" any noauth exact AllView none none

rocommunity cacti_snmp

Restart snmpd service.

Now that snmpd package has been installed & configuration file has been edited, lets come back to Cacti server & launch its web front-end by pointing browser to localhost/cacti. Then follow below instructions to configure clients.

Click Devices on left side of screen. Then click Add.

Cacti Client Configuration

Cacti Client Configuration1
Now fill in the details of your client node. Enter IP address or FQDN in second field. In third field, choose Local Linux Machine from drop-down list. Choose Not in Use as SNMP version. Leave other fields as default. Click Save.

Cacti Client Configuration2

Cacti Client Configuration3

Go back to homepage & click Devices to see the newly added device. It must show Up as status. If its down or unknown, then make sure your node is up, snmpd is running & is accessible through Cacti server (ping it to check).

Cacti Client Configuration4

After confirming the Up status, Click the node you want to create graphs for. Then click Create Graphs for this Host link.

Cacti Client Configuration5
Then choose the graphs you want to be shown by selecting from the drop-down list. Then click Create.

Cacti Client Configuration6

By default, we only see graphs for localhost. So, in order to see graphs for all the nodes, we need to add them to the Graph Tree. For this, go back to homepage & click Graph Trees. Then click the Default Tree link & then click Add. Select Host as Tree Item Type from drop-down list. Click Create.

Cacti Client Configuration7

Cacti Client Configuration8

Cacti Client Configuration9

Cacti Client Configuration10

Voila 😉 Cacti clients are now configured 🙂 You can see graphs for all your client nodes through Cacti Monitoring Server 🙂 You may wish to explore it on your own now 😉

And oh!! Below are few of my beautiful graphs for localhost & client node 😉 🙂

Cacti Graph

Cacti Graph1

Cacti Graph2

Cacti Graph3

Install & Setup Cacti On RHEL/CentOS

Hi There!! Hope you have been doing well 🙂

Today I will explain you how to install & setup Cacti Monitoring server on an RHEL/CentOS machine.
Cacti is an agent-less, open-source Apache-PHP-MySQL webserver based monitoring application. You can use Cacti to monitor performance of your Linux servers from a single location i.e. Cacti Server. It shows the data in the form of graphs for various performance parameters like CPU usage, RAM, Disk Space utilization, Number of processes, Ping statistics & many others. Cacti consists of PHP scripts that pull data from servers being monitored & store in its MySQL database. Then these PHP scripts plot the graphs using that data.

Cacti is an agent-less tool based on SNMP(Server Network Monitoring Protocol) which means we don’t have to install Cacti agent on all individual servers that we want to be monitored. We just need snmpd(SNMP daemon) package to be installed on all our client servers that Cacti server will monitor. I will come to Cacti client’s configuration in next post. In this post, I will only focus on Cacti server. Lets start with Cacti server setup 🙂

Install required software. Since Cacti depends on a lot of software, lets list down all the packages that need to be installed first. We need to install below mentioned packages.


Create cacti user. Create cacti user & assign its password. I have already created it.

[root@server ~]# id -a cactiuser
uid=513(cactiuser) gid=515(cactiuser) groups=515(cactiuser)

Download & Install Cacti from its official site. Cacti tarball consists of PHP & MySQL scripts. Just unpack it to your Apache’s Document Root (by default, its /var/www/html). You may wish to rename cacti directory as it consists of version number in its name. Install Apache first, if not already installed. Change ownership to cactiuser for this directory.

[root@server ~]# tar xzvf cacti-0.8.8e.tar.gz
[root@server ~]# chown -R cactiuser.cactiuser /var/www/html/cacti
[root@server ~]# ls -ld /var/www/html/cacti/
drwxr-xr-x. 13 cactiuser cactiuser 4096 Jul 18 20:01 /var/www/html/cacti/

Setup MySQL Database. As we know Cacti fetches data from servers & stores in MySQL database, we need to create a database for Cacti here. Install MySQL if its not installed & start mysqld service.

[root@server ~]# mysqladmin -uroot -p create cacti

Now we will need to create a user for Cacti database & grant it privileges.

[root@server ~]# mysql -uroot-p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.1.52 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiusr';

mysql> flush privileges;

Now that Cacti database user is ready, lets execute a few MySQL scripts to build up the database. Below command imports the database objects from cacti.sql script to cacti database.

[root@server ~]# mysql -uroot -p  cacti < /var/www/html/cacti/cacti.sql

Now edit the file /var/www/html/cacti/include/config.php to update the database details as below.

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiusr";
$database_port = "3306";
$database_ssl = false;

Cacti is ready to fetch data & store it. But we need to setup the polling interval first.

Setup polling interval. Polling means the time after which Cacti will pull data to be graphed. As you would have guessed it, we need to setup a cron job for this. We will do it in cactiuser’s cron because for some reason, I was not able to run Cacti cron job with root user. Below is the syntax of this cron.

[root@server cacti]# crontab -l -u cactiuser
*/5 * * * * /usr/bin/php -q /var/www/html/cacti/poller.php > /dev/null 2>&1

If everything is done properly, we can now install Cacti web front-end (I told you, Cacti runs as a web application).

Install Cacti web front-end. Restart Apache service & then open your browser. Enter this address http://localhost/cacti

You will see the installation screen like below. Just follow the instructions & go on to install it.

Cacti Installation on Linux (2)

Cacti Installation on Linux (3)

At this point, you will be shown if all pre-required Cacti components are installed or not. if everything is installed properly, you will see it highlighted in green. If not, then make sure the pre-required packages are installed.

Cacti Installation on Linux (1)

Once the front-end is installed, it will ask you to enter the Admin password. Credentials are admin/admin. You will be forced to change it at this step.

Cacti Installation on Linux (4)

Cacti is now successfully installed 🙂 We will have to wait for some time so that poller collects the data for graphs. Click on graphs tab and you will see options to see various graphs.

Cacti Installation on Linux (5)

Since my VM doesn’t run continuously for hours or days, my graphs are not that good-looking 😉 By default, only the localhost will be monitored.

Cacti Installation on Linux (6)

For client servers, there will be additional configurations that I will discuss in next post. Till then, keep playing with it 🙂