Bobcares

Monitor Your Network with Zabbix Monitoring Solution : Installation HOWTO

by | Feb 18, 2009

A Web Host has to actively monitor all the services running on each of its Internet Servers. Customers assume that the services advertised by the host are available 24/7, and hence Internet servers monitoring takes a high priority in the Web Hosting business world. A Web Host can be sure that all promises are being kept through an effective server monitoring system. A software installed on one server which can remotely monitor your Internet servers becomes the best solution. There are Commercial and Free options.

 

Hire Bobcares Linux Server Administrators
Get super reliable servers and delighted customers

See how we do it!

 

 

Zabbix, which has both free and commercial support, is a high-class open source distributed monitoring solution. Zabbix is a network management system application used to monitor and track the status of various network services, the server health and integrity, and other network hardware. It also allows support to configure e-mail alerts for an event which will help them to quickly react to any server problem. Zabbix has a very good graphic visualization and it plays an important role in monitoring a small batch or a multitude of servers.

In order to store data, Zabbix uses MySQL, PostgreSQL, SQLite or Oracle database engine. This article deals with the Installation and access mechanism of Zabbix.

Table of Contents

  1. Installation of Zabbix
  2. Zabbix Monitoring System Access
  3. Conclusion

1. Installation of Zabbix

As a pre-requisite, make sure that you have the following packages installed on your machine.

http, mysql, gcc, mysql-server, mysql-devel, net-snmp, net-snmp-utils, net-snmp-devel, net-snmp-libs, curl-devel, mak, ntp, php – with bcmath, gd and mysql support

You can use the Yum installer to install the above packages.
yum -y install package-name

Startup the time server for syncing the time between devices:
/etc/init.d/ntpd start

Download and Install fPing –

wget http://dag.wieers.com/rpm/packages/fping/fping-2.4-1.b2.2.el5.rf.i386.rpmrpm -Uvh fping-2.4-1.b2.2.el5.rf.i386.rpmchmod 7555 /usr/sbin/fping

Create Zabbix user –

useradd zabbix

Download Zabbix and Untar it –

wget http://jaist.dl.sourceforge.net/sourceforge/zabbix/zabbix-1.4.4.tar.gztar -xzvf zabbix-1.4.4.tar.gz

Grant zabbix database access to the corresponding user –

mysql -u root -pmysql> CREATE DATABASE zabbix;mysql> GRANT DROP,INDEX,CREATE,SELECT,INSERT,UPDATE,ALTER,DELETE ON zabbix.*TO zabbixmysqluser@localhost IDENTIFIED BY 'zabbixmysqlpass';

Create the DB Schema –

cd zabbix-1.4.4cat create/schema/mysql.sql | mysql -u zabbixmysqluser -pzabbixmysqlpass zabbixcat create/data/data.sql | mysql -u zabbixmysqluser -pzabbixmysqlpass zabbixcat create/data/images_mysql.sql | mysql -u zabbixmysqluser -pzabbixmysqlpass zabbix
Zabbix has a very good graphic visualization and it plays an important role in monitoring a small batch or a multitude of servers.

Configuring Zabbix server –

./configure –enable-server –prefix=/usr/local/zabbix –with-mysql –with-net-snmp –with-libcurlmake installmake clean

Compile the Zabbix agent –

./configure –enable-agent –prefix=/usr/local/zabbix –enable-staticmake install

Add Zabbix server and agent ports to /etc/services file – >

echo "zabbix_agent 10050/tcp" >> /etc/servicesecho "zabbix_trap 10051/tcp" >> /etc/services

Copy sample .conf files to /etc/zabbix/ for server and agentd –

cd /etc/mkdir zabbixcp misc/conf/zabbix_agentd.conf /etc/zabbixcp misc/conf/zabbix_server.conf /etc/zabbix

Modify the .conf files as per requirements. In /etc/zabbix/zabbix_server.conf file, change the following –

DBUser=zabbixmysqluserBPassword=zabbixmysqlpasswordDBSocket=/var/lib/mysql/mysql.sockFpingLocation=/usr/sbin/fping

Changes in /etc/zabbix/zabbix_agentd.conf file –

Server=127.0.0.1,your.zabbix.server.IPHostname=EnterTheHostNamecp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentdcp misc/init.d/redhat/zabbix_server_ctl /etc/init.d/zabbix_server

Changes in /etc/init.d/zabbix_agentd and /etc/init.d/zabbix_server files –

BASEDIR=/usr/local/zabbix

