Server Monitoring with Zabbix
Zabbix (www.zabbix.com) is an open-source, commercially backed monitoring solution that supports UNIX, Linux, BSD, Mac OS X and Windows platforms and is built to support large installations. Zabbix is the creation of Alexei Vladishev and his company Zabbix SIA. This article is based on the latest version of Zabbix, version 1.8.1, which was released in January 2010. At the time of this writing, most Linux distributions include the previous version (1.6) in their repositories. There are significant changes when compared to 1.8, but most of this article still applies. A partial feature list includes:
Clients for Linux, BSD, Windows, Mac OS X and commercial UNIXes.
Database back end (MySQL, Oracle, PostgreSQL or SQLite).
Notifications via e-mail, SMS or Jabber.
Support for polling or trapping Zabbix client messages.
Agent-less monitoring (ping, port checks and so on).
Although you can install Zabbix from your Linux distribution's repositories, I'm going to install version 1.8.1 from source using Ubuntu 9.10 for the server platform with a MySQL database back end. I also show how to configure a Linux client with the basic monitoring that comes with a default Zabbix installation.
Before compiling the Zabbix sources, I need to install prerequisite packages:
shell> sudo apt-get install mysql-server apache2 ↪libapache2-mod-php5 php5-mysql php5-gd ↪libmysqlclient15-dev libsnmp-dev libiksemel-dev ↪libcurl4-gnutls-dev
(In Ubuntu, the package names are mysql-server, apache2, libapache2-mod-php5, php5-mysql, php5-gd, libmysqlclient15-dev, libsnmp-dev, libiksemel-dev and libcurl4-gnutls-dev.)
The Zabbix sever and client will run as the user zabbix, so you need to create an account:
shell> sudo useradd -s /bin/true zabbix
Next, create the zabbix database:
shell> mysql -u<username> -p<password> mysql> create database zabbix; mysql> quit;
Download the source code from www.zabbix.com/download.php, uncompress the archive and then follow the steps below to set up the database schema and default configuration. Note that I am using the MySQL schema files to set up my database; there are different schema files for the other supported databases:
shell> sudo tar zxvf zabbix-1.8.1.tar.gz shell> cd zabbix-1.8.1/create/schema shell> cat mysql.sql | mysql -u<username> -p<password> zabbix shell> cd ../data shell> cat data.sql | mysql -u<username> -p<password> zabbix shell> cat images_mysql.sql | mysql -u<username> -p<password> zabbix
To compile the server code, cd back to the root of the extracted zabbix-1.8 source directory, and run the following command to compile the server binaries to have support for MySQL, SNMP and Jabber:
shell> ./configure --enable-server --with-mysql --with-net-snmp ↪--with-jabber --with-lib-curl shell> sudo make install shell> ./configure --enable-agent --enable-static shell> sudo make install
I recommend building static binaries for the clients. This helps when deploying the client across different (Linux) versions. Although the make install command builds and installs the server binary zabbix_server, it does not build the client agent binary. To compile the client binaries, cd into zabbix-1.8.1/src/zabbix_agent, and run another make install. The binaries then are installed into /usr/local/sbin—the same location for the server binary:
shell> ./configure --enable-agent --enable-static shell> cd src/zabbix_agent shell> sudo make install
Two zabbix binaries are compiled: zabbix_agentd and zabbix_agent. The latter is used to run the client from a superserver, such as inetd, and the former runs as a dæmon. It's recommended to run the zabbix_agentd.
Zabbix uses one configuration file for the server and another for the client. Sample configuration files are available in the zabbix-1.8.1/misc/conf directory. Make a directory called /etc/zabbix, change the ownership of the directory to the user zabbix, and copy the zabbix_server.conf and zabbix_agentd.conf files to this directory.
There isn't much to change in either of the configuration files, but they are well documented within the files themselves. Two configuration parameters in the client zabbix_agentd.conf file that should be changed are the lines Server= and Hostname=. The first should point to your Zabbix server and the second should be the hostname of the client.
With the exception of maybe the DBUser and DBPassword parameters in the zabbix_server.conf file, nothing else needs to be changed if you're running a site with less than a few hosts. Look through both configuration files and refer to the Zabbix documentation for any variables that could be helpful to your site.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
|Working with Command Arguments||May 28, 2016|
|Secure Desktops with Qubes: Installation||May 28, 2016|
|CentOS 6.8 Released||May 27, 2016|
|Secure Desktops with Qubes: Introduction||May 27, 2016|
|Chris Birchall's Re-Engineering Legacy Software (Manning Publications)||May 26, 2016|
|ServersCheck's Thermal Imaging Camera Sensor||May 25, 2016|
- Secure Desktops with Qubes: Introduction
- Working with Command Arguments
- Secure Desktops with Qubes: Installation
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- CentOS 6.8 Released
- The Italian Army Switches to LibreOffice
- Linux Mint 18
- ServersCheck's Thermal Imaging Camera Sensor
- Chris Birchall's Re-Engineering Legacy Software (Manning Publications)
- Oracle vs. Google: Round 2
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide