Table of Contents

Zabbix Client Install

Zabbix agent is in many Linux and Unix repositories, but they are generally fairly old. Additionally, I like to tie my systems to a particular version, generally a Long Term Support (LTS). As of this article (2023), Zabbix 6.0 LTS is current. You don't have all the latest and greatest abilities, but you have a stable system which will give you consistent, reliable results.

As such, I tend to download and install from the Linux repositories maintained by Zabbix. Instructions and downloads are located at https://www.zabbix.com/download

Precompiled agents for Windows/macOS/BSD, etc… are under Zabbix Agents on that page. For Linux, I prefer taking the instructions from the Zabbix Packages tab. This will set up your system to add a new repository, then install the Zabbix agent from that, where they can then be updated during normal operations.

The installation process is fairly straight forward; install the software and edit the config. The zabbix agent configuration file that comes with the installation is very large, but that is mainly because they include most of the default values as comments. I generally rename this file for a reference, then create a new file with values which are necessary.

Actually, there is only one value that is required, and that is the IP address of the Zabbix Server which will be communicating with this machine:

Server=ip.address.of.server

A much better configuration would be to explicitly define the hostname, as this is the name which the server matches on. For example, if your config file has the line

Hostname=myserver.example.org

your Zabbix server will use myserver.example.org as the identifier for its entry (which is why you can change the display name).

Linux

On Debian based machines, I also include the pid and log file locations, and an Include directive. The following config is the minimum I use on these.

PidFile=/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=ip.of.zabbix.server
Hostname=Name of Host
Include=/etc/zabbix/zabbix_agentd.d/*.conf

Following is a quick script that will generate a config file. It first saves the current config (if it is not already saved), then creates it. You define the Zabbix Server IP address in line 4.

configZabbix
#! /usr/bin/env bash
 
# you must change this to the IP of your current Zabbix server
ZABBIXSERVER=ip.of.zabbix.server
 
# if we have not already saved the agent conf, then do so
if [ ! -f /etc/zabbix/zabbix_agentd.conf.save ] ; then mv /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.save ; fi
# write the new configuration
# These first two lines are Debian specific
echo 'PidFile=/run/zabbix/zabbix_agentd.pid' > /etc/zabbix/zabbix_agentd.conf
echo 'LogFile=/var/log/zabbix/zabbix_agentd.log' >> /etc/zabbix/zabbix_agentd.conf
echo 'LogFileSize=0' >> /etc/zabbix/zabbix_agentd.conf
# allow traffic from ZABBIXSERVER
echo 'Server=$ZABBIXSERVER' >> /etc/zabbix/zabbix_agentd.conf
# grab our hostname and specifically use it
echo Hostname=`hostname -f` >> /etc/zabbix/zabbix_agentd.conf
# include anything in the includes directory
echo 'Include=/etc/zabbix/zabbix_agentd.d/*.conf' >> /etc/zabbix/zabbix_agentd.conf
# restart agent
service zabbix-agent restart

Note: I have never used Active Checks (though they sound pretty cool), so I always set that IP to null (the default).

Windows

For Windows machines, grab the zip file from https://www.zabbix.com/download (pre-compiled Binaries in the section Zabbix Agents). then follow the instructions at https://www.zabbix.com/documentation/6.0/en/manual/appendix/install/windows_agent. Following is a quick summary, assuming you downloaded the Archive package.

  1. Unzip the downloaded archive
  2. Create c:\zabbix
    1. Move the zabbix agent binary (zabbix_agentd.exe) and config file (zabbix_agentd.conf) into c:\zabbix
    2. Edit zabbix_agentd.conf, being sure to set hostname and servername
  3. Open an elevated command shell (cmd with Administrative privileges) and run the command
    c:\zabbix\zabbix_agentd.exe -c c:\zabbix\zabbix_agentd.conf -i
  4. Open service manager and start the Zabbix Agent
  5. Open your firewall and allow port 10050 through from the Zabbix Server

NOTE: There is a cool script at https://github.com/vetasen/ZabbixWinAgentDeploy that supposedly can be run on any Windows machine (powershell) that will automagically set up the Zabbix agent on that machine. Haven't tested it yet, but I intend to do so Real Soon Now.