We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install and Configure Zabbix agent 5 on CentOS 7

Learn how to – Install and Configure Zabbix agent 5 on CentOS 7.

In our previous guide, we covered the installation of Zabbix Server on CentOS 7 and Zabbix Server on Ubuntu . This is a continuation guide on Zabbix monitoring of your entire Infrastructure – Linux systems, Windows servers, network routers, network switches e.t.c. So let’s get started with how to Install and configure Zabbix agent 5.0 on CentOS 7.

For Ubuntu servers, check How to Install and configure Zabbix agent on Ubuntu

Zabbix agent is a program developed in C. It runs on various supported platforms, including Linux, UNIX, and Windows. The work of Zabbix agent is to collect data such as CPU, memory, disk and network interface usage from a device. It has a small resource footprint considering that monitoring configurations are centralized on Zabbix server.

image from zabbix

How Zabbix agent works

Zabbix agent can do both passive (polling) and active checks (trapping). The checks can be performed at an interval or based on specific times schedule. Here is the difference between passive and active checks:

Passive checks (polling):

  • Zabbix server (or proxy) requests a value from Zabbix agent
  • Agent processes the request and returns the value to Zabbix server (or proxy)

Active checks (trapping):

  • Zabbix agent requests from Zabbix server (or proxy) a list of active checks
  • The agent sends the results in periodically

The image below from Zabbix may help visualize passive and active checks in action:

image from zabbix.com

How to Install Zabbix agent on CentOS 7

Below steps are used to install Zabbix agent on CentOS 7

Step 1: Add Zabbix repositories

Add Zabbix 5.0 repositories using the commands below:

sudo yum install https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

Proceed with the installation as required

....
zabbix-release-5.0-1.el7.noarch.rpm                                                                                                                                            |  14 kB  00:00:00
Examining /var/tmp/yum-root-k4gNg7/zabbix-release-5.0-1.el7.noarch.rpm: zabbix-release-5.0-1.el7.noarch
Marking /var/tmp/yum-root-k4gNg7/zabbix-release-5.0-1.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package zabbix-release.noarch 0:5.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================================================
 Package                                       Arch                                  Version                                    Repository                                                       Size
======================================================================================================================================================================================================
Installing:
 zabbix-release                                noarch                                5.0-1.el7                                  /zabbix-release-5.0-1.el7.noarch                                 22 k

Transaction Summary
======================================================================================================================================================================================================
Install  1 Package

Total size: 22 k
Installed size: 22 k
Is this ok [y/d/N]: y

Once the repo has been added, install Zabbix agent by executing the following command on your terminal.

$ sudo yum install vim zabbix-agent zabbix-sender
...
Resolving Dependencies
--> Running transaction check
---> Package zabbix-agent.x86_64 0:5.0.18-1.el7 will be installed
---> Package zabbix-sender.x86_64 0:5.0.18-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================================================
 Package                                            Arch                                        Version                                             Repository                                   Size
======================================================================================================================================================================================================
Installing:
 zabbix-agent                                       x86_64                                      5.0.18-1.el7                                        zabbix                                      472 k
 zabbix-sender                                      x86_64                                      5.0.18-1.el7                                        zabbix                                      363 k

Transaction Summary
======================================================================================================================================================================================================
Install  2 Packages

Total download size: 836 k
Installed size: 3.4 M
Is this ok [y/d/N]: y

Step 2: Configuring Zabbix Agent on CentOS 7

Zabbix agent configuration is /etc/zabbix/zabbix_agentd.conf. Edit

$ sudo vim /etc/zabbix/zabbix_agentd.conf
# On line 97 - Specify Zabbix server IP Address
Server=192.168.10.2
# On line 138 - Specify Zabbix server ( For active checks)
ServerActive=192.168.10.2
# On line 150 - Set server hostname reported by Zabbix agent
Hostname=node-01.ownyourlife.com.ng

Start zabbix-agent after making the change, also enable the service to start on boot:

$ sudo systemctl start zabbix-agent
$ sudo systemctl enable zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.

You can check service status using the command:

$ systemctl status zabbix-agent
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2018-06-15 14:55:00 UTC; 20s ago
Main PID: 28026 (zabbix_agentd)
CGroup: /system.slice/zabbix-agent.service
├─28026 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
├─28027 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
├─28028 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
├─28029 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
├─28030 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
└─28031 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

Jun 15 14:55:00 node-01.ownyourlife.com.ng systemd[1]: Starting Zabbix Agent...
Jun 15 14:55:00 node-01.ownyourlife.com.ng systemd[1]: Started Zabbix Agent.

If you have firewalld enabled, allow port 10050/tcp on the firewall. This is used by Zabbix agent daemon.

$ sudo firewall-cmd --permanent --add-port=10050/tcp
success
$ sudo firewall-cmd --reload
success

You can check service port if listening using ss or netstat commands:

$ sudo ss -tunelp | grep 10050
tcp    LISTEN     0      128       *:10050                 *:*                   users:(("zabbix_agentd",pid=28031,fd=6),("zabbix_agentd",pid=28030,fd=6),("zabbix_agentd",pid=28029,fd=6),("zabbix_agentd",pid=28028,fd=6),("zabbix_agentd",pid=28027,fd=6),("zabbix_agentd",pid=28026,fd=6)) uid:385 ino:15465825 sk:ffffa119c2e264c0 <->
tcp    LISTEN     0      128      :::10050                :::*                   users:(("zabbix_agentd",pid=28031,fd=7),("zabbix_agentd",pid=28030,fd=7),("zabbix_agentd",pid=28029,fd=7),("zabbix_agentd",pid=28028,fd=7),("zabbix_agentd",pid=28027,fd=7),("zabbix_agentd",pid=28026,fd=7)) uid:385 ino:15465826 sk:ffffa11973db8880 v6only:1 <-

Step 3: Add host to Zabbix Server

Login to admin Zabbix server interface, and go to Configuration > Hosts > Create host. Provide the following information:

  • Host name of the server to be monitored
  • Visible name for the server to be monitored.
  • Select the group or add a new group for “Groups” field.
  • IP address
  • Zabbix agent service port -default is 10050

Then go to Templates tab.

1. Click the select button under Link new templates section

Select the templates you want to use:

2. Once you have selected the templates, click on the Add link to link templates to your target systemAfter the templates are linked, they’ll appear on the  Linked templates section

Update the setting using Update button.

After few minutes, monitoring data will be collected and you can visualize them using Zabbix graphs. Default host graphs can be accessed on

Monitoring > Graphs > <Host|Graph>

Below are the Ram and CPU utilization graphs for the host we added earlier.

More guides on Monitoring:

Cart

Your Cart is Empty

Back To Shop