How to Install and Setup Zabbix. Part I

Alex Trent By Alex Trent
Expert Author
Article Date:

Zabbix is a network monitoring tool that can aid in development by watching just about any process on your servers. If you’re developing a new network application, you can configure Zabbix to monitor it.

Installing Zabbix is not for the weak. A Zabbix install takes some time and some patience, but when fully set up, it is quite powerful. The example I’ll be basing this install guide on is for CentOS 5.5 using Andrew Farley’s pre-compiled version. Zabbix 1.8.1 requires PHP 5.2, which can be found in the CentOS Testing repo, so I’ll go over how to add that too. Zabbix can be installed using MySQL, Oracle, or SQLite for a database back-end, but for this example, I’ll be using MySQL. This install guide assumes you already have at least Apache and Mysql installed.

Adding a Zabbix repo
First make a repo file for Andrew Farley’s repo like so: myserver # cat /etc/yum.repos.d/andrewfarley.repo ### Name: Andrew Farley’s repo ### URL: [] name = Red Hat Enterprise $releasever – baseurl = enabled = 1 protect = 0 gpgcheck = 0

Add this file to /etc/yum.repos.d/ and just do a yum update. It is not necessary to upgrade any packages unless you want to. Just running the command will grab the new repo info. Make sure there were no errors connecting to the repo.

Adding PHP 5.2
Grab the testing repo from here
Put this file in /etc/yum.repos.d/as well and run a yum updateagain.

Upgrading/Installing PHP 5.2
You’ll need the following packacges:
php-5.2, php-gd, php-bcmath, php-xml, php-mbstring, php-mysql

Install them with:
yum install php php-gd php-bcmath php-xm php-mbstring php-mysql

Installing Zabbix
To install Zabbix you’ll need these packages:
zabbix, zabbix-server, zabbix-frontend-php

Install them with:
yum install zabbix zabbix-server zabbix-frontend-php

Setting up MySQL
Now you’ll need to setup a database for Zabbix. Perform the following:
shell> mysql -u<username> -p<password>
mysql> create database zabbix character set utf8;
mysql> quit;
shell> cd create/schema
shell> cat mysql.sql | mysql -u<username> -p<password> zabbix
shell> cd ../data
shell> cat data.sql | mysql -u<username> -p<password> zabbix
shell> cat images_mysql.sql | mysql -u<username> -p<password> zabbix
Give the Zabbix user control over the database with:
myserver # mysql -p
mysql> grant all on zabbix.* to zabbix;
mysql> grant all on zabbix.* to zabbix@localhost;
mysql> set password for zabbix=password(‘mypassword’);
mysql> set password for zabbix@localhost=password(‘mypassword’);

Setting up Apache
To add the Zabbix web front-end as create the file below:
myserver # cat /etc/httpd/conf.d/zabbix.conf
Alias /zabbix /var/www/html/zabbix-1.8.1
<Directory /var/www/html/zabbix-1.8.1>
DirectoryIndex index.php
Options -Indexes
AllowOverride all
AddType application/x-httpd-php .php
php_flag mb_string on
LogFormat “%h %l %u %t “%r” %>s %b “%{Referer}i”
“%{User-Agent}i”” combined
ErrorLog /var/log/httpd/zabbix.ientry_error_log
CustomLog /var/log/httpd/zabbix.ientry_access_log combined
CustomLog /var/log/httpd/zabbix.ientry_referer_log referer

Starting the Zabbix server
The default config settings in /etc/zabbix/zabbix_server.conf usually
work well except I would change the log directory to
/var/log/zabbix-server and the pid folder to /var/run/zabbix-server.
Make sure to give the Zabbix user control over these folders with
chown zabbix.zabbix /var/log/zabbix-server

Now you can start the Zabbix server with service zabbix-server start

Go to and go through the web setup.

Now all that’s left is to setup the Zabbix agent on the server you want to monitor and then setting up monitoring for the services you want to monitor. I’ll cover this in a follow up article.


About Alex Trent
Alex Trent is a staff writer for WebProNews

Leave a Reply

Your email address will not be published. Required fields are marked *

  • 152×252
  • 160×600
  • Newsletter Signup
    Get The Email Newsletter! Please subscribe using your company email address
  • 336×280
  • 336×130