Difference between revisions of "Zabbix"

From ArchWiki
Jump to: navigation, search
(Server setup: convert note to section, correct file name, request bug report)
(Zabbix-frontend fix: fixed in 3.4.0 according to bug report: https://support.zabbix.com/browse/ZBX-11549)
Line 23: Line 23:
Or one of the other servers found in [[:Category:Web server]].
Or one of the other servers found in [[:Category:Web server]].
==== Zabbix-frontend fix ====
{{Accuracy|Where is the bug report?}}
Zabbix-frontend is not compatible with PHP 7.1. Edit {{ic|/usr/share/webapps/zabbix/include/func.inc.php}}:
function str2mem($val) {
    $val = trim($val);
    $last = strtolower(substr($val, -1));
    switch ($last) {
            case 'g':
                    $val = (int) $val * 1024;
                    /* falls through */
            case 'm':
                    $val = (int) $val * 1024;
                    /* falls through */
            case 'k':
                    $val = (int) $val * 1024;
    return $val;
=== Configuration ===
=== Configuration ===

Revision as of 12:23, 30 November 2017

Zabbix is a full-featured monitoring solution for larger networks. It can discover all kind of networking devices using different methods, check machine states and applications, sending pre-defined alarm messages and visualize complex data correlations.

Server setup


Zabbix-server installation

  • Install zabbix-server. This will include the necessary scripts in order to use MariaDB or postgresql. This wiki assumes you will be using MariaDB

Zabbix-frontend installation

Just install the zabbix-frontend-php package.

You also have to choose a web server with PHP support if you want to use zabbix-frontend, e.g.:

Or one of the other servers found in Category:Web server.


Symlink the Zabbix web application directory to your http document root, e.g.:

$ ln -s /usr/share/webapps/zabbix /srv/http/zabbix

Make sure to adjust following variables to these minimal values in your /etc/php/php.ini:

post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = "UTC"

In this example, we create on localhost a MariaDB database called zabbix for the user zabbix identified by the password test and then import the database templates. This connection will be later used by the Zabbix server and web application:

$ mysql -u root -p -e "create database zabbix character set utf8"
$ mysql -u root -p -e "grant all on zabbix.* to zabbix@localhost identified by 'test'"
$ mysql -u zabbix -p zabbix < /usr/share/zabbix-server/mysql/schema.sql
$ mysql -u zabbix -p zabbix < /usr/share/zabbix-server/mysql/images.sql
$ mysql -u zabbix -p zabbix < /usr/share/zabbix-server/mysql/data.sql


Enable and start the zabbix-server-mysql service, if you are using MariaDB.

Finally you can access Zabbix via your local web server, e.g.:, finish the installation wizard and access the frontend the first time. The default username is Admin and password zabbix.

See appendix for a link to the official documentation, which explains all further steps in using it.

Agent setup


Install zabbix-agent for each monitoring target, including your monitoring server where zabbix-server is installed. zabbix-server does no longer include zabbix-agent.


Simply edit the zabbix_agentd.conf and replace the server variable with the IP of your monitoring server. Only servers from this/these IP will be allowed to access the agent.

Server=<IP of Zabbix server>
ServerActive=<IP of Zabbix server>

Further make sure the port 10050 on your device being monitored is not blocked and is properly forwarded.


Enable and start the zabbix-agent service.

Tips and tricks

Debugging a Zabbix agent

On the client site, you can check the state of an item like this:

$ zabbix_agentd -t hdd.smart[sda,Temperature_Celsius]

On the server/monitoring site, try this:

$ zabbix_get -s host -k hdd.smart[sda,Temperature_Celsius]

Monitor ArchLinux system updates

Here is an approach on how to monitor your ArchLinux clients for available system update using a custom UserParameter:

UserParameter=archlinuxupdates,checkupdates | wc -l

You have to restart zabbix-agentd to apply the new configuration. The keyword for the item you later use in the web frontend is archlinuxupdates. It returns an integer representing the count of available updates.


While importing the databases, you might get an eror "Specified key was too long; max key length is 767 bytes". In order to solve this, you will have to change the codepage configuration for your MariaDB database: MySQL#Using UTF8MB4.

See also