{"id":4336,"date":"2019-10-02T21:40:57","date_gmt":"2019-10-02T18:40:57","guid":{"rendered":"https:\/\/kifarunix.com\/?p=4336"},"modified":"2024-03-12T22:29:47","modified_gmt":"2024-03-12T19:29:47","slug":"compile-and-install-zabbix-agent-on-freebsd-12","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/compile-and-install-zabbix-agent-on-freebsd-12\/","title":{"rendered":"Compile and Install Zabbix Agent on FreeBSD 12"},"content":{"rendered":"\n<p>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.<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-zabbix-agent-on-freebsd-12\/\" target=\"_blank\">Install Zabbix Agent on FreeBSD 12<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install Zabbix Agent on FreeBSD 12<\/h2>\n\n\n\n<p>Well, if you need to install zabbix agent on FreeBSD 12, this guide is for you.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create Zabbix System Account<\/h3>\n\n\n\n<p>To run Zabbix daemon, you need an unprivileged system user account. Therefore, before you can proceed, ensure that <strong><code>zabbix<\/code><\/strong> system account is available. Run the command below to create the account.<\/p>\n\n\n\n<p>Create Zabbix group<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>pw groupadd zabbix<\/code><\/pre>\n\n\n\n<p>Next, create the zabbix system account with the above group being its primary group, <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>pw adduser zabbix -g zabbix -d \/nonexistent -s \/usr\/sbin\/nologin -w no<\/code><\/pre>\n\n\n\n<p>Consult <code><strong>man adduser<\/strong><\/code> to learn more about command line options used above.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Download Zabbix Source Code<\/h3>\n\n\n\n<p>Navigate to <a rel=\"noreferrer noopener\" aria-label=\"Zabbix Agents Download&#039;s page (opens in a new tab)\" href=\"https:\/\/www.zabbix.com\/download_agents\" target=\"_blank\">Zabbix sources download page<\/a> and grab the source code. You can simply get the download link and use <strong>wget<\/strong> command to download to the server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>pkg install wget<\/code><\/pre>\n\n\n\n<p>Create Zabbix downloads directory<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mkdir \/tmp\/zabbix<\/code><\/pre>\n\n\n\n<p>Next, pull the agent to directory above.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>wget https:\/\/sourceforge.net\/projects\/zabbix\/files\/ZABBIX%20Latest%20Stable\/4.2.6\/zabbix-4.2.6.tar.gz -P \/tmp\/zabbix<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Extract Zabbix Agent Source Code<\/h3>\n\n\n\n<p>Once the download completes, navigate to the download directory and extract the Zabbix source code.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cd \/tmp\/zabbix<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>tar xzf zabbix-4.2.6.tar.gz <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Zabbix Agent on FreeBSD 12<\/h3>\n\n\n\n<p>The next step is to configure, compile and install Zabbix. This can be done as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cd zabbix-4.2.6<\/code><\/pre>\n\n\n\n<p>To build Zabbix as the agent and and install Zabbix client utilities, pass the <strong><code>--enable-agent<\/code><\/strong> option to the configure script.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>.\/configure --enable-agent<\/code><\/pre>\n\n\n\n<p>After that, compile and install Zabbix agent.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make install<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure Zabbix Agent<\/h3>\n\n\n\n<p>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  <code>\/usr\/local\/etc\/zabbix_agentd.conf<\/code>.<\/p>\n\n\n\n<p>Open the configuration file for editing;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/usr\/local\/etc\/zabbix_agentd.conf<\/code><\/pre>\n\n\n\n<p>Set the Zabbix server IP for both the passive and active checks and Zabbix agent hostname.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>...\nServer=192.168.43.62             ## IP for Zabbix Server\n...\nServerActive=192.168.43.62        \n...\nHostname=freebsd12.example.com<\/code><\/pre>\n\n\n\n<p>Set the LogFile directory to <code><strong>\/var\/log\/<\/strong><\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>LogFile=\/var\/log\/zabbix_agentd.log<\/code><\/pre>\n\n\n\n<p>Save and quit the configuration file.<\/p>\n\n\n\n<p>Next, create and set the user and group ownership of the Zabbix agent log file to zabbix.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>touch \/var\/log\/zabbix_agentd.log<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>chown zabbix:zabbix \/var\/log\/zabbix_agentd.log<\/code><\/pre>\n\n\n\n<p>Next, copy the Zabbix agent service file located in the misc\/init.d\/freebsd\/ of the source code directory to the startup directory.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cp misc\/init.d\/freebsd\/zabbix_agentd \/usr\/local\/etc\/rc.d\/<\/code><\/pre>\n\n\n\n<p>Make the service startup script executable.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>chmod +x \/usr\/local\/etc\/rc.d\/zabbix_agentd<\/code><\/pre>\n\n\n\n<p>Start Zabbix Agent service on FreeBSD<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service zabbix_agentd onestart<\/code><\/pre>\n\n\n\n<p>If you need to enable Zabbix agent to run on system on boot, set <code><strong>zabbix_agentd_enable<\/strong><\/code> to <code><strong>YES<\/strong><\/code> in <strong><code>\/etc\/rc.conf<\/code><\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>echo 'zabbix_agentd_enable=\"yes\"' &gt;&gt; \/etc\/rc.conf<\/code><\/pre>\n\n\n\n<p>You can then start Zabbix Service as;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>service zabbix_agentd start<\/code><\/pre>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>Once you are done with Zabbix agent configuration, login to Zabbix server and add the host for monitoring.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Related Guides<\/h3>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-zabbix-agent-on-debian-10-buster\/\" target=\"_blank\">Install Zabbix Agent on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-zabbix-agent-on-freebsd-12\/\" target=\"_blank\">Install Zabbix Agent on FreeBSD 12<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-zabbix-agent-on-centos-7-for-zabbix-monitoring\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install Zabbix Agent on CentOS 7 for Zabbix Monitoring<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-install-and-configure-zabbix-4-0-from-source-on-fedora-29-fedora-28-centos-7\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">How to Install and Configure Zabbix 4.0 from Source on Fedora 29\/Fedora 28\/CentOS 7<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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<\/p>\n","protected":false},"author":1,"featured_media":12698,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[72,121,261],"tags":[5138,278,1053,1062],"class_list":["post-4336","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-monitoring","category-howtos","category-zabbix","tag-compile-and-install-zabbix-agent-on-freebsd-12","tag-freebsd-12","tag-zabbix-4-2","tag-zabbix-agent","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4336"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=4336"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4336\/revisions"}],"predecessor-version":[{"id":21241,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4336\/revisions\/21241"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12698"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=4336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=4336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=4336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}