Skip to content

Install Zabbix Agent on Ubuntu on Same Network as Zabbix Server

Description

I install Zabbix Agent on an Ubuntu 24.04 on the same network as my Zabbix Server.

After organizing a new server, I then download and install the Zabbix repository on the server.

I re-visit the Zabbix download page at

https://www.zabbix.com/download

I have the Zabbix Packages tab active,

I then choose 7.0 LTS, Ubuntu, 24.04 (Noble) and Agent.

Also note that I am not installing the Zabbix server again, so it doesn't matter what selections I have for the database or web server.

Make sure you select the correct version for your operating system and architecture.

Also make sure that your agents are using the same version as your Zabbix server.

#
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-1+ubuntu24.04_all.deb
#
dpkg -i zabbix-release_7.0-1+ubuntu24.04_all.deb
#
apt update

After that, I then run

#
apt install zabbix-agent

Now to configure the agent,

#
nano /etc/zabbix/zabbix_agentd.conf

Edit parameters for Server, ServerActive, Hostname and save.

After any changes to the configuration, you need to restart the agent.

#
service zabbix-agent restart

Now to configure a new host using the Zabbix Server user interface.

Ensure you use the same host name that you set in the configuration file.

Add the template "Linux by Zabbix agent" which contains passive checks.

Add it to a group.

Finally, add an interface for "Agent" describing the IP address and port that Zabbix server will find the agent at and then save.

Troubleshooting Agent Configuration

Ensure your hostname in the Zabbix UI matches the Hostname in the agents' configuration file.

For passive checks, the Zabbix server (or Zabbix Proxy, if configured to use a proxy), should be able to ping the agent by the IP address or domain name you set up in the host configuration interface fields. Ping will respond if ICMP is enabled on the server that you are pinging, and if there is no network rule blocking it somewhere.

You can also telnet, from the Zabbix server (or Zabbix Proxy, if configured to use a proxy), to the port (default 10050), that the agent process is listening on.

For active checks, the server with the agent running, should be able to ping the IP address, or domain name you've set in the ServerActive parameter in the agents' configuration file. This address will be the Zabbix Server, and/or the Zabbix Proxy. It should also be able to telnet to the Zabbix Server/Proxy port (default 10051)

To read the Zabbix Server logs, on the Zabbix Server type,

#
tail -f /var/log/zabbix/zabbix_server.log

To read the Zabbix Agent log files on the host,

#
tail -f /var/log/zabbix/zabbix_agentd.log

Telnet test doesn't connect to server across the network.

When you start the agent, you can do a telnet test locally to see that port 10050 is actually listening.

#
telnet 127.0.0.1 10050

If the port is open, it will print something like

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

Press Enter to close the connection.

But, if you try to telnet to your agents IP and port from the Zabbix server on your network, e.g.,

#
telnet 1.2.3.4 10050

And, you get a message

telnet: Unable to connect to remote host: Connection refused

Or, the connection hangs for a while and eventually times out.

There is likely a firewall issue somewhere on the journey.

In some cases, there may be a firewall service running locally on the server blocking.

If you are using Centos, then the firewall-cmd service may be running. You can stop it using,

#
systemctl stop firewalld.service

If you are using Ubuntu, then it may have UFW enabled. You can stop it using,

sudo ufw disable

If having these Firewall services running on the host is essential, then instead you need to create a rule to allow incoming TCP on 10050 to allow the IP address of your Zabbix server/proxy. You can allow specific incoming IP addresses, CIDR ranges, or all (0.0.0.0). Check the documentation for the firewall service being used on your host running the agent.

There is a large variety of firewall services that may be running by default on your hosts.

Here is a list of some,

  • Firewalld: Fedora, CentOS 7, and other distributions based on Red Hat or SUSE Linux use this configuration tool for iptables.
  • IPFW: FreeBSD
  • Packet Filter (pf): OpenBSD
  • IP Filter (ipf): FreeBSD, NetBSD, OpenBSD, and Solaris
  • Uncomplicated Firewall (UFW): Ubuntu's configuration tool for iptables.
  • nftables: Debian servers use this upgrade to iptables.
  • Windows Firewall: Microsoft Windows
  • iptables: Many OS firewall utilities are front-ends for iptables, which is discussed at the end of this article.

Instead of using these services, it may be easier to disable them, and use the firewall options provided in your Cloud Provider UI instead.

Note that if you have a hardware router/switch between your servers, you will also need to manage firewall port forwarding rules on those devices. If you can't manage those rules, then that is a good use-case for setting up your agent with active checks.

Agent Installation

Comments