Network Monitoring with Zabbix

Want to support HowtoForge? Become a subscriber!
 
Submitted by ovis (Contact Author) (Forums) on Fri, 2006-03-10 17:52. :: Monitoring

Network Monitoring With Zabbix

Zabbix has the capability to monitor just a about any event on your network from network traffic to how many papers are left in your printer. It produces really cool grahps.

In this howto we install software that has an agent and a server side. The goal is to end up with a setup that has a nice web interface that you can show off to your boss ;)
It's a great open source tool that lets you know what's out there.
This howto will not go into setting up the network but I might rewrite it one day so I really like your input on this. Much of what is covered here is in the online documentation however if you are like me new to this all this might be of some help to you.

The ZABBIX server requires the following system resources:

  • 10 MB of disk space (100 MB recommended)
  • 64 MB of RAM (128 MB recommended)
  • MySQL or PostgreSQL as backend database
  • Net-SNMP libraries

First we define 2 locations:

The Server, here comes all the info together and is processed in a database, note that the server can be monitored to so it runs an agent too.

The Agent, Information is gathered and polled by the server.

Setup of the Server:

http://prdownloads.sourceforge.net/zabbix/zabbix-1.1beta8.tar.gz?download

1 - Make the zabbix user and group

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

2 - Untar the sources

cd /home/zabbix
tar zxvpf zabbix-1.1beta8.tar.gz
mv zabbix-1.1beta7 zabbix
cd zabbix
chown -R zabbix.zabbix .
su - zabbix

3 - Create a zabbix database and populate it

mysql -p -u root
create database zabbix;
quit;

cd create/mysql
mysql -u root -p zabbix < schema.sql
cd ../data
mysql -u root -p zabbix < data.sql
cd ../../

4 - Configure, compile and install the server

We run an agent on the server to so we compile that too ;)

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

5 - Prepare the rest of the system

As root edit /etc/services.

vi /etc/services

Add:

zabbix_agent 10050/tcp # Zabbix ports
zabbix_trap 10051/tcp

mkdir /etc/zabbix
chown -R zabbix.zabbix /etc/zabbix/
cp misc/conf/zabbix_* /etc/zabbix/

Edit /etc/zabbix/zabbix_agentd.conf:

vi /etc/zabbix/zabbix_agentd.conf

Make sure that the Server parameter points to the server address, for the agent that runs on the server it is like this:

Server=127.0.0.1

Edit /etc/zabbix/zabbix_server.conf:

vi /etc/zabbix/zabbix_server.conf

For small sites this default file will do, however if you are into tweaking your config for your 10+ hosts site, this is the place.

Change this:

# Database password
# Comment this line if no password used

DBPassword=Secret

Start the server :

su - zabbix
zabbix_server
exit

Start the client:

su - zabbix
zabbix_agentd
exit

6 - Configure web interface

Edit frontends/php/include/db.inc.php:

$DB_TYPE ="MYSQL";
$DB_SERVER ="localhost";
$DB_DATABASE ="zabbix";
$DB_USER ="root";
$DB_PWD ="secret";

