Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Zabbix Network Monitoring Essentials

You're reading from   Zabbix Network Monitoring Essentials Your one-stop solution to efficient network monitoring with Zabbix

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781784399764
Length 178 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Toc

Installing Zabbix

Zabbix, like all the other software, can be installed in two ways:

  1. Download the latest source code and compile it.
  2. Install it from packages.

Actually, there is another way to have a Zabbix server up and running: using the virtual appliance. The Zabbix server appliance will not be considered in this book as Zabbix itself defines this virtual appliance as not ready for productive environments. This virtual appliance is not a production ready setup for many reasons:

  • It is a monolith where everything is installed on the same server.
  • There is no separation from the database layer and the presentation layer. This means that each one of these components can affect the performance of the other.
  • There is a clear warning on the website that warns us with this statement: The Appliance is not intended for serious production use at this time.

On the other hand, the installation from packages gives us some benefits:

  • The packages make it easy to upgrade and update
  • Dependencies are automatically sorted out

The source code compilation also gives us some benefits:

  • We can compile only the needed features
  • We can build the agent statically and deploy on different Linux flavors
  • Complete control on update

It's quite usual to have different versions of Linux, Unix, and Microsoft Windows on a large environment. This kind of scenario is quite diffused on a heterogeneous infrastructure, and if we use the Zabbix's agent distribution package on each Linux server, we will have different versions of the agent for sure, and different locations for the configuration files.

The more the things are standardized across our server, the easier it will become to maintain and upgrade the infrastructure. The --enable-static option gives us a way to standardize the agent across different Linux versions and release, which is a strong benefit. The agent, statically compiled, can be easily deployed everywhere and, for sure, we will have the same location (and we can use the same configuration file apart from the node name) for the agent and his/her configuration file. The only thing that might vary is the start/stop script and how to register it on the right init runlevel, but at least the deployment will be standardized.

The same kind of concept can be applied to the commercial Unix, bearing in mind to compile it on the target environment so that the same agent can be deployed on different Unix releases of the same vendor.

Installing from packages

The first thing to do to install Zabbix from repo is to add the yum repository to our list. This can be done with the following command:

$ rpm -Uvh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
Retrieving http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
warning: /var/tmp/rpm-tmp.dsDB6k: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
Preparing…         ########################################### [100%]
1:zabbix-release   ########################################### [100%]

Once this is done, we can take advantage of all the benefits introduced by the package manager and have the dependencies automatically resolved by yum.

To install the Zabbix server, you simply need to run:

$ yum install zabbix-server-mysql zabbix-agent zabbix-javagateway

Now, you have your server ready to start. We can't start it now as we need to set up the database, which will be done in the next heading, anyway, what you can do is set up the start/stop runlevel for our zabbix_server and zabbix_agent daemons:

$ chkconfig --level 345 zabbix-server on
$ chkconfig --level 345 zabbix-agent on

Please double check if the previous command ran successfully with the following:

$ chkconfig --list | grep zabbix
zabbix-agent    0:off   1:off   2:off   3:on     4:on   5:on   6:off
zabbix-server   0:off   1:off   2:off   3:on   4:on   5:on   6:off

Setting up a Zabbix agent

Now, as usually happens in a large server farm, it is possible that you have many different variants of Linux. Here, if you can't find the package for your distribution, you can even think to compile the agent from scratch. The following are the steps for the same:

  1. Download the source code from the Zabbix website.
  2. Unpack the software.
  3. Satisfy all the software dependencies, installing all the related -devel packages.
  4. Run the following command: $ ./configure --enable-agent.

    Tip

    Here, you can statically link the produced binary with the --enable-static option. With this, the binary produced will not require any external library. This is really useful to distribute the agent across different versions of Linux.

Compile everything with $ make.

Now, before you run $ make install, you can decide to create your own package to distribute with CheckInstall.

Creating a Zabbix agent package with CheckInstall

The advice is to not run make install, but use CheckInstall to produce the required package for your Linux OS from http://asic-linux.com.mx/~izto/checkinstall/.

Note

We can also use a prebuilt CheckInstall; the current release is checkinstall-1.6.2-20.2.i686.rpm on Red Hat / CentOS. The package will also need the rpm-build package:

rpm-build yum install

Also, we need to create the necessary directories:

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

This software enables you to create a package for many different versions of the package manager, namely, RPM, deb, and tgz.

Note

CheckInstall will produce packages for Debian, Slackware, and Red Hat, helping us to prepare the Zabbix's agent package (statically linked) and distribute it around our server.

Now, we need to switch to the root account using $ sudo su – . Also, use the checkinstall followed by these options:

$ checkinstall --nodoc --install=yes -y

If you don't face any issue, you should get the following message:

******************************************************************
 Done. The new package has been saved to
 /root/rpmbuild/RPMS/i386/zabbix-2.4.0-1.i386.rpm
 You can install it in your system anytime using:
      rpm -i zabbix-2*.4.0-1.i386.rpm
******************************************************************

Remember that the server binaries will be installed in <prefix>/sbin, utilities will be in <prefix>/bin, and the main pages under the <prefix>/share location.

Tip

To specify a different location for Zabbix binaries, we need to use --prefix on the configure options (for example, --prefix=/opt/zabbix).

Server configuration

For the server configuration, we only have one file to check and edit:

/etc/zabbix/zabbix_server.conf

All the configuration files are contained in the following directory:

/etc/zabbix/

All you need to change for the initial setup is the /etc/zabbix/zabbix_server.conf configuration file and write the username/password and database name here.

Note

Please take care to protect the access to the configuration file with chmod 400 /etc/zabbix/zabbix_server.conf.

The default external scripts location is:

/usr/lib/zabbix/externalscripts

Also, the alert script directory is:

/usr/lib/zabbix/alertscripts

This can be changed by editing the zabbix_server.conf file.

The configuration on the agent side is quite easy; basically, we need to write the IP address of our Zabbix server.

You have been reading a chapter from
Zabbix Network Monitoring Essentials
Published in: Feb 2015
Publisher:
ISBN-13: 9781784399764
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image