Instale el agente Zabbix en Ubuntu 20.04 / Ubuntu 20.10

Instale el agente Zabbix en Ubuntu 20.04 / Ubuntu 20.10

 

Zabbix agents can use passive or active checks to pass information. In passive check, Zabbix server (poller) requests an agent for certain information, and the agent sends back a value. In the active check, the agent process all data and pushes it to the Zabbix server. However, agent periodically connects the server to collect metric which needs to be monitored.

We will begin by installing Zabbix agent to the remote Ubuntu 20.04 host and later add a host to Zabbix server dashboard.

Step 1: Enable Zabbix repository on remote host

Begin by updating the package lists on the remote host.

$ sudo apt update

Then download the Zabbix repository Debian file from Zabbix download center as follows.

$ wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb

Then enable it using the dpkg command as follows:

$ sudo dpkg -i zabbix-release_5.0-1+focal_all.deb

Next, update the package index to ensure the repository is synced

$ sudo apt update

Step 2: Install Zabbix agent

Once the repository is in place, install Zabbix agent.

$ sudo apt install zabbix-agent

Once the installation is complete, check whether the Zabbix-agent daemon is running as follows:

$ sudo systemctl status zabbix-agent
Instale el agente Zabbix en Ubuntu 20.04

Zabbix-agent listens to port 10050. You might want to confirm this using the netstat command:

$ sudo netstat -pnltu
Instale el agente Zabbix en Ubuntu 20.04

The image above is a confirmation that Zabbix agent service is up and running.

Step 3: Configure Zabbix agent

We are satisfied that the Zabbix agent is running as expected. But that is not enough. We need to make a few changes to the configuration file at /etc/zabbix/zabbix_agentd.conf so that Zabbix agent can communicate with the Zabbix server.

So open the file.

$ sudo vim  /etc/zabbix/zabbix_agentd.conf

Here we are going to enable passive checks on the agent. First, locate the variable «Server» and «Hostname» in the zabbix_agentd.conf file.

For example, My Zabbix server IP is 10.128.0.16 and the hostname (client system) is ubuntu-20.

Server=10.128.0.16
Hostname=ubuntu-20

Save the changes and exit the file. Then restart Zabbix agent service to the changes to be effected.

$ sudo systemctl restart zabbix-agent

Note if you are configure active check then look for the variable «ServerActive» and uses port 10051.

Step 4: Configure the firewall

The final step in configuring the host is allowing the port that Zabbix agent listens to across the firewall. If you have UFW firewall enables, execute the commands:

$ sudo ufw allow 10050/tcp

Then reload the firewall

$ sudo ufw reload

And verify that the port has been opened or allowed on the firewall.

$ sudo ufw status
Instale el agente Zabbix en Ubuntu 20.04

Perfect! The zabbix-agent should now be in a position to communicate with the server.

Step 5: Add host on Zabbix server

By default, Zabbix only monitors the server on which it is installed. In this section, we will be adding the Zabbix host on the Zabbix server on the browser.

So, login in to your instance of Zabbix Server on the browser.

On the left navigation pane, Click on Configuration > Hosts

Instale el agente Zabbix en Ubuntu 20.04

Navigate to the top-right corner and click on ‘Create host

Instale el agente Zabbix en Ubuntu 20.04

On the window that appears, fill out the remote host details such as hostname. visible name, IP address, a brief description and click on the ‘Select‘ button adjacent to the ‘Groups’ text field.

Instale el agente Zabbix en Ubuntu 20.04

On the list that appears , select ‘Linux servers‘ and click on the ‘Select‘ button.

Instale el agente Zabbix en Ubuntu 20.04

This takes you back and you can view the newly added group as indicated.

Instale el agente Zabbix en Ubuntu 20.04

Next, click on the ‘Templates‘ tab and click the ‘Select‘ button adjacent to the ‘Link new Templates‘ text field.

Instale el agente Zabbix en Ubuntu 20.04

Click on the ‘Select‘ button next to the ‘Host group‘ text field as shown.

Instale el agente Zabbix en Ubuntu 20.04

Click on the ‘Templates/Operating systems’ option as shown.

Instale el agente Zabbix en Ubuntu 20.04

Then select the ‘Template OS Linux by Zabbix agent’ option and click on ‘Select‘.

Instale el agente Zabbix en Ubuntu 20.04

Then finally, click on the ‘Add’ button.

Instale el agente Zabbix en Ubuntu 20.04

And voila! your host will be listed on the dashboard as shown.

Instale el agente Zabbix en Ubuntu 20.04

Conclusion

In this tutorial, we learn how to install the Zabbix agent on Ubuntu 20.04 system and configure it to communicate with the Zabbix server. This helps to actively monitor target local resources and applications.

Deja un comentario

Tu dirección de correo electrónico no será publicada.

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.