Zabbix

From Void Linux Wiki
Jump to: navigation, search

Zabbix is a very popular Monitoring software for Networks, Operating Systems and Applications operating under UNIX systems and Windows, licensed under the GPL-2.0-or-later.

Zabbix uses a combination of Agent services installed on host machines, TCP, ICMP and SMNP protocols to verify availabilty and monitor system and application resources.

Void Linux's Zabbix package is configured to use MySQL as it's database backend.

Server installation

Install the zabbix package

 # xbps-install -S zabbix

Server configuration

Create a mysql database and grant it to the zabbix user, remember the password used as it will be configured in the future

 mysql> create database zabbix character set utf8 collate utf8_bin;
 mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
 mysql> flush privileges;
 mysql> quit;

Then import the initial schema, you will be prompted for the password you choose earlier. This operation can take a few minutes

 $ cat /usr/share/zabbix/mysql/schema.sql | mysql -u zabbix zabbix -p
 $ cat /usr/share/zabbix/mysql/images.sql | mysql -u zabbix zabbix -p
 $ cat /usr/share/zabbix/mysql/data.sql | mysql -u zabbix zabbix -p

Modify DBPassword= in /etc/zabbix_server.conf to match the password used in the database and DBSocket= to match the location used by MySQL

 DBPassword=password
 DBSocket=/run/mysqld/mysqld.sock

You can now start the Zabbix server service, which also requires the mysql service if you're already running it you can ignore the first command.

 # ln -s /etc/sv/mysqld /var/service
 # ln -s /etc/sv/zabbix-server /var/service
Note: Void Linux uses /var/log/zabbix-server instead of /tmp for the logs and /var/run/zabbix-server instead of /tmp for pidfiles

PHP Frontend

Zabbix offers a PHP frontend, this section will explain how to run it with apache, first install it, php-apache and zabbix-frontend-php

 # xbps-install -S apache php-apache zabbix-frontend-php

Follow the instrunctions on How to enable PHP for Apache

Create a soft-link from it to /srv/www/apache

 # ln -s /usr/share/webapps/zabbix /srv/www/apache

Modify permissions in /usr/share/webapps/zabbix/conf to _apache, so it has permissions to move the configuration during the setup phase

 # chown _apache:_apache /usr/share/webapps/zabbix/conf

Append the following to /etc/php/php.ini, these are modules from php and php-gd required and/or recommended by Zabbix's PHP frontend

 extension=pdo_mysql.so
 extension=mysqli.so
 extension=sockets.so
 extension=gd.so
 extension=bcmath.so
 extension=gettext.so

Edit some configuration in /etc/php/php.ini to match requirements by Zabbix, the timezone can be checked in the PHP manual

 Max_execution_time = 600
 Expose_php = off
 Date.timezone = <insert your timezone here>
 post_max_size = 32M
 upload_max_filesize = 16M
 max_input_time = 600
 memory_limit = 256M

Enable the apache service

 # ln -s /etc/sv/apache /var/service

The PHP frontend should be available at 127.0.0.1/zabbix, running it for the first time should redirect to setup.php