Installing Zabbix on Ubuntu

Zabbix is an open source software for monitoring of networks and applications. In the set of applications Zabbix agent remote monitoring server is also monitored via SNMP, ICMP, or TCP, and other protocols. You can configure the monitoring with the agent and get as much information, or simply check availability using one of the possible protocols.

By the way, Zabbix was developed by a programmer from Russia. In this small article we will discuss how to install Zabbix on Ubuntu or Debian. Talk about setting up client and server programs and monitoring of all necessary.

Install the Zabbix server

Before we can install zabbix ubuntu 17.04, 16.04 and in other versions, you will need something to configure. Need to install web server, MySQL, and PHP. If these services you have configured, then just skip this step.

Installing Apache, PHP, MySQL

To install follow these commands:

sudo apt update
$ sudo apt install apache2
$ sudo apt install mysql-server
$ sudo apt install php php-cli php-common php-mysql

Next you need to set the correct time zone in php.ini. You need a Data section and string timezone:

[Date]
date.timezone = 'Europe/Kiev'

Add repository

Repository Zabbix is added to the system in very unusual way as well as CentOS. You only need to install one deb package. You can download the correct version of the link, at the moment the latest version is 3.2.

For example, you can use wget to download the file:

wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb

If you have another operating system, view the list of files on the server through the browser and select the desired installer. Then install zabbix 3.2 on Ubuntu:

sudo dpkg-i zabbix-release_3.2-1+xenial_all.deb
$ sudo apt-get update

Install and configure Zabbix

When the repository is added, you can move on to configuring the Zabbix server. To install programs, run:

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

As I said, the program will need a database. Now we have to create it and to give all necessary privileges to the user:

mysql-u root-p

mysql> CREATE DATABASE zabbixdb;
mysql> ALTER DATABASE zabbixdb CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> GRANT ALL on zabbixdb.* to [email protected] IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;

For normal work Zabbix needs the database encoding UTF-8, if you create database in the character set utf8mb4, we get the error: “Specified key was too long; max key length is 767 bytes”. Next you need to download all tables in the database, they are in the folder /usr/share/zabbix-server-mysql/. Is zabbix and zabbixdb need to specify your user and database name:

zcat schema.sql.gz | mysql-u zabbix -p zabbixdb
$ zcat data.sql.gz | mysql-u zabbix -p zabbixdb
$ zcat images.sql.gz | mysql-u zabbix -p zabbixdb

So Zabbix can connect to the database you want to edit the configuration file /etc/zabbix/zabbix_server.conf and are there to specify authentication data:

sudo vi /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbixdb
DBUser=zabbix
DBPassword=password

Next, turn on the zabbix configuration file for apache2:

sudo a2enconf zabbix-frontend-php

Now you need to restart Zabbix and Apache to apply the changes:

sudo service apache2 restart
$ sudo service zabbix-server restart

Install and configure Zabbix Ubuntu is almost complete, it remains to configure the web interface.

Configuring the zabbix frontend

The web the interface is ready, now you can open it by typing in the address bar http://адрес_сервера/zabbix/

On the first page click “Next”. In the next step the program checks whether you have configured the PHP interpreter:

Then specify the access parameters to the database, they will be used for the web interface:

In the next step, you can change ip and port on which to listen to Zabbix:

The last step, check if everything is right and if you needed anything to change:

If you receive this error, the file you need to download and save into /etc/zabbix/ manually:

wget http://ip_сервера/zabbix/setup.php?save_config=1
$ sudo mv setup.php?save_config=1 /etc/zabbix/zabbix.conf.php

The owner of the file should be changed to www-data, so the program had to it access rights:

sudo chown www-data /etc/zabbix/zabbix.conf.php

Now go back to browser and press “Finish”:

You will see the window for entering username and password. Use the default, username is admin and the password zabbix.

That’s it, now install Zabbix Ubuntu completed and you can proceed to set up.

Installing Zabbix Agent

To start monitoring the remote host, we need the Zabbix Agent. This program collects all available data about the system load, resource usage, and sends it all to the Zabbix server. You can configure active checks when the agent will send all data to the server periodically or passive, and when data will be sent on request.

So you need to install Zabbix Agent on all systems for which you need to observe. For installations that use the same repository for the server, see above for how to add. Then use the command to install:

sudo apt-get install zabbix-agent

Now, edit the file, we need to specify the server’s IP address and hostname:

sudo vi /etc/zabbix/zabbix_agentd.conf

Server=192.168.1.2
Hostname=Zabbix

After changing configuration, need to restart the service zabbix-agent:

sudo service zabbix-agent restart

Now you can add new host in Zabbix and monitor its condition panel.

Insights

Now you know how to install Zabbix on Ubuntu 16.04. Despite the fact that during the installation you can find a few pitfalls, it all goes quite simple. I hope this information was useful for you.

Source: losst.ru

(Visited 42 times, 1 visits today)