In our earlier posts, we saw how to install zabbix server on Linux machines, Zabbix has its own Agent packages for various OS, which could sent data towards configured Zabbix in network, which would collect data and represent it on its Web-console for monitoring. In this post we will cover how to install Zabbix agent on CentOS/RHEL 7

Setup

For this setup we are using CentOS7

[root@srv7-sec ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 
[root@srv7-sec ~]# uname  -r
3.10.0-514.26.2.el7.x86_64

Installation of Zabbix Agent

To install Zabbix Agent on CentOS7, we first need to add Zabbix repository on CentOS machine like below.

[root@srv7-sec ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
Retrieving http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-3.2-1.el7         ################################# [100%]

Now we could easily install Zabbix Agent on CentOS/RHEL 7

ot@srv7-sec ~]# yum install zabbix-agent
Dependencies Resolved

================================================================================
 Package              Arch           Version               Repository      Size
================================================================================
Updating:
 zabbix-agent         x86_64         3.2.7-1.el7           zabbix         345 k

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


Installed:
  zabbix-agent.x86_64 0:3.2.7-1.el7                                             

Complete!

Configure Zabbix Agent

Now we need to configure Zabbix Agent. For same we need to edit Zabbix configuration file.

Below are effective derivatives that should consider once before start zabbix agent on this host

[root@srv7-sec ~]# egrep -v "^#|^$" /etc/zabbix/zabbix_agentd.conf 
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=10
Server=192.168.122.6
ServerActive=192.168.122.6
Hostname=srv7-sec
Include=/etc/zabbix/zabbix_agentd.d/

I only change below derivatives

Server (Zabbix Server where data need to send through Zabbix agent passive checks)
ServerActive (This is zabbi server for active checks)
Hostname (Host-name of this Machine used to configure in Zabbix Server)
LogFileSize (Log File Size in MB)

Start Zabbix Agent Service

Now we could start its service.

[root@srv7-sec ~]# systemctl start zabbix-agent
[root@srv7-sec ~]# 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.

Zabbix Agent is running on host.

[root@srv7-sec ~]# ps -fu zabbix
UID        PID  PPID  C STIME TTY          TIME CMD
zabbix    5636     1  0 09:00 ?        00:00:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
zabbix    5637  5636  0 09:00 ?        00:00:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix    5638  5636  0 09:00 ?        00:00:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix    5639  5636  0 09:00 ?        00:00:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix    5640  5636  0 09:00 ?        00:00:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix    5641  5636  0 09:00 ?        00:00:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]