Professional Documents
Culture Documents
Instalacion D Zabbix
Instalacion D Zabbix
Zabbix is one of the most popular open source monitoring software tools. Zabbix collects metrics from
your networks devices, systems and applications and ensures they are up and running. In case of any
issues, Zabbix will send notification alerts via various methods.
Zabbix can be deployed for agent-based and agent-less monitoring. The Zabbix agent has a small
footprint and can run on various platforms, including Linux, UNIX, macOS and Windows.
This tutorial describes how to install and configure the latest version of Zabbix 4.0 on an Ubuntu 18.04
server using MySQL as a database back-end. We will also show you how to install the Zabbix agent on
a remote host and add the host to the Zabbix server.
Prerequisites
Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.
sudo mysql
From within the MySQL shell, run the following SQL statement to create a new database:
Next, create a MySQL user account and grant access to the database:
1. Installing Zabbix
Download the latest Zabbix repository .deb package with following wget command:
wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-
release_4.0-2+bionic_all.deb
Once the file is downloaded, add the Zabbix repository to your Ubuntu 18.04 system by typing:
sudo apt install ./zabbix-release_4.0-2+bionic_all.deb
Update the package index and install the Zabbix server, the web frontend with MySQL database
support and the Zabbix agent:
sudo apt updatesudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-
agent
The command above will also install Apache, PHP and all required PHP modules.
During the installation, an Apache configuration file is created that contains all the required Apache and
PHP settings. You only need to make a small change and set the appropriate timezone.
Open the configuration file, uncomment the timezone line and change it to your time zone. You can
find the complete list of time zones supported by PHP.
/etc/apache2/conf-enabled/zabbix.conf
...
<IfModule mod_php7.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
php_value date.timezone America/Denver
</IfModule>
...
Once done, save the configuration file and restart the Apache service for the changes to take effect:
sudo systemctl restart apache2
The Zabbix installation package provides a dump file which includes an initial schema and data for the
Zabbix server with MySQL.
Import the MySQL dump file by running:
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
When prompted enter the user password you created previously. On success, no output is given. Next,
we need to edit the Zabbix configuration and set the database password.
Open the configuration file in your editor:
sudo nano /etc/zabbix/zabbix_server.conf
Search for the following section, uncomment the DBPassword directive and add the database
password.
/etc/zabbix/zabbix_server.conf
...
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=change-with-strong-password
...
Zabbix web interface is written in PHP and allows us to configure the server, view gathered data and
add hosts that we want to monitor.
Before start using the web interface, we need to install it.
Open your favorite browser and type your server’s domain name or public IP address followed by
/zabbix:
http(s)://your_domain_or_ip_address/zabbix
On the first screen, you will be presented with a welcome message. Click Next step to continue.
Next, you will see the following information page that lists all of the PHP prerequisites required to run
the Zabbix Frontend. All of the values in this table should be OK, scroll down to verify that everything
is set up correctly. Once verified, click Next step to proceed.
On the next screen, the setup wizard will ask you to enter your database connection details. Enter the
MySQL user and database details you previously created.
Entering a name for the server is optional. Enter it if you have more than one Zabbix monitoring
servers. If provided, it will be displayed in the menu bar and page titles.
Click Next step to continue.
On the next screen, you will be shown the pre-installation summary.
Click Next step and once the installation is completed you will be taken to a page informing you
that Zabbix web interface has been installed. To access your Zabbix login page click on the Finish
button.
The default user is “Admin” and the password is “zabbix”. Enter the username and password and click
on the Log in button.
Once you log in, you will be redirected to the Zabbix administration dashboard.
From here you can start customizing your Zabbix installation and adding new hosts. Your first step
should be to change the current password. To do that navigate to the user profile page by clicking on
the profile icon on the top navigation.
Update the package index and install the Zabbix agent package:
sudo apt updatesudo apt install zabbix-agent
Zabbix supports two methods for server-client communication encryption, Preshared Key (PSK) and
certificate-based encryption. In this tutorial, we will use the pre-shared keys (PSK) method to secure
the connection between the server and agent.
Use to following command to generate a pre-shared key and save it to a file:
openssl rand -hex 32 | sudo tee /etc/zabbix/zabbix_agentd.psk
Search for the Server IP Address and change it from the default value to your Zabbix server IP:
/etc/zabbix/zabbix_agentd.conf
...
### Option: Server
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS
names of Zabbix servers and Zabbix proxies.
# Incoming connections will be accepted only from the hosts listed here.
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1',
'::ffff:127.0.0.1' are treated equally
# and '::/0' will allow any IPv4 or IPv6 address.
# '0.0.0.0/0' can be used to allow any IPv4 address.
# Example:
Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
# Server=
Server=127.0.0.1
...
/etc/zabbix/zabbix_agentd.conf
...
### Option: TLSConnect
# How the agent should connect to server or proxy. Used for active checks.
# Only one value can be specified:
# unencrypted - connect without encryption
# psk - connect using TLS and a pre-shared key
# cert - connect using TLS and a certificate
#
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for
'unencrypted' connection)
# Default:
TLSConnect=psk
...
/etc/zabbix/zabbix_agentd.conf
...
### Option: TLSAccept
# What incoming connections to accept.
# Multiple values can be specified, separated by comma:
# unencrypted - accept connections without encryption
# psk - accept connections secured with TLS and a pre-shared
key
# cert - accept connections secured with TLS and a certificate
#
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for
'unencrypted' connection)
# Default:
TLSAccept=psk
...
Next, find the TLSPSKIdentity option, uncomment it and set it to PSK 001 The value needs to be
a unique string:
/etc/zabbix/zabbix_agentd.conf
...
### Option: TLSPSKIdentity
# Unique, case sensitive string used to identify the pre-shared key.
#
# Mandatory: no
# Default:
TLSPSKIdentity=PSK 001
...
Finally, locate the TLSPSKFile option, uncomment it and set it to point to the previously created pre-
shared key:
/etc/zabbix/zabbix_agentd.conf
...
### Option: TLSPSKFile
# Full pathname of a file containing the pre-shared key.
#
# Mandatory: no
# Default:
TLSPSKFile=/etc/zabbix/zabbix_agentd.psk
...
Next, you’ll need to add a firewall rule that enables traffic from your Zabbix server on TCP port
10050.
Assuming you are using UFW to manage your firewall and you want to allow access from the
192.168.0.105 IP address you would run the following command:
sudo ufw allow proto tcp from 192.168.0.105 to any port 10050
Now that the agent on the remote host that you want to monitor is installed and configured the Next
step is to register the host on the Zabbix server.
Log in to the Zabbix Server web interface as the admin user:
http(s)://your_domain_or_ip_address/zabbix
Once inside, in the top navigation bar click on the Configuration, and then Hosts
Next, click on the blue Create host button in the top right corner of the screen and the host
configuration page will open:
Enter the Hostname and the IP Address of the remote host machine you want to monitor. Add the host
to one or multiple groups by selecting the group from the list, or enter a non-existing group name to
create a new one. The Linux Servers group is a good choice.
Once done, click the Templates tab. Select the Template OS Linux and click on the Add link
to add the template to the host.
Next, click on the Encryption tab. Select PSK for both Connections to host and
Connections from host.
Set the PSK identity value to PSK 001, the value of the TLSPSKIdentity option of the
Zabbix agent you configured in the previous step.
In the PSK value filed add the key you generated for the Zabbix agent, the one stored in the
/etc/zabbix/zabbix_agentd.psk file.
En caso de tener problemas con el instalador de Windows podemos descargar de la web de Zabbix el
agente, puedes encontrarlo en “Zabbix pre-compiled agents” y “Windows”. El fichero que nos
descarguemos lo descomprimiremos en C:\Zabbix\. Ahora editaremos el fichero de configuración que
se encuentra en C:\Zabbix\zabbix_agents_2.4.4.win\conf\zabbix_agentd.win.conf y haremos los
mismos cambios que en “Configurar agente Zabbix en Linux”, ahora ya podremos gestionar nuestro
agente desde “símbolos de sistema” con estos comandos:
-Instalar Servicio:
C:\Zabbix\zabbix_agents_2.4.4.win\bin\win32\zabbix_agentd.exe
--config
C:\Zabbix\zabbix_agents_2.4.4.win\conf\zabbix_agentd.win.conf –
install
-Iniciar Servicio:
C:\Zabbix\zabbix_agents_2.4.4.win\bin\win32\zabbix_agentd.exe –start
-Parar Servicio:
C:\Zabbix\zabbix_agents_2.4.4.win\bin\win32\zabbix_agentd.exe –stop
-Borrar Servicio:
C:\Zabbix\zabbix_agents_2.4.4.win\bin\win32\zabbix_agentd.exe –
uninstall
for ip
10.0.2.15/zabbix
FQDN
localhost/zabbix
user: Admin
pass: zabbix
user: zabbix@localhost
pass: zabbix
port: 10050
Debian 9
# wget http://repo.zabbix.com/zabbix/3.4/debian/pool/main/z/zabbix-
release/zabbix-release_3.4-1+stretch_all.deb
# dpkg -i zabbix-release_3.4-1+stretch_all.deb
# apt-get update
# apt-get install zabbix-agent
# update-rc.d zabbix-agent enable
# /etc/init.d/zabbix-agent start