Month: March 2014

Install Zabbix monitoring on Ubuntu 12.04 LTS

This is how you can install the latest version of Zabbix on Ubuntu 12.04.
You need to install the server version of Ubuntu.

First install prerequisites.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nmap wget curl git build-essential linux-headers-$(uname -r) 

Next create a user and add them to a group:

sudo useradd -g zabbix zabbix
sudo groupadd zabbix

Install a LAMP server:

sudo apt-get install tasksel
sudo tasksel

Go ahead and select the LAMP server:


Get and install Zabbix

During my initial installation I encountered many errors. They are solved by installing these packages upfront:

sudo apt-get install libmysqlclient-dev libxml2-dev libsnmp-dev libcurl4-openssl-dev libssh2-1-dev libssh2-1

Now get the latest Zabbix sources

cd ~/downloads

tar -xvf zabbix-2.2.2.tar.gz
cd zabbix-2.2.2

Next, create a database for Zabbix:

mysql -u  -p
create database zabbix
grant all privileges on zabbix.* to zabbix@localhost identified by '123';

Now create the schema and the tables. You can find the sql scripts in the ~/zabbix/zabbix-2.2.2/database/mysql folder.

cd ~/downloads/zabbix-2.2.2/database/mysql
monitor@monitor:~/$ mysql -u zabbix -p zabbix < schema.sql
monitor@monitor:~/$ mysql -u zabbix -p zabbix < images.sql
monitor@monitor:~/$ mysql -u zabbix -p zabbix < data.sql

We're ready to make the config file now.
As you can see I'm creating a config file for compiling with SNMP, LDAP and SSH support:

monitor@monitor:~/zabbix/zabbix-2.2.2$ ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-ldap --with-ssh2

When all is well (which it should) you get to see this:


Now we're ready to run make install:

sudo make install

When all is done you need to edit the Zabbix agent configuration file /usr/local/etc/zabbix_agentd.conf and the Zabbix server configuration file /usr/local/etc/zabbix_server.conf. You must specify the database name, user and password.

Start the Zabbix server:


Install the frontend

The frontend are just some PHP files we need to copy from the Zabbix install files to the Apache WWW dir.
We also must make the conf dir writeable:

cd /var/www
sudo rm index.html
sudo cp /home/monitor/zabbix/zabbix-2.2.2/frontends/php/* . -a
sudo chmod 777 -R conf

Final configuration

Go to a browser and type in the IP of your Zabbix server.
Next you will encounter these settings whoch are obviously not correct:


edit /etc/php5/apache2/php.ini and adjust it accordingly.


Now all should be well.

You can now finish the configuration and finally logon to Zabbix
Logon with:

username: admin
password: zabbix


Adding the Zabbix server to monitor itself

You need to do the following:
1. add the zabbix user to the sudoers (sudo visudo)

# User privilege specification
root    ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

2. edit the zabbix agent config

sudo vim /usr/local/etc/zabbix_agentd.conf
Hostname=Zabbix server

At this point you should be able to add the local Zabbix server. Go to Configuration -> Hosts -> Ad Host.

Adding the Raspoberry Pi to monitor

sudo apt-get install zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf