Welcome to our guide on how to compile and install Zabbix Agent on FreeBSD 12. We have covered the installation of Zabbix Agent using the PKG package manager in our previous guide.
Quickly Install Zabbix 4 into CentO...Quickly Install Zabbix 4 into CentOS 7Compile and Install Zabbix Agent on FreeBSD 12
Well, if you need to compile and install zabbix agent on FreeBSD 12, this guide is for you.
Create Zabbix System Account
To run Zabbix daemon, you need an unprivileged system user account. Therefore, before you can proceed, ensure that
zabbix system account is available. Run the command below to create the account.
Create Zabbix group
pw groupadd zabbix
Next, create the zabbix system account with the above group being its primary group,
pw adduser zabbix -g zabbix -d /nonexistent -s /usr/sbin/nologin -w no
man adduser to learn more about command line options used above.
Download Zabbix Source Code
Navigate to Zabbix sources download page and grab the source code. You can simply get the download link and use wget command to download to the server.
pkg install wget
Create Zabbix downloads directory
Next, pull the agent to directory above.
wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.2.6/zabbix-4.2.6.tar.gz -P /tmp/zabbix
Extract Zabbix Agent Source Code
Once the download completes, navigate to the download directory and extract the Zabbix source code.
tar xzf zabbix-4.2.6.tar.gz
Compile and Install Zabbix Agent on FreeBSD 12
The next step is to configure, compile and install Zabbix. This can be done as shown below.
To build Zabbix as the agent and and install Zabbix client utilities, pass the
--enable-agent option to the configure script.
After that, compile and install Zabbix agent.
Configure Zabbix Agent
After the installation, the next step is to configure Zabbix agent so that it can communicate with the server. The Zabbix agent configuration file is
Open the configuration file for editing;
Set the Zabbix server IP for both the passive and active checks and Zabbix agent hostname.
... Server=192.168.43.62 ## IP for Zabbix Server ... ServerActive=192.168.43.62 ... Hostname=freebsd12.example.com
Set the LogFile directory to
Save and quit the configuration file.
Next, create and set the user and group ownership of the Zabbix agent log file to zabbix.
chown zabbix:zabbix /var/log/zabbix_agentd.log
Next, copy the Zabbix agent service file located in the misc/init.d/freebsd/ of the source code directory to the startup directory.
cp misc/init.d/freebsd/zabbix_agentd /usr/local/etc/rc.d/
Make the service startup script executable.
chmod +x /usr/local/etc/rc.d/zabbix_agentd
Start Zabbix Agent service on FreeBSD
service zabbix_agentd onestart
If you need to enable Zabbix agent to run on system on boot, set
echo 'zabbix_agentd_enable="yes"' >> /etc/rc.conf
You can then start Zabbix Service as;
service zabbix_agentd start
If there is any firewall in between the Zabbix agent, open ports 10050 and 10051 which is used for both passive and active checks respectively.
Once you are done with Zabbix agent configuration, login to Zabbix server and add the host for monitoring.
To that far, you have learn how to compile and install Zabbix Agent on FreeBSD 12.