Little escapes the notice of the all-knowing, all-seeing system administrator with Zabbix at his disposal. Zabbix' enterprise-class monitoring software provides distributed monitoring with a centralized web administration interface.
How does Zabbix differ from the similar Nagios and Cacti monitoring applications? All three support SNMP, so they can monitor almost any device on a network. While Nagios is the industry standard for monitoring local and remote machines and IT infrastructure, it's almost always used together with other monitoring tools because Nagios is incapable of presenting recorded data in graphs. That said, Nagios has excellent alerting feature to keep sysadmins informed of all the devices it is tracking. In contrast, Cacti doesn't send out alerts, but it can create graphs.
Zabbix can send out alerts via email, SMS, or Jabber. It also lets you set up automatic actions for the software to take on remote machines when certain events occur. In terms of visualization features, Zabbix supports real-time graphing of monitored items and offers graphs , network maps, screens, and even slide shows, making it suitable for complex networks whose sysadmins prefer to see graphical representations of data.
Administrators can unlock all of that functionality through a complex web interface that may be Zabbix' most visible difficulty. It can be quite a process, treading about the interface, switching from one tab to another, to get through all the steps involved in setting up monitoring for a device.
Zabbix uses two components: a server and agents. The server component, zabbix-server, is responsible polling and trapping of data. It calculates triggers, and in case of problems or downtime sends out notifications. Since the data is recorded in a database, the more memory you have, the faster the database access. The CPU and memory resources required for Zabbix depends on the number of devices you wish to monitor on the network and your choice of database engine. No matter the size of the network, you can have only one zabbix-server, to which all recorded data is communicated.
You must install zabbix-agent on all the machines you wish to monitor. Zabbix has agents for Linux, FreeBSD, OpenBSD, NetBSD, HP-UX, MacOS X, Solaris, and various Windows versions. The agent can monitor both hardware resources and applications. It sends all the information it collects to zabbix-server.
While Zabbix is available in the software repositories for many distributions, if you're using CentOS you should get it from the EPEL repository, because the CentOS repositories still carry the older 1.8 series of Zabbix, instead of the latest stable 2.0 series. The dependency list for Zabbix is fairly small. If you already have MySQL, Apache, PHP, and their related packages installed, you can install Zabbix straightaway. If not, install the dependencies, then Zabbix, via yum.
The following commands configure and enable the EPEL repository and install the Zabbix server components:
yum -y localinstall http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
yum -y install zabbix20-server-mysql zabbix20-web-mysql
To ensure the Zabbix server starts automatically on boot, run chkconfig zabbix-server on.
chkconfig zabbix-server on
Zabbix can store recorded data in MySQL, PostgreSQL, or Oracle databases. The default Zabbix configuration expects a database named zabbix. The default username for the database is zabbix, with no password. You can edit the well-commented /etc/zabbix/zabbix_server.conf file to change these values.
If you're doing this on a fresh system or you don't already have MySQL and HTTPD configured to start at boot as well, run the following commands:
chkconfig httpd on
chkconfig mysqld on
Create the MySQL user account and database for Zabbix. It's not the scope of this article to cover the MySQL administration basics, but you can run the following commands to create these and populate the database:
mysql -uroot -e 'create database zabbix'
mysql -uroot -e "create user 'zabbix'@'localhost' identified by 'ChangeMe'"
mysql -uroot -e "grant all on zabbix.* to 'zabbix'@'localhost'"
mysql -uroot -e "flush privileges"
mysql -uzabbix -p'ChangeMe' zabbix < /usr/share/zabbix-mysql/schema.sql
mysql -uzabbix -p'ChangeMe' zabbix < /usr/share/zabbix-mysql/images.sql
mysql -uzabbix -p'ChangeMe' zabbix < /usr/share/zabbix-mysql/data.sql
The Zabbix server's three components – zabbix-server, the database, and web-based front end – perform a number of complex tasks. We've already installed zabbix-server and configured the database. To install the graphical front end, first make sure zabbix-server is running; the command zabbix-server will start it if it isn't. Then point a browser to http://localhost/zabbix, where an installation wizard will guide you through the installation.
When you click Next to begin the installation, Zabbix reports all errors it encounters in the /etc/php.ini PHP configuration file. The errors are highlighted in red in the browser window. The wizard informs you of the current value and what value Zabbix expects for the errant options. You can't continue with the installation until you fix each of the reported errors by manually editing the configuration file. On a default installation, you must change the timezone, post_max_size, max_execution_size, and max_input time values. Once you make all the changes and save the /etc/php.ini file, run apachectl restart to start using the new settings.
When you continue with the wizard, you are asked to provide the details for the database you created earlier, including the database name, username, and password.
After you're done with the installation, you're automatically redirected to the login page. The default username is admin and the password is zabbix. Before you begin exploring the interface, change the password. Click Profile on the top right of the page and then click the Change Password button. Click Save at the bottom to save the new password.
You can set up multiple user accounts and groups, and use Zabbix' comprehensive permissions system to restrict access to administrative functions or monitored hosts. A user can be classified as User, Admin, or Super Admin. Only a Super Admin has complete control over every aspect of the system. You can restrict the functions and devices that other kinds of users can access and monitor.
Once you have the server properly installed, install zabbix-agent on all the machines on the network that you wish to monitor. Under CentOS the command yum install zabbix20-agent does the trick.
yum install zabbix20-agent
Zabbix is a vast project and its many features, unfortunately, can't all be clubbed into a simple, intuitive interface. Thankfully, the project documentation is a great resource, and a must read if you wish to make sense of the interface and the way Zabbix uses important terms such as host, trigger, and item.
You can think of a host as any entity that you wish to monitor. Everything from a network switch, a file, an application, physical server, or virtual machine is identified as a host. So, for example, you can configure Zabbix to monitor any configuration file under /etc such that every time the file is changed, Zabbix sends an alert. Your first step thus is to define the hosts that you wish to monitor.
For each host you define, you need to define items, which describe what specific data for a host is to be gathered. To monitor the CPU load, gather disk statistics or network information, or check some file's md5sum, you have to describe items for each of these entities. When creating an item, you need to specify the item key you wish to monitor. Each type of item has a different key, but when you create a new item you can select the key you wish to use from a list, so you don't need to remember them all.
You also have to define triggers that analyze the collected data, compare it with acceptable values, and report a problem if the collected data doesn't correspond with the specified value. You can use various operators to define a trigger.
The final step is to configure the system to send out alerts when it discovers a problem with the collected data.
If you plan to monitor the same set of parameters for each machine on the network, having to go through each of these steps each time would be impractical. Zabbix allows you to create templates, which are sets of predefined entities such as items, triggers, and graphs that you can apply to multiple hosts.
Given the application's complexity, I've only scratched the surface of what Zabbix has to offer. Old-school sysadmins might think Zabbix' web interface could be a hindrance, but many an organization has learned otherwise. If you spend time with the documentation and the software, Zabbix may well become the only monitoring tool you use.
Allowed tags: <a> link, <b> bold, <i> italics