Zabbix is an open source software application that can monitor servers, networks, and applications. You can use Zabbix with any of our plans, and it works on every Linux distribution we offer. Full hardware and software requirements can be found on the Zabbix requirements page.
There are two ways to install Zabbix. You can compile and install Zabbix from source, or you can install Zabbix packages, if your distribution supports it.
Installing the packages is faster and makes things easier to maintain, but the installed version might be older than what's available on the Zabbix website. Compiling and installing from source is a longer process, but it works on every distribution, and you'll get the latest version of Zabbix.
If you're running Ubuntu or Debian and would like to install the Zabbix packages, follow these instructions:
Other distributions may also have packages for Zabbix. Check the distribution's website for more information.
Install Zabbix server by entering the following command:
sudo apt-get install zabbix-server-mysql
Install the Zabbix web interface by entering the following command:
sudo apt-get install zabbix-frontend-php
Install the Zabbix agent by entering the following command:
sudo apt-get install zabbix-agent
Zabbix is now installed and running on your Linode.
If you install the Zabbix packages, you do not need to follow the rest of the instructions in this guide.
If you decide not install the Zabbix packages, or your distribution does not support it, use the instructions in the rest of this guide to compile and install Zabbix from source.
You'll need to install some software before you actually install Zabbix itself. It requires a database backend, and in this example we'll use MySQL, but you can also use PostgreSQL, SQLite, Oracle, or IBM DB2. Other mandatory requirements are a C compiler and GNU Make. Optionally, you can also include NET-SNMP for SNMP support, lksemel to enable Jabber messaging, and/or Libcurl to enable the WEB monitoring module.
You'll also want to create a new user to run Zabbix. Here's how:
Create a new user by entering the following command:
sudo adduser zabbix
Add the zabbix user to the admin group by entering the following command:
sudo usermod -a -G sudo zabbix
Start acting as the zabbix user by entering the following command:
su - zabbix
You have successfully added the zabbix user.
You'll first want to install MySQL on your Linode and create a MySQL user for Zabbix. Here's how:
If you haven't already, install and configure MySQL on your Linode. See the MySQL reference manuals for more information.
Log in to MySQL by entering the following command:
mysql -uroot -p
Enter the password for the MySQL root user.
Create a database for Zabbix by entering the following command:
create database zabbix;
Create a MySQL zabbix user to the access the new database by entering the following command, replacing Password with a password:
grant all privileges on zabbix.* to zabbix@localhost identified by 'Password';
Log out of MySQL by entering the following command:
You have configured MySQL for Zabbix.
Zabbix requires Apache and PHP to be installed. Here's how to install them:
Install Apache by entering the following command:
sudo apt-get install apache2
Install PHP and the required modules by entering the following command:
sudo apt-get install php5 php-pear php5-suhosin php5-gd php5-curl php5-mysql
Install other required libraries by entering the following command:
sudo apt-get install libmysqlclient-dev libcurl3-gnutls libcurl3-gnutls-dev
Verify that you have configured a name-based virtual host for Apache. This is required for the Zabbix web interface. For instructions, see Configuring Name-based Virtual Hosts.
The required applications, modules, and libraries have been installed on your Linode.
Now you'll want to make some adjustments to your php.ini file for Zabbix. Here's how:
Open the php.ini file for editing by entering the following command:
sudo nano /etc/php5/apache2/php.ini
Verify that the following settings are set in the php.ini file.
memory_limit = 128M post_max_size = 32M upload_max_filesize = 16M max_execution_time = 600 max_input_time = 600 date.timezone = America/New_York
You can use this webpage to find the correct date.timezone value.
Save the changes by restarting Apache. Enter the following command:
sudo service apache2 restart
PHP is now configured for Zabbix.
You'll need a C compiler and make to install Zabbix. If your Linode is running Ubuntu or Debian, use these instructions:
Install make by entering the following command:
sudo apt-get install make
Install the C compiler by entering the following command:
sudo apt-get install gcc
You have installed the C compiler and make on your Linode.
Now that all of the Zabbix prerequesites are ready, we can start installing.
Let's start by downloading and unpacking Zabbix. Here's how:
Find the latest version of Zabbix on the Zabbix download page. Log in to your Linode and enter the following command, replacing the link with the latest version available on the Zabbix download page:
Once we have the latest package downloaded, we'll need to unpack it by entering the following command:
tar -xzf download
You have successfully downloaded and unpacked Zabbix.
Populate your Xabbix database by entering the following commands, one by one. Replace Password with the Zabbix MySQL user password:
mysql -D zabbix -uzabbix -pPassword < /home/zabbix/zabbix-2.0.1/database/mysql/schema.sql mysql -D zabbix -uzabbix -pPassword < /home/zabbix/zabbix-2.0.1/database/mysql/data.sql mysql -D zabbix -uzabbix -pPassword < /home/zabbix/zabbix-2.0.1/database/mysql/images.sql
You have successfully configured MySQL for Zabbix server.
Now we're ready to compile and install Zabbix server. Here's how:
Change to the Zabbix directory by entering the following command:
Enter the following command to compile Zabbix:
./configure --enable-server --with-mysql --with-libcurl
When the configuration completes, you can make and install Zabbix by entering the following command:
sudo make install
You'll also need to configure and make the agent binaries. Enter the following command to compile these statically so you don't have to download the entire Zabbix package to each monitored host to compile them:
./configure --enable-agent --enable-static
Enter the following command to install Zabbix:
sudo make install
You have successfully compiled and installed Zabbix.
Now you'll need to create a configuration file for the Zabbix server in your /etc/zabbix directory. Here's how:
Create a new directory in /etc by entering the following command:
sudo mkdir /etc/zabbix
Create the configuration file by entering the following command:
sudo touch /etc/zabbix/zabbix_server.conf
Change the owner by entering the following command:
sudo chown -R zabbix:zabbix /etc/zabbix
Create the log file by entering the following command:
sudo touch /var/log/zabbix.log
Change the owner of the log file by entering the following command:
sudo chown zabbix:zabbix /var/log/zabbix.log
Open the Zabbix configuration file for editing by entering the following command:
sudo nano /etc/zabbix/zabbix_server.conf
Add the following to the zabbix_server.conf file. At this point, it only requires your database connection details, though we will also be adding a Zabbix server log as well.
File:/etc/zabbix/zabbix_server.confDBName = zabbix DBPassword = YourZabbixMySQLpassword DBUser = zabbix LogFile = /var/log/zabbix.log
A full list of configuration parameters for zabbix_server.conf are available here.
You have successfully created the configuration file.
To ensure that Zabbix starts every time you reboot your Linode, you'll need to copy the Zabbix init.d scripts to the appropriate directory and set the correct permissions. Here's how:
Copy the scripts by entering the following commands, one by one:
sudo cp /home/zabbix/zabbix-2.0.1/misc/init.d/debian/zabbix-server /etc/init.d sudo cp /home/zabbix/zabbix-2.0.1/misc/init.d/debian/zabbix-agent /etc/init.d
Change the permissions by entering the following commands, one by one:
sudo chmod 755 /etc/init.d/zabbix-server sudo chmod 755 /etc/init.d/zabbix-agent
Set Zabbix to start when the machine boots by entering the following commands, one by one:
sudo update-rc.d zabbix-server defaults sudo update-rc.d zabbix-agent defaults
Now the Zabbix server and agent will automatically start every time you boot your Linode.
Now you can start the Zabbix server and agent by entering the following commands, one by one:
sudo /etc/init.d/zabbix-server start sudo /etc/init.d/zabbix-agent start
Zabbix is now running on your Linode! To verify, enter the following command:
ps -aux | grep zabbix
The Zabbix Agent (zabbix_agentd) is placed on the client servers you want to monitor.
First, you'll want to create a zabbix user on the client system. Enter the following command to create the user:
The user has been created.
Now you'll want to create directories for the Zabbix files on your client server. You'll also need to copy some files to the new directories. Here's how to do it:
Create the directories by entering the following commands, one by one:
mkdir /opt/zabbix mkdir /opt/zabbix/sbin mkdir /opt/zabbix/bin mkdir /etc/zabbix
Next, you'll want to copy over the necessary files. There are 3 files to copy, as shown below. Place zabbix_agentd into /opt/zabbix/sbin on your client server. The zabbix_get and zabbix_send files go into /opt/zabbix/bin:
/usr/local/zabbix/sbin/zabbix_agentd /usr/local/zabbix/bin/zabbix_get /usr/local/zabbix/bin/zabbix_send
Verify that those files are owned by the zabbix user by entering the following command:
chown -R zabbix:zabbix /opt/zabbix
Create an agent configuration file by entering the following command:
Verify that the file is owned by the zabbix user by entering the following command:
chown -R zabbix:zabbix /etc/zabbix/zabbix_agentd.conf
Open the configuration for editing by entering the following command:
The only option that is required is the Server parameter, which is the IP address of your Zabbix monitoring server. Copy and paste the following line into the configuration file, replacing 188.8.131.52 with the IP address of your Zabbix monitoring server.
File:/etc/zabbix/zabbix_agentd.confServer = 184.108.40.206
A full listing of supported parameters, as well as their default values, is available in the Zabbix manual.
Open the /etc/services file for editing by entering the following command:
Copy and paste the following lines into the /etc/services file:
zabbix_agent 10050/tcp zabbix_trap 10051/tcp
You have successfully installed and configured the agent.
Once you have your files copied and the configuration file in place, start the agent by entering the following command:
The agent is now running.
Zabbix also has a front-end component that you'll want to install. These instructions show you how.
The Zabbix frontend is written in PHP. You'll want to copy the front-end files to your web server's public directory. Here's how to create a subdirectory and copy the Zabbix front-end files to it:
We assume that you followed the Hosting a Website guide. If you're using a different DocumentRoot directive than /home/example_user/public/example.com/public for your virtual host, you'll need to update the path to correctly reflect your DocumentRoot.
Change to your virtual host directory by entering the following command, replacing example_user with your username and example.com with your domain name:
Create a new directory by entering the following command:
sudo mkdir zabbix
Change to the Zabbix directory by entering the following command:
Copy the files by entering the following command, replacing example_user with your username and example.com with your domain name:
sudo cp -a . /home/example_user/public/example.com/public/zabbix
You have successfully copied the files.
You'll need to complete the installation of the Zabbix web interface with your web browser. Here's how:
After you've finished the front-end installation, you'll be forwarded to the Zabbix login page. The default username is Admin, the default password is zabbix.
Now you have the Zabbix server and web admin installed, and you just set up the zabbix_agentd on your first monitored host. Now you can add that host to your web admin so you can actually monitor it. Here's how:
Log into your web admin by entering the following URL in your web browser, replacing YourZabbixServerIP with your Linode's IP address:
Click the Configuration tab, then the Hosts menu item, then the Create Host button. The screen shown below appears.
You have successfully added the monitored host.
If you would like the base graphs for your new monitored host, you can copy those from the Zabbix server. Here's how:
Note that the Zabbix manual has complete documentation on setting up the various actions and operations Zabbix can perform.
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.
Last edited by Matthew Cone on Monday, August 20th, 2012 (r3019).