Using the Zabbix agent
Previously, we installed the Zabbix agent on the same host and monitored a single item for it. It's now time to expand and look at how inter-host connectivity works.
To continue, install the Zabbix agent on another host. The easiest way might be installing from the distribution packages—or you may choose to compile it from the source. If installing from the packages on Red Hat Enterprise Linux (RHEL)/Debian-based systems, refer to Chapter 1, Getting Started with Zabbix, for repository instructions. A potential agent package name could be zabbix-agent.
Compiling the agent only from the source is done in a similar way to how all components were included for compilation in Chapter 1, Getting Started with Zabbix. Instead of the full configure line, we will use a single flag this time:
$ ./configure --enable-agent
Configuration should complete successfully, and the following summary lines are important:
Enable server: no Enable proxy: no Enable agent: yes
If the output you see matches the preceding output, continue by issuing the following command:
$ make install
Compilation should complete without any errors, and it should do so relatively quickly. However, be aware that we compile the agent without support for encryption. I have added the URL to the documentation at the end of this chapter, which explains what options are needed to add encryption.
If you install distribution packages on a distribution different from where the server is installed, don't worry when the agent daemon has an older version than the server. This is supported and should work well. However, if the agent is older then 1.4 it will not work on Zabbix 4.0 as changes have been made in how the agent communicates with the Zabbix server. A newer agent with a newer server might not work and is not supported. You should avoid using an older server with newer agents as this has not been tested so there is no guarantee it will work as intended.
Staying with an older agent can be more convenient as you already have one installed and working well. When setting up new ones, it is suggested you go with the latest one, as it might have bugs fixed, improved performance, more supported items for a particular platform, and other benefits.
With the agent installed, now is the time to start it up. How this is done exactly depends on the installation method—and if you installed from the packages, it depends on the distribution as well. For examples on how to start up the agent, refer to Chapter 1, Getting Started with Zabbix. As a quick reminder, if you installed from packages on an RHEL/Debian-based system, the agent daemon can likely be started up like this:
# systemctl start zabbix-agentd
If you installed from the source, directly execute the binary:
# <path>/zabbix_agentd
Once the agent has been started, we also have to add this new host to the configuration:
- Go to Configuration | Hosts
- Make sure that the Group drop-down menu in the upper-right corner says Linux servers
- Click on the Create host button and fill in this form:
Here are some tips on filling out the form:
- Host name: Feel free to choose a descriptive name, or simply enter Another host
- Agent interfaces: Fill in either the IP address or DNS name, depending on which connection method you want to use
- Connect to: If you decide to go with DNS name, switch to DNS
When you're done, click on the Add button at the bottom.