How to configure Zabbix

From time to time you need to know how your server works. Zabbix is a tool that can help to solve this task. Here we tell you how to install and do first configuration of this monitoring system.

We assume that you have installed the base system. We will configure zabbix server, to do it you need to install some packages:

It takes some time to complete the action.

After installation you should edit some configuration files.

SNMP

Open its configuration file (/etc/snmp/snmpd.conf) in a text editor and uncomment follow line:

This line allows full access from the localhost (but in read only mode). After editing it should look like:

Save the changes and start the service:

The service is works now. You can inspect it, but you need another package (apt install snmp), just type in the command line snmpwalk -v 2c -c public localhost, you will see a big tree of the OIDs.

MariaDB

Zabbix needs a database, here we use mariadb server, let configure it:

It works now, now we need to create a database and a new account for zabbix service, let do it:

We created a new database called zabbix (create database zabbix;)

then we created a new local (localhost) user zabbix with the password test (create user zabbix@localhost identified by 'test';)

and the last command gives full access to the new database for the user (grant all on zabbix.* to zabbix@localhost;)

Zabbix Agent

Edit its configuration (/etc/zabbix/zabbix_agentd.conf), the only change you need to do is to uncomment follow line:

It should look like:

The line tells the service to drop privileges to specified user, by default the service started as root (insecure at all).

And start the service:

Now it works.

Zabbix Server

It is more complicated than the agent. Open its configuratiot file and edit it (/etc/zabbix/zabbix_server.conf).

Specify the password to access the database (you did it at database stage, 'test'):

By default the password is empty, type here our password, "test" was chosen in this example and the line looks like:

Next line which should be changed is DBSocket. By default MariaDB uses different socket file:

Just specify it here:

Don't forget to drop privileges (as we did it for zabbix-agent)

Save the changes. Next step is the database. The server requires valid data to start. The package has three files to do it:

In this example we use they all. Restore them into the database:

Now we can start the server:

IT WORKS! (wink)

Zabbix PHP frontend

There are many different ways to use it, we use it by default (as an example), enable the configuration, using a2enconf apache tool:

Copy an example configuration to the main place and edit it:

In our example we need to change password only, in your real config you need more changes.

Save the changes and let do the last step, and it is...

APACHE

Enable php module:

Also you need specify a timezone in the /etc/php/7.3/apache2/php.ini file:

The line could look like:

Now start the server:

That's all.

Open your favorite browser and configure it:

http://<your-server-name>/zabbix

and you should see something like this:

Enter the user name and its password (by default it is admin, zabbix)