Setting up a Zabbix monitoring environment

Sander van Vugt

In a data center, it is important to know what is happening to which machines. Proper monitoring of nodes can help prevent problems with network functionality. In this series of articles, you'll learn how to do this with Zabbix.

This article is part one in a three part series. For part two, click here. For part three, click here.

Zabbix is an open source network monitoring tool that works with a centralized Linux-based Zabbix server. The server communicates to the native agents that are available for many operating systems, including Linux, UNIX and Windows. For operating systems without an agent, generic monitoring protocols such as SNMP or IPMI can be used.

The advantages of using the Zabbix monitoring tool are many. For starters, Zabbix can send out alerts and notifications if specific predefined events are occurring. It also provides graphing functionality, which allows the administrator to get an overview of the current state of specific nodes and the network in general.

To get a working Zabbix environment, you'll need to start with the server. To interact with this server, the administrator will use a Zabbix front-end interface, which talks to the Zabbix server and database. All three -- interface, server and database -- can reside on the same server, but there is an option to install them on different machines if you want a more distributed environment. The Zabbix server can directly monitor devices on the same network, but if the devices are on another network, a Zabbix proxy is often used.

Zabbix installation options

There are two ways to install Zabbix: Download the source packages and install them on the Linux host for your Zabbix server, or use the packages included with some Linux distributions. Using the distribution packages makes installing and updating Zabbix easier, but compiling your own Zabbix means that it will work for every Linux distribution and include the latest and greatest features.

Precompiled packages are not available for some Linux distributions, such as SUSE. If you don't want to deal with the underlying Linux operating system, Fedora or Ubuntu might be the best bet. They both contain the Zabbix packages right from the installation repositories. Compiling your own will also work, but it requires additional Linux knowledge. In this article, we will install Zabbix using precompiled packages on Fedora 17, which is available for free.

Installing base packages

Make sure your Fedora Linux server has at least 10 GB of available disk space. You won't need that for the initial Zabbix installation, but you will need it if Zabbix starts filling the database in a larger environment.

Next, use the Yellow Dog Updater Modified (YUM) command yum install zabbix zabbix-server zabbix-server-mysql zabbix-web zabbix-web-mysql mysql zabbix-agent to install Zabbix and all of its required components. After installing the software, you need to start the zabbix services and make sure that they'll start after a reboot of your server. To accomplish this, run the following commands and reboot your server:

systemctl enable mysqld.service
systemctl enable zabbix-server-mysql.service
systemctl enable httpd.service

Before continuing, you'll need to create a MySQL database. Use mysql -u root to log in as a root user. This opens a mysql prompt. Enter the following commands to create the required database:

mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by ‘password';
mysql> quit

The database has the default name zabbix, and the administrator name is zabbix, with the password as password. You now need to populate the database with the Zabbix schema and some initial data. To do this, you can use the default SQL files that have been installed in /usr/share/doc/zabbix-server-mysql-<version>/create/schema. Import the files by using the following mysql commands from a Linux shell:

# mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-<VERSION>/create/schema/mysql.sql
# mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-<VERSION>/create/data/data.sql
# mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-<VERSION>/create/data/images_mysql.sql

These commands will import the SQL files in the MySQL database, using the user account "zabbix." The option -p tells the mysql command to prompt for a password, and the argument zabbix tells MySQL to add all of these data to the zabbix database. Next, the input file is specified by using input redirection (<), which is followed by the name of the file that is to be used as the input file.

Before you continue the configuration, make sure Zabbix can connect to the database you've just created. To do this, open the configuration file /etc/zabbix/zabbix_server.conf and make sure the following lines are included:

DBHost=localhost
DBName=zabbix
DBPassword=password

Restart your server and make sure everything comes up correctly. After restarting, use the command systemctl status zabbix-server.service. This should show a list of Zabbix processes that have been started.

Connecting to the Web interface

Once everything is started, you can open a browser session to the Zabbix Web front end at http://yourzabbixserver/zabbix, where you can configure your Zabbix server.

Zabbix screenshot 1

Before continuing, make sure you meet the minimal system requirements.

The first import screen checks the prerequisites. In many cases, you will find the default PHP settings that your distribution uses are insufficient, so make a note of the settings concerned and open /etc/php.ini to change them. After making the changes, restart the Apache service. On Fedora 17, do this by issuing the systemctl restart httpd.service command.

Zabbix screenshot 2

Configuring the database connection

In the next window, configure the connection between Zabbix and the database. In this screen, the default user name root is used; make sure to change this to zabbix.

After creating the database connection, enter the location where the Zabbix server can be found and the port you're using. If the Web front end is running elsewhere from the server process, specify the IP address where the Zabbix server can be reached or just type "next" to continue. You'll now see a preinstallation summary. Verify that the parameters are OK and then finish the installation procedure. This gives you access to a Zabbix login window, where you can log in as the default user Admin with the password zabbix. Your zabbix environment is now ready for use.

In the next article of this series, you'll learn how to start monitoring systems with Zabbix.

ABOUT THE AUTHOR
Sander van Vugt is an independent trainer and consultant based in the Netherlands. He is an expert in Linux high availability, virtualization and performance, and has completed several projects that implement all three. He is also the writer of various Linux-related books, such as Beginning the Linux Command LineBeginning Ubuntu Server Administration and Pro Ubuntu Server Administration.

View the next item in this Essential Guide: Setting up Linux HA in the data center or view the full guide: Essential guide to Linux in the enterprise

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: