-
Book Overview & Buying
-
Table Of Contents
Zabbix Cookbook
By :
We will now show you how to install Zabbix from source. Remember that for production, it's always better to install from the Zabbix repository or another repository such as Extra Packages for Enterprise Linux (EPEL). First of all, it will make your life easier when you want to upgrade but also when you want to remove some software. Maintainers of Zabbix packages in repositories such as EPEL are always in contact with Zabbix developers and improving the packages. If you compile it by yourself, chances are that you will miss something and will have to do it over later when your setup is already in production.
So why compile, you would think. Well if you can't wait for the latest and greatest new features then it can be a good thing to compile Zabbix in a test environment and try it out. Also, if you or some customer is in high need of one of the new features, it can be an option but then you really have to know what you are doing. Performance can also be a consideration.
If you consider compiling from source, take a checklist with you that lists all options that you need.
To get started with our compilation, we need of course, an operating system and the Zabbix source code. In this case, I will show you how to compile on Red Hat or CentOS 6.x.
For our setup we will need a local working MySQL server with a working Zabbix database and a web server properly configured.
You can also look in the Zabbix online manual under Installation | Installation from sources. https://www.zabbix.com/documentation/2.4/manual/installation/install.
/usr/src folder.tar.gz file we have downloaded. This can be done with tar. For example:# tar -zxvf zabbix-2.4.x.tar.gz
/usr/src/zabbix-2.4.x folder.# yum install httpd php php-mysql php-bcmath php-mbstring php- gd php-xml mysql mysql-server -y
Zabbix supports the following versions: MySQL 5.03 or higher, PostgreSQL 8.1 or higher, Apache 1.3.12 or higher, PHP 5.3 or higher. A full list can be found here:
https://www.zabbix.com/documentation/2.4/manual/installation/requirements.
# groupadd zabbix # useradd -g zabbix zabbix
# yum install gcc mysql-devel libxml2-devel net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel libssh2-devel iksemel-devel openldap-devel
# ./configure --help
# ./configure --enable-server --enable-agent --with-mysql -- enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 -- with-openipmi --with-unixodbc --with-ssh2 --with-ldap --with- jabber
# make install
# /usr/local/etc/ → Zabbix configuration files # /usr/local/sbin/ → Zabbix server
If you want to change the location of the Zabbix server installation you could make use of the –prefix=/PATH option when compiling.
If you have issues don't forget to disable SELinux or better still, put proper SELinux permissions.
The -j option can be used to speed up compiling when running make on a multicore computer such as make -j 4.
http://stackoverflow.com/questions/414714/compiling-with-g-using-multiple-cores.
/usr/src/zabbix-2,4,x/misc/init.d file.# mkdir /var/www/html/zabbix # cd /usr/src/zabbix-2.4.x/frontends/php # cp -a . /var/www/html/zabbix # chown -R –no-dereference apache:apache /var/www/html/zabbix
zabbix.conf file for Apache in the /etc/httpd/conf.d/ folder:<Directory "/var/www/html/zabbix">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value date.timezone Europe/Brussels
</Directory>The downloaded source code from Zabbix will be extracted first in a folder. To be able to run the Zabbix server as a standard user and not as root, we need to create a group and a user. In this case, we added a group zabbix and created a user zabbix and linked the user to the same group.
We then downloaded the development libraries and our gcc compiler so that we were able to compile the Zabbix server from the source code.
The same thing can be done for the Zabbix agent and the Zabbix proxy, except that only other compiling options are needed.
Since Zabbix 2.2, there is the possibility to monitor virtual machines in VMware. For this to work, it is necessary to give the --with-libxml2 option when compiling, else this functionality will not work.
When compiling an agent, we can make use of the same source code we have downloaded for the compilation of the Zabbix server. The only thing we need to do now, is launch.
# ./configure --enable-agent
When compiling fails, chances that you are missing some development libraries for one of the new options you have added are great. If you are not sure what option has caused this, then it can make sense to remove some options and start over. Later if compiling works, you can then add the new options again, one by one, to see where it fails. Zabbix also provides a URL with information on how to install from source:
https://www.zabbix.com/documentation/2.4/manual/installation/install.
Change the font size
Change margin width
Change background colour