{"id":3894,"date":"2019-08-10T10:41:59","date_gmt":"2019-08-10T07:41:59","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3894"},"modified":"2024-03-12T07:39:14","modified_gmt":"2024-03-12T04:39:14","slug":"install-zabbix-agent-on-centos-7-for-zabbix-monitoring","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-zabbix-agent-on-centos-7-for-zabbix-monitoring\/","title":{"rendered":"Install Zabbix Agent on CentOS 7 for Zabbix Monitoring"},"content":{"rendered":"\n<p>Learn how to install Zabbix Agent on CentOS 7 for Zabbix monitoring.  In our previous guides, we covered the installation of Zabbix Server on Debian 10 Buster. This guide will focus on monitoring remote Linux hosts using Zabbix, specifically CentOS 7 host and the related RHEL hosts.<\/p>\n\n\n\n<p>Before you can continue, ensure that your Zabbix server is up and running. See the links below on how to install and configure Zabbix server on Debian 10 Buster.<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-zabbix-4-x-from-sources-on-debian-10-buster\/\" target=\"_blank\">Install Zabbix 4.x from Sources 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-server-on-debian-10-buster\/\" target=\"_blank\">Install Zabbix Server from APT on Debian 10 Buster<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Zabbix Agent on CentOS 7<\/h2>\n\n\n\n<p>In order to monitor Linux hosts with Zabbix, you need to install Zabbix agents on them. In this guide, we are use CentOS 7 as our hosts to monitor with Zabbix.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install Zabbix Agent<\/h3>\n\n\n\n<p>Update and upgrade your system packages.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>yum update\nyum upgrade<\/code><\/pre>\n\n\n\n<p>Install Zabbix Repository<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>yum install https:\/\/repo.zabbix.com\/zabbix\/4.2\/rhel\/7\/x86_64\/zabbix-release-4.2-1.el7.noarch.rpm<\/code><\/pre>\n\n\n\n<p>Install Zabbix Agent on CentOS 7<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>yum install zabbix-agent<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure Zabbix Agent<\/h3>\n\n\n\n<p>Once the installation is done, proceed to configure Zabbix agent in order for it to communicate with Zabbix server for monitoring.<\/p>\n\n\n\n<p>The default zabbix agent configuration file is <strong>\/etc\/zabbix\/zabbix_agentd.conf<\/strong>.<\/p>\n\n\n\n<p>Edit the configuration file and 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>vim \/etc\/zabbix\/zabbix_agentd.conf<\/code><\/pre>\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=centos7.example.com<\/code><\/pre>\n\n\n\n<p>If firewalld is running, allow Zabbix ports for passive checks.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>firewall-cmd --add-port=10050\/tcp --permanent&nbsp;\nfirewall-cmd --reload<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Running Zabbix Agent<\/h3>\n\n\n\n<p>After the configuration, start and enable Zabbix agent to run on system boot.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl start zabbix-agent\nsystemctl enable zabbix-agent<\/code><\/pre>\n\n\n\n<p>To check the status;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl status zabbix-agent<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n\u25cf zabbix-agent.service - Zabbix Agent\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/zabbix-agent.service; enabled; vendor preset: disabled)\n   Active: active (running) since Sat 2019-08-10 09:23:31 EAT; 36s ago\n Main PID: 15253 (zabbix_agentd)\n   CGroup: \/system.slice\/zabbix-agent.service\n           \u251c\u250015253 \/usr\/sbin\/zabbix_agentd -c \/etc\/zabbix\/zabbix_agentd.conf\n           \u251c\u250015254 \/usr\/sbin\/zabbix_agentd: collector [idle 1 sec]\n           \u251c\u250015255 \/usr\/sbin\/zabbix_agentd: listener #1 [waiting for connection]\n           \u251c\u250015256 \/usr\/sbin\/zabbix_agentd: listener #2 [waiting for connection]\n           \u251c\u250015257 \/usr\/sbin\/zabbix_agentd: listener #3 [waiting for connection]\n           \u2514\u250015258 \/usr\/sbin\/zabbix_agentd: active checks #1 [idle 1 sec]\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Add CentOS 7 Host to Zabbix Server<\/h3>\n\n\n\n<p>The Zabbix agent is installed and running on CentOS 7 host. Now it is time to add the agent to the server for monitoring. Login to Zabbix server and navigate to <strong>Configuration &gt; Hosts &gt; Create host<\/strong> to add your host.<\/p>\n\n\n\n<p>Configure the Host details like the hostname, visible (if you want), Groups (Linux Servers for example), IP address. Other details are optional.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-agent-hosts-details.png\"><img loading=\"lazy\" decoding=\"async\" width=\"898\" height=\"638\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-agent-hosts-details.png\" alt=\"Install Zabbix Agent on CentOS 7 for Zabbix Monitoring\" class=\"wp-image-3895\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-agent-hosts-details.png 898w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-agent-hosts-details-768x546.png 768w\" sizes=\"(max-width: 898px) 100vw, 898px\" \/><\/a><\/figure><\/div>\n\n\n<p>Next, you need to configure host template. Click on <strong>Templates &gt; Link new templates<\/strong>. Click select button and choose <strong>Template OS Linux<\/strong>. Once selected, click the <strong>add<\/strong> button to add the template.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/add-templates.png\"><img loading=\"lazy\" decoding=\"async\" width=\"701\" height=\"315\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/add-templates.png\" alt=\"Zabbix agent templates\" class=\"wp-image-3896\" title=\"\"><\/a><\/figure><\/div>\n\n\n<p>When templated is added and linked to your host, it should look like;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/templates-added.png\"><img loading=\"lazy\" decoding=\"async\" width=\"728\" height=\"332\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/templates-added.png\" alt=\"Adding Zabbix Templates\" class=\"wp-image-3897\" title=\"\"><\/a><\/figure><\/div>\n\n\n<p>You can learn more about Zabbix templates on <a href=\"https:\/\/www.zabbix.com\/documentation\/4.2\/manual\/config\/templates\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Zabbix Documentation page (opens in a new tab)\">Zabbix Documentation page<\/a>.<\/p>\n\n\n\n<p>Next, click <strong>Add<\/strong> to add the host to Zabbix server. The list of hosts is then displayed.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-host-added.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1362\" height=\"497\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-host-added.png\" alt=\"\" class=\"wp-image-3898\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-host-added.png 1362w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-host-added-768x280.png 768w\" sizes=\"(max-width: 1362px) 100vw, 1362px\" \/><\/a><\/figure><\/div>\n\n\n<p>CentOS 7 is now added to Zabbix server for monitoring. To check for the data collected from the host, click <strong>Monitoring &gt; Latest data<\/strong>. Select the host and click <strong>Apply<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/host-data.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1336\" height=\"642\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/host-data.png\" alt=\"Latest host data Zabbix\" class=\"wp-image-3899\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/host-data.png 1336w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/host-data-768x369.png 768w\" sizes=\"(max-width: 1336px) 100vw, 1336px\" \/><\/a><\/figure><\/div>\n\n\n<p>You can also check the data graphs. Click <strong>Monitoring &gt; Graphs &gt; Group <\/strong>(Linux Servers)<strong> &gt; Graph <\/strong>(say, CPU Load)<strong> &gt; Host <\/strong>(centos7.example.com) &gt; <strong>View as<\/strong> (Graph). Select the time range, <strong>last 1 hour<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-graphs.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1340\" height=\"590\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-graphs.png\" alt=\"Zabbix Graphs\" class=\"wp-image-3900\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-graphs.png 1340w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/zabbix-graphs-768x338.png 768w\" sizes=\"(max-width: 1340px) 100vw, 1340px\" \/><\/a><\/figure><\/div>\n\n\n<p>You can also add the graphs to Zabbix Screens. Click on <strong>Screens<\/strong> &gt; <strong>Edit Screens<\/strong>. Click the plus (<strong>+<\/strong>) on wherever you want to add your graph and click <strong>change<\/strong>. Screen configuration wizard opens up. Choose the graph to add to your screen, for example, CPU Load.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/screen-setting.png\"><img loading=\"lazy\" decoding=\"async\" width=\"611\" height=\"327\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/screen-setting.png\" alt=\"Zabbix screens settings\" class=\"wp-image-3901\" title=\"\"><\/a><\/figure><\/div>\n\n\n<p>You can leave other settings as default and click Add to create the graph. You can add as many resources to your screen as possible.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/screens.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1231\" height=\"644\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/screens.png\" alt=\"Zabbix Screens\" class=\"wp-image-3902\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/screens.png 1231w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/08\/screens-768x402.png 768w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/figure><\/div>\n\n\n<p>Related Tutorials;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-zabbix-agent-on-debian-10-buster\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install Zabbix Agent on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-zabbix-agent-on-freebsd-12\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install Zabbix Agent on FreeBSD 12<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/how-to-install-nagios-plugins-and-nrpe-agents-on-centos-7-rhel-7-fedora-29\/\" target=\"_blank\">How to Install Nagios Plugins and NRPE agents on CentOS 7\/RHEL 7\/Fedora 29<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/how-to-install-nagios-plugins-from-source-rhel-centos-oracle-linux\/\" target=\"_blank\">How to Install Nagios Plugins From Source RHEL\/CentOS\/Oracle Linux<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-elastic-stack-7-on-fedora-30-fedora-29-centos-7\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install Elastic Stack 7 on Fedora 30\/Fedora 29\/CentOS 7<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install Zabbix Agent on CentOS 7 for Zabbix monitoring. In our previous guides, we covered the installation of Zabbix Server on Debian<\/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":[121,72,261],"tags":[88,5136,74,1052,1062],"class_list":["post-3894","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-monitoring","category-zabbix","tag-centos-7","tag-install-zabbix-agent","tag-monitoring","tag-zabbix","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\/3894"}],"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=3894"}],"version-history":[{"count":5,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3894\/revisions"}],"predecessor-version":[{"id":21184,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3894\/revisions\/21184"}],"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=3894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=3894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=3894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}