Zabbix 1.4.4 From Source On Debian Etch

Want to support HowtoForge? Become a subscriber!
 
Submitted by cmdln (Contact Author) (Forums) on Thu, 2008-02-14 12:32. :: Debian | Monitoring

Zabbix 1.4.4 From Source On Debian Etch 

Originally posted on Zabbix 1.4.4 from source on Debian Etch. This guide will walk you through installing Zabbix 1.4.4 from source on Debian Etch. 1.4.4 has many improvements over what is currently available in apt, and it's not hard so you might as well do it this way. *Note: this walkthrough assumes that you will be running the zabbix database on the same machine as the frontend. You dont have to obviously, just do the mysql setup on whatever db server you are using and point the necessary things to it.

Required Packages: build-essential libmysqlclient-dev libssl-dev libsnmp-dev apache2 libapache2-mod-php5 php5-gd php5-mysql mysql-server

aptitude -y install build-essential libmysqlclient-dev libssl-dev libsnmp-dev apache2 libapache2-mod-php5 php5-gd php5-mysql mysql-server

Zabbix needs to have its own user and group so let's create them (you need to do this as root).

groupadd zabbix
useradd -c 'Zabbix' -d /home/zabbix -g zabbix -s /bin/bash zabbix
mkdir /home/zabbix
chown zabbix:zabbix /home/zabbix

Let's set up the MySQL database for zabbix.

mysql -p -u root
create database zabbix;
grant all on zabbix.* to 'zabbix'@'localhost' identified by 'PASSWORD';
quit;

Where PASSWORD is the password you want zabbix to connect to the database with.

Let's go ahead and grab the zabbix source.

su - zabbix
wget http://internap.dl.sourceforge.net/sourceforge/zabbix/zabbix-1.4.4.tar.gz
tar zxvf zabbix-1.4.4.tar.gz
cd zabbix-1.4.4

Now let's build the source and install zabbix_server and zabbix_agentd.

./configure --prefix=/usr --with-mysql --with-net-snmp --enable-server --enable-agent
make
exit
make install

We need to add the zabbix ports to /etc/services, and create some config files for zabbix.

echo "
zabbix_agent 10050/tcp # Zabbix ports
zabbix_trap 10051/tcp" >> /etc/services
mkdir -p /etc/zabbix
chown -R zabbix:zabbix /etc/zabbix
cp misc/conf/zabbix_* /etc/zabbix
vim /etc/zabbix/zabbix_agentd.conf

ensure Server=127.0.0.1

vim /etc/zabbix/zabbix_server.conf

max_execution_time = 300
date.timezone = UTC
ensure DBHost=localhost or your db host
ensure DBName=zabbix
ensure DBUser=zabbix
ensure DBPassword=ZABBIX_PASSWORD

where ZABBIX_PASSWORD is the password you set when creating db.

The zabbix package has init scripts for Debian and they only need minor modification to get them working so let's use them.

cp /home/zabbix/zabbix-1.4.4/misc/init.d/debian/* /etc/init.d/

Now modify both of those scripts changing

DAEMON=/home/zabbix/bin/${NAME}

to

DAEMON=/usr/sbin/${NAME}

Great; now we just need to get the database schema loaded, and then we need to set up the frontend. Let's load the database schema first.

mysql -u root -p zabbix < /home/zabbix/zabbix-1.4.4/create/schema/mysql.sql
mysql -u root -p zabbix < /home/zabbix/zabbix-1.4.4/create/data/data.sql
mysql -u root -p zabbix < /home/zabbix/zabbix-1.4.4/create/data/images_mysql.sql

Great; now it's just the frontend left. I like to put all of my webaps down in /var/www.

mkdir -p /var/www/zabbix
cp -R /home/zabbix/zabbix-1.4.4/frontends/php/* /var/www/zabbix/
chown -R zabbix:zabbix /var/www/zabbix/*

Create /etc/apache2/sites-available/zabbix with the following content:

<virtualhost>
 ServerName zabbix.fqdn.tld
 DocumentRoot /var/www/zabbix
 <directory>
  Options FollowSymLinks
  AllowOverride None
 </directory>
</virtualhost>

I disable the default site, and enable the zabbix site with a2ensite:

a2ensite zabbix
a2dissite default

Just a few minor edits in /etc/php5/apache2/php.ini:

max_execution_time = 300
date.timezone = UTC

Restart apache, zabbix-server, and zabbix-agent and you should be ready to rock and roll. You will need to browse to your zabbix frontend and complete the web-driven install which should be easy enough.

/etc/init.d/apache2 restart
/etc/init.d/zabbix-server start
/etc/init.d/zabbix-agent start
update-rc.d zabbix-server default
update-rc.d zabbix-agent default

* adapted and updated from http://www.howtoforge.com/zabbix_network_monitoring
Zabbix 1.4.4 from source on Debian Etch

Thanks to petey5000 for catching several typos.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Squaregarden (not registered) on Mon, 2010-01-25 19:51.

Hi cmdln,

thx for the great howto.

Somethings seems wrong with my apache2 config as following error ocurs:

debian:~# /etc/init.d/apache2 restart
Restarting web server: apache2We failed to correctly shutdown apache, so we're now killing all running apache processes. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now! (warning).
 ... waiting .Syntax error on line 1 of /etc/apache2/sites-enabled/zabbix:
<VirtualHost> directive requires additional arguments
 failed!

Could u give me a hint, whats wrong with that?

My config looks like that:

<virtualhost>
 ServerName debian.domain.local
 DocumentRoot /var/www/zabbix
 <directory>
  Options FollowSymLinks
  AllowOverride None
 </directory>
</virtualhost>

Thx and greetz

Squaregarden

Submitted by Anonymous (not registered) on Mon, 2010-02-08 15:56.

You'll need an IP after the VirtualHost.

<Virtualhost 192.168.1.100>
 ServerName debian.domain.local
 DocumentRoot /var/www/zabbix
 <directory>
  Options FollowSymLinks
  AllowOverride None
 </directory>
</virtualhost>

 

Submitted by petey5000 (registered user) on Thu, 2008-02-14 22:49.
few typos on here

mysql -u root -p zabbix < /home/zabbix/zabbix-1.4.4/create/images_mysql.sql

doesnt exist, /home/zabbix/zabbix-1.4.4/create/data/images_mysql.sql does though

Create /etc/apache2-sites-available/zabbix with the following content:

i think this is supposed to be /etc/apache2/sites-available/zabbix


Submitted by vikram (not registered) on Sun, 2011-07-10 09:29.
You missed database name in mysql command 
Try  mysql -u root -ppassword dbname < /path/to/dbname.sql