In the file /etc/init.d/zabbix_agentd, add the following on the top just after #!/bin/sh

# chkconfig: 345 95 95# description: Zabbix Agentd

In the file /etc/init.d/zabbix_server, add the following on the top just after #!/bin/sh

# chkconfig: 345 95 95# description: Zabbix Server

Configuring auto start and stop of services for different run levels –

chkconfig --level 345 zabbix_server onchkconfig --level 345 zabbix_agentd onchkconfig --level 345 httpd onchkconfig --level 345 mysqld onchkconfig --evel 0123456 iptables off

At the end of this step, please make sure that connections to ports 10050 and 10051 are allowed in the firewall settings. Re-check the firewall rules.

Copy the Zabbix front-end file(s) to the server’s DocumentRoot –

cp -r frontends/php /var/www/html/zabbix

Modify the /etc/php.ini file with the following –

max_execution_time = 300date.timezone = Asia/Calcutta

Note: Remember to specify your time zone in the above setting. You can obtain the time zone name from http://us2.php.net/manual/en/timezones.america.php

Zabbix has an easy mechanism to add the host or service that needs to be monitored, when compared to other software.

Start Apache server for the changes to take effect –

 /etc/init.d/httpd start 

How to execute the LICENSE –

chmod 777 /var/www/html/zabbix/conf

Access http://your-hostname/zabbix and simply follow the instructions.

While you run the steps, you will have to setup the /var/www/html/zabbix/php/conf/zabbix.conf.php file. A sample file would look like how it is shown below –

global $DB_TYPE, $DB_SERVER, $DB_PORT, $DB_DATABASE, $DB_USER, $DB_PASSWORD,$IMAGE_FORMAT_DEFAULT;$DB_TYPE	= "MYSQL";$DB_SERVER	= "localhost";$DB_PORT	= "0";$DB_DATABASE	= "zabbix";$DB_USER	= "zabbixmysqluser";$DB_PASSWORD	= "zabbixmysqlpass";$IMAGE_FORMAT_DEFAULT	= IMAGE_FORMAT_PNG;

Once the installation is complete, execute the following steps –

chmod 755 /var/www/html/zabbix/confmv /var/www/html/zabbix/setup.php /var/www/html/zabbix/setup.php.bk/etc/init.d/zabbix_agentd start/etc/init.d/zabbix_server start

2. Zabbix Monitoring System Access

http://your-hostname/zabbix/

Login into the Admin area using “admin” as user name. It does not require password at this point, and you can set the login password after you are inside the portal.

If http://your-hostname/zabbix/ does not show anything, it is possible that the php-pear module isn’t installed. In that case, you should consider installing php-pear using the Yum installer.
yum -y install php-pear

You might also want to verify the error logs to spot the exact point of error.

Refer Zabbix tutorial to get more information –
http://www.zabbix.com/manual/

Note: Remember to change zabbixmysqlpass and zabbixmysqluser with preferred values.

3. Conclusion

Zabbix is a software which you can learn quickly and when all is done, it is a complete tool. It combines several functions that are left out of other monitoring software and has a good data collection system. Zabbix has an easy mechanism to add the host or service that needs to be monitored, when compared to other software. It also allows you to build your own maps of different network segments while monitoring many hosts. It has also been reported that Zabbix Windows agent is very easy to install.

Reference:

http://www.zabbix.com/


About the Author :

Joseph Symon has been with Bobcares for more than two years. He has marked his presence in the company through his contributions towards enriching the knowledge level in the company. He is a Linux expert, and specializes in installing and configuring systems and customizing them for specific needs. Joseph is highly passionate about learning new technologies.


6 Comments

  1. karem

    i will try it but i want ask nagios have tool to add it in fire fox what about zabbix?

  2. Primiparo

    this is for Joseph Symon :
    About this step : /etc/init.d/ntpd start

    First all, very good guide. !!.
    I´m installing zabbix server V.1.6 to monitor servers in my internal network. This step is obligatory…?
    At this time, the ntpd is stop in the server where I am installing, and it´s possibly that clocks of the servers that I monitor differ in a few minutes.

    What are you recommends me….?

  3. Joseph Symon

    Hello Primiparo,

    It is important that the time between your devices to be in sync. So it is better to start the ntpd in the zabbix installed server.

  4. Liju

    Hello,

    Nice article…. But I prefers nagios for server monitoring which has lightweight architecture and Cacti will also provide good rrd graph about system resources.

  5. Floost

    I read a few topics. I respect your work and added blog to favorites.

Never again lose customers to poor
server speed! Let us help you.