mkdir /home/zabbix/public_html
cp -R frontends/php/* /home/zabbix/public_html/
cd ../public_html && chown -R zabbix.zabbix .

Edit /etc/apache/httpd.conf:

vi /etc/apache/httpd.conf

Make this work:

<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>

/etc/init.d/apache restart

Setup of an Agent

http://prdownloads.sourceforge.net/zabbix/zabbix-1.1beta8.tar.gz?download

1 - Make the zabbix user and group

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

2 - Untar the sources

cd /home/zabbix
tar zxvpf zabbix-1.1beta8.tar.gz
mv zabbix-1.1beta8 zabbix
cd zabbix
chown -R zabbix.zabbix .
su - zabbix

3 - Configure compile and install the agent

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

mkdir /etc/zabbix
cp misc/conf/zabbix_agentd.conf /etc/zabbix/

Edit /etc/zabbix/zabbix_agentd.conf:

vi /etc/zabbix/zabbix_agentd.conf

Make sure that the Server parameter points to the server address:

Server=xxx.xxx.xxx.xxx

4 - Prepare the rest of the system

Edit /etc/services:

vi /etc/services

Add:

zabbix_agent 10050/tcp # Zabbix ports
zabbix_trap 10051/tcp

5 - Start the agent

su - zabbix
zabbix_agentd
exit

What's next ?

Now point your browser to:

http://www.example.com/~zabbix

Log in with username: Admin
No Password

First go to the tab Configuration and then Hosts.

Now create a host-group, see that you can give it some templates, e.g: Application.MySQL, Host.SNMP, Host.Standalone, Host.Unix.

Then some hosts:

Select your host-group and use Link with Template Host.Unix

Now a lot of triggers are imported and the game begins.

Go to the monitoring tab and watch the latest values roll in.

Here you can really knock your self out.
This howto intended to show you how to install this mother. Configuring the monitoring functions is a whole other ballgame.

For now I leave you here with some pointers to documentation

http://www.zabbix.com/documentation.php
http://sourceforge.net/projects/zabbix
http://www.google.com/search?q=zabbix

Changelog

2006-03-29 Updated to version beta8


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 Anonymous (not registered) on Fri, 2011-05-20 10:37.
The devil with Zabbix is not installing it, but configuring the actual software.  This is the nightmare part.  I'm still trying...
Submitted by Cameron (not registered) on Fri, 2010-01-15 01:35.

Despite being copied far and wide, this "how to" is not terribly useful.  Compiling and installing Zabbix is easy.  You just have to install some libraries (ikseml, net-snmp), and some PHP modules (php5-bcmath, php5-gd, php5-devel...) to make the "WEB" interface work.

Almost all the difficulty in Zabbix is configuration.  There are tons of permission problems, and a bewildering maze of "screens" in the "WEB" interface.  I guess if you want to use Zabbix, you either have to get really lucky, be a really good guesser, or wait for someone to write a book that actually describes how to use it.

I wonder whether the folks who say "you just throw it on the server" have actually tried using it?  Did they run it as root or as some unprivileged user?

 

Submitted by TheFunPart (not registered) on Thu, 2009-03-12 13:40.

"If you don't feel like going through this kind of config (and the typical maintenance) that surrounds these kind of (great) OpenSource products, try out a service from TruePath Technologies (http://truepathtechnologies.com/)! They use opensource software like Zabbix. Nice part is that they setup, maintain it and you get to use it (the fun part!)"

What are you talking about? - The fun part IS the configuration!

Submitted by horus.solaris (registered user) on Wed, 2007-01-17 17:39.

On 64-bit systems,  run:

export LDFLAGS=-L/usr/lib64/mysql

before run configure and make. That will fix the following error during compiling:

/usr/bin/ld: cannot find -lmysqlclient

found on: http://www.zabbix.com/forum/showthread.php?t=3962&highlight=lmysqlclient

HS

Submitted by chrisrbailey (registered user) on Fri, 2006-09-08 01:00.
If you have the SELinux portion of Fedora on your system, you will need to put the PHP frontend somewhere other than the Zabbix user's home directory.  For example, I have it in /usr/share/zabbix.  Otherwise Apache will not be able to access it.
Submitted by Anonymous (not registered) on Wed, 2006-04-12 20:14.

If you don't feel like going through this kind of config (and the typical maintenance) that surrounds these kind of (great) OpenSource products, try out a service from TruePath Technologies (http://truepathtechnologies.com/)! They use opensource software like Zabbix. Nice part is that they setup, maintain it and you get to use it (the fun part!)

Submitted by Anonymous (not registered) on Wed, 2006-04-12 17:10.

I have always used big brother. I tried zabbix but ended up going back to big brother. Just my 2 cents.

Steve,

http://tail-f.net/

Submitted by Anonymous (not registered) on Sat, 2006-03-18 03:16.

yum -y install php-mysql

Submitted by Anonymous (not registered) on Sat, 2006-03-18 02:29.

If you are running an RPM based system you can also use YUM to get the needed packages:

yum -y install mysql-server
yum -y install gcc
yum -y install net-snmp-devel

This is necessary BEFORE you can successfully compile

Submitted by Anonymous (not registered) on Thu, 2006-03-16 13:54.

apt-get install make gcc libsnmp5-dev

This solved the problems I had with compiling.... RayIT