Friday, January 18, 2008

Zabbix Installation

This tutorial covers complete installation of Zabbix on a 64 bit and 32 bit Linux Operating System.

1. Download

Download the latest version of Zabbix, from www.zabbix.com.

2. Pre - Requisites

Zabbix runs on any Linux / Unix platforms (32 and 64 bit). It is assumed that the installation of the operating system is done in a standard way.
Building of ZABBIX server or agents from sources requires additional software.

The following software is required to compile ZABBIX:

3. Installation instructions

3.1 Preparation:

Download the Zabbix tarball and put it in directory zabbix in the home directory and untar it.
cd ~/zabbix
tar -zxvf zabbix[tab]
cd zabbix[tab]

· First run userdrake and create a user called 'zabbix', with a group called 'zabbix', no password and shell set to '/usr/bin/false'.

· We assume that MySQL and Apache with mod-php and mod-perl are already installed and working.

Create the MySQL database:

# mysql -uroot -ppassword
> create database zabbix;
> quit;

· Create the database tables:

# cd create/schema
# mysql -uroot -ppassword -Dzabbix <
mysql.sql
# cd ../data
# mysql -uroot -ppassword -Dzabbix <>
# mysql -uroot -ppassword -Dzabbix < images_mysql.sql

· Create a MySQL user for Zabbix:

# mysql -uroot -ppassword -Dzabbix
> grant all privileges on zabbix.* to 'zabbix'@localhost identified by
'zabbixpassword' with grant option;
> quit;

3.2 Compiling Zabbix Server

Now you should be able to compile the Zabbix server:
# cd ../..
# ./configure --enable-server --with-mysql --with-net-snmp
(It usually works fine, but if it gives an error, then try this path : )
# ./configure --enable-server --with-mysql=/mysql-directory/bin/mysql_config --with-net-snmp
# make
# checkinstall
# make install 

· It will be installed in /usr/local/bin:

zabbix_server
3.3 Configure The Server

Create a configuration directory in /etc and create the configuration file using an example:
# mkdir /etc/zabbix
# cp misc/conf/zabbix-server.conf /etc/zabbix

· Edit /etc/zabbix/zabbix-server.conf and change the following lines to suit and be sure to uncomment the password line:

 username = "zabbix"
 password = "zabbixpassword"
 logfile = "/tmp/zabbix-server.log"

· Create the logfile:

# touch /tmp/zabbix-server.log
# chown zabbix:zabbix /tmp/zabbix-server.log

3.4 Test The Server

Run the Zabbix server (as the user “zabbix”) and see what happens:
# zabbix-server
# ps e

You should have 11 threads of the server running.

3.5 Compiling Agent

Untar the Zabbix tarball to a different directory. Note that 'make clean' doesn't work. You cannot successfully build the agent and server in the same directory. Here is the recipe for the agent:
# ./configure --enable-agent 
make
checkinstall
make install

· The binaries end up in /usr/local/bin:

zabix_agent
zabbix_agentd
zabbix_sender
zabbix_sender 

· Copy the configuration file misc/conf/zabbix_agentd.conf to /etc/zabbix and set the server IP address

·The step is not real requirement. However, it is recommended. On the client (monitored) machines, add the following lines to /etc/services:

zabbix_agent 10050/tcp
zabbix_trap 10051/tcp

· You need to configure /etc/zabbix/zabbix_agent.conf for every host having zabbix_agent installed. The file should contain IP address of ZABBIX server. Connections from other hosts will be denied. You may take

/Zabbix-untar-directory/misc/conf/zabbix_agent.conf

as example.


3.6 Install Front End

Copy all the Zabbix front end files to folder in HTDOCS in Apache Directory:
 #mkdir /apache-directory/htdocs/zabbix 
# cp -r /Zabbix-untar-directory/frontends/php/* /apache-directory/htdocs/zabbix
# chown -R apache:apache /var/www/html

3.7 Configure Front End:

Run a browser and go to http://localhost/zabbix/index.php.

· Go over the configuration of the database and generate the configuration file.

· After the wizard is finished, save the configuration file to

# /etc/zabbix/


3.8 Create an External Scripts Folder (if required)

Make a folder for storing the external scripts:
# /etc/zabbix/externalscripts/

· Give the directory read-write access for user “zabbix”

# chmod –R a+rw /etc/zabbix/externalscripts/