
Zabbix Network Monitoring Essentials
By :

Zabbix, like all the other software, can be installed in two ways:
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:
On the other hand, the installation from packages gives us some benefits:
The source code compilation also gives us some benefits:
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.
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
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:
-devel
packages.$ ./configure --enable-agent
.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.
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/.
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
.
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.
To specify a different location for Zabbix binaries, we need to use --prefix
on the configure options (for example, --prefix=/opt/zabbix
).
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.
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.
Change the font size
Change margin width
Change background colour