Zabbix is a free open source infrastructure monitoring software with a PHP front end. Features are:
Zabbix ships with a developer API that provides access to almost all of the functionality in Zabbix. It supports two-way integration with most other software. The API can be used to integrate Zabbix functions into third party software.
A zabbix
client is called agent in zabbix
lingo.
zabbix-agent
zabbix-cli
zabbix-frontend-php
zabbix-server-mysql for MySQL/MariaDB
zabbix-server-pgsql for PostgreSQL
zabbix-proxy-mysql
zabbix-proxy-pgsql
zabbix-proxy-sqlite3
zabbix-java-gateway
The following instructions will try to be as general as possible. This guide will show you how to install and configure the latest release (4.0.4) of the Zabbix server on Debian 10 with a MySQL (MariaDB) database, PHP for the frontend and Apache Web Server 2 for the web interface. This is not the latest release that would run on Debian 10 Buster. Since this is the official release for Debian 10 Buster, updates will be available. However, it is possible to install newer versions on Debian 10 Buster from the Zabbix website.
Install the Zabbix server with MySQL (MariaDB) support.
aptitude install zabbix-server-mysql
Back up the database server (if not already done). These questions are self-explanatory.
mysql_secure_installation
Create the database
mysql --defaults-extra-file=/etc/mysql/debian.cnf
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'CHANGE_ME';
GRANT ALL PRIVILEGES ON `zabbix`.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
quit
Unfortunately, the table definition of host_inventory
needs to be changed to fit the mariadb 10.3 dynamic table format. (see row-size-too-large for details).
Add the following two lines at the beginning of: /usr/share/zabbix-server-mysql/schema.sql.gz
SET GLOBAL innodb_default_row_format='dynamic';
SET SESSION innodb_strict_mode=ON;
And at about line 1280, change all varchar()
definitions within the host_inventory
table with numbers less than 256 to 256 like this varchar(256)
.
Populate the database
cd /usr/share/zabbix-server-mysql
zcat schema.sql images.sql data.sql|mysql zabbix --user=zabbix \
--password=CHANGE_ME
Add user database and password to /etc/zabbix/zabbix_server.conf
and change user and permission of this file.
chown zabbix /etc/zabbix/zabbix_server.conf
chnod 640 /etc/zabbix/zabbix_server.conf
echo "DBName=zabbix" >> /etc/zabbix/zabbix_server.conf
echo "DBUser=zabbix" >> /etc/zabbix/zabbix_server.conf
echo "DBPassword=CHANGE_ME" >> /etc/zabbix/zabbix_server.conf
If you are using a firewall, you will need to open port tcp/10051
. There is also the service zabbix-server
for firewalld
.
Remember to specify a PHP date.timezone in /etc/apache2/conf-available/zabbix-frontend-php.conf
.
To restrict the directories that are allowed to be read by your Zabbix PHP frontend, setting a PHP open_basedir
directive is suggested.
Put this example in your /etc/apache2/conf-available/zabbix-frontend-php.conf
, near the other php_values: (in one line, without the backslash)
php_admin_value open_basedir /usr/share/zabbix/:/var/lib/zabbix:/etc/zabbix:\
/usr/share/javascript:/usr/share/fonts
A one-line command to set the admin
password.
PW=`/usr/bin/pwgen -y -N 1 $((8 + RANDOM % 12 ))|/usr/bin/perl -pe 'chomp'`;\
echo "$PW";\
echo "update users set passwd=md5('$PW') where alias='Admin';"|mysql zabbix
A one-line command to set the guest
password.
PW=`/usr/bin/pwgen -y -N 1 $((8 + RANDOM % 12 ))|/usr/bin/perl -pe 'chomp'`;\
echo "$PW";\
echo "update users set passwd=md5('$PW') where alias='guest';"|mysql zabbix
The client in the Zabbix world is called an agent
. Installation is straightforward.
aptitude install zabbix-agent
On Debian 10 Buster, the Zabbix client is configured to use a Zabbix server on localhost
. Of course, this is rarely the case. To use a different server, add the server IP to the entries of the Server
and ServerActive
parameters in the client configuration /etc/zabbix/zabbix_agentd.conf
.
If you are using a firewall, you will need to open port tcp/10050
. There is also the service zabbix-agent
for firewalld
.
There are several ways to add a client to the Zabbix server. One method is to log into the web frontend, select ‘Configuration’, ‘Hosts’ and press the blue ‘Create Host’ button in the top right corner. Add a template via ‘Configuration’ -> ‘Host’ -> click on the host name in the name column -> ‘Templates’ (of this host).
While the installation of Zabbix is simple and straightforward, and a lot of data can be easily collected with templates and nice graphs can be made visible, Zabbix 4.0.4 (and probably others) suffers from architectural shortcomings, probably resulting from the very flexible data model.
Therefore, one gets the impression that the web interface in its freshly installed form is not programmed with the vision of monitoring computer systems, but of querying a database in as many ways as possible.
However, there are good preconfigured Zabbix instances that have a plethora of graphs, dashboards and other aggregated data points from which a system administrator can understand the situation (and not just the problems) of an installation/cluster. As a result, there is a huge added value to a pre-configured Zabbix installation, such as some cluster management stacks provide.
A word about Zabbix deployment. If a pre-configured Zabbix server needs to be deployed to many sites, or if it needs to be set up for a specific hardware entity such as a rack or chassis (e.g. as a cluster entity), the Zabbix server configuration is mostly stored in its database and not in a set of configuration files. This means that Zabbix has no separation between configuration and process data. Therefore, if the configuration is done only through the web interface, the database content would have to be duplicated and host values/process data would have to be removed from the database for new hardware entities. This would also make Zabbix updates very difficult. I am not aware of a solution or a simple workaround for this problem, but it seems to be a major issue. Other monitoring systems like Icinga2 or Nagios which are configured via files can be easily distributed/cloned via git, puppet or other means as they separate process data from configuration data.
Version | Date | Notes |
---|---|---|
0.1.4 | 2023-05-26 | Improve writing |
0.1.3 | 2022-06-07 | Client explanation, shell->bash |
0.1.2 | 2020-12-27 | Critique Zabbix 4.0.4 |
0.1.1 | 2020-12-18 | Add hint for client configuration |
0.1.0 | 2020-12-15 | Initial release |