Zabbix, an open source monitoring tool

about-zabbix

In the next article we are going to take a look at Zabbix. This is one monitoring tool open source. With it you will be able to monitor servers, CPU load, networks, cloud services and many other things.

Released on the terms of version 2 of the GNU General Public License, Zabbix is ​​Free Software. Before you start you may want to take a look at the demo to see if it's what you're looking for. You can also check the Project Wiki or the official documentation. In the following lines we are going to see how this tool can be installed in Ubuntu 18.04 LTS.

Add the repository

This tool is not available in the official Ubuntu 18.04 LTS package repository. Despite this, you can easily add the official package repository for the tool in Ubuntu 18.04 LTS and install the tool from there.

Open a terminal (Ctrl + Alt + T) and download the .DEB file necessary with the following command:

download zabbix repo

wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb

We continue installing the downloaded file:

install zabbix repo

sudo dpkg -i zabbix-release*.deb

The official repository of this tool must be added to our system. Now we will have to update the cache of the APT package repository:

sudo apt update

Zabbix installation and configuration

After the above, we can now install the tool:

install zabbix server

sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent

Create a MySQL / MariaDB database

To do this, we will start MySQL / MariaDB console with the following command:

start mariadb

sudo mysql -u root

Now create a database called zabbix with the following SQL command:

create zabbix database in mariadb

create database zabbix character set utf8 collate utf8_bin;

We continue to give all privileges to the zabbix user in the zabbix database we just created. We are also going to set a password for the zabbix user with the following SQL command:

add password db zabbix

grant all privileges on zabbix.* to zabbix@localhost identified by 'TU-CONTRASEÑA-AQUI';

NOTE: Make sure to replace YOUR-PASSWORD-HERE with the password that interests you.

The necessary permissions must be granted and the password must be set. For this example I set the password as zabbix, for simplicity.

We exit the MySQL / MariaDB console with the following command:

leave mariadb

quit;

We creating the necessary tables with the following command. It may take a while.

create db zabbix tables

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -Dzabbix -pzabbix

NOTE: Make sure to replace the zabbix password with the password that you have set.

Edit the configuration file

At this point we are going to edit the configuration file /etc/zabbix/zabbix_server.conf with the following command:

sudo vim /etc/zabbix/zabbix_server.conf

Inside the file, you have to look for the line DBUser = zabbix and add a new line below of it, as indicated in the following screenshot. Once you're done, save and close the file.

zabbix configuration file

DBPassword=zabbix, set the database password to zabbix. Replace it with the password that you have previously set.

Set the time zone

Now, we will have to set the correct time zone for the PHP engine. To do it, edit the configuration file /etc/zabbix/apache.conf:

sudo vim /etc/zabbix/apache.conf

file for time settings

Scroll down a bit and find the lines marked in the previous screenshot. Remove the # sign to uncomment them and changes Europe / Riga by the time zone that interests you. You can find more information about what to put there in Wikipedia.

options for setting time zones

The final configuration file in my case is as follows.

time configuration file with madrid

Once you're done, save and close the file.

Restart services

Let restart zabbix-server, zabbix-agent and apache2 services with the command:

sudo systemctl restart zabbix-server zabbix-agent apache2

If you want to add the zabbix-server, zabbix-agent and apache2 services to the system startup of your Ubuntu 18.04 LTS machine, use the command:

sudo systemctl enable zabbix-server zabbix-agent apache2

The zabbix-server, zabbix-agent, and apache2 services must be added at system startup and will start automatically when the computer boots.

Start Zabbix

Run the following command to find the IP address of your Ubuntu 18.04 LTS machine:

server ip

ip a

As can be seen, in my case the IP address of my Ubuntu 18.04 LTS machine is 10.0.2.15. It should be different for you. Change it from here on.

zabbix splash screen

Visit http://10.0.2.15/zabbix from the web browser. You should see a page like the previous screenshot. As you are running the interface of this tool for the first time, you must configure it. Click on "Next Step".

zabbix prerequisites

Make sure all previous requirements are correct. Continue by clicking on "Next Step".

configure zabbix db

Now type the password for the MySQL / MariaDB database user you set up earlier and click on "Next Step".

zabbix server details

Configure some server details. Click on "Next Step".

summary data zabbix

Make sure that all the information it's correct.

zabbix configuration finished

If you get this far, everything should have been set up correctly. Click on «Finish«.

zabbix lockdown

Now you should be able to log in with the user 'Admin' and by the Ministry of Home Affairs of the Government of Spain with the default password 'zabbix'.

zabbix interface

Once you log in, you should see the dashboard. You can now use this tool for whatever you need and as much as you want.


Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.