Home > English > Tutorials > How to install zabbix agent on centos (system tracking web 2)

How to install zabbix agent on centos (system tracking web 2)

 

The next post about Zabbix. This post will instruct you how to install and configure Zabbix agents on Linux to directly track local resources on your system remotely

The main task of zabbix agent involves collecting information locally from the targets they run and send this data to a Zabbix server to be further proccessed and analyzed

Depend on each zabbix server version to download a compatible version of zabbix agent 

Install repo package

# rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm

Use yum command  to install zabbix agent 

# yum install zabbix-agent -y

Edit the configuration file zabbix 

# nano /etc/zabbix/zabbix_agentd.conf

Find these lines and change them 

### Option: Server
#       List of comma delimited IP addresses (or hostnames) of Zabbix servers.
#       Incoming connections will be accepted only from the hosts listed here.
#       If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally.
#
# Mandatory: no
# Default:
# Server=

Server=107.189.160.9(ip zabbix server)
 

### Option: ServerActive
#       List of comma delimited IP:port (or hostname:port) pairs of Zabbix servers for active checks.
#       If port is not specified, default port is used.
#       IPv6 addresses must be enclosed in square brackets if port for that host is specified.
#       If port is not specified, square brackets for IPv6 addresses are optional.
#       If this parameter is not specified, active checks are disabled.
#       Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#
# Mandatory: no
# Default:
# ServerActive=

ServerActive=107.189.160.9(ip zabbix server)
 

### Option: Hostname
#       Unique, case sensitive hostname.
#       Required for active checks and must match hostname as configured on the server.
#       Value is acquired from HostnameItem if undefined.
#
# Mandatory: no
# Default:
# Hostname=

Hostname=maxserver

Test the port. Zabbix agent runs port 10050 

[root@maxserver zabbix]# netstat -tunpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      26162/zabbix_agentd
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      12295/mysqld
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1446/sshd
tcp        0      0 :::10050                    :::*                        LISTEN      26162/zabbix_agentd
tcp        0      0 :::80                       :::*                        LISTEN      11902/httpd
tcp        0      0 :::22                       :::*                        LISTEN      1446/sshd

 

Open port 10050

# nano /etc/sysconfig/iptables

Add this line

-A INPUT -p tcp -m state --state NEW -m tcp --dport 10050 -j ACCEPT

Restart iptables

# service iptables restart

To check whether zabbix agent is connected to zabbix server or not, you use telnet command

# yum install telnet -y

# telnet zabbix_server_IP 10050

The result when successful will be

[root@maxserver zabbix]#  telnet 107.189.160.9 10050
Trying 107.189.160.9...
Connected to 107.189.160.9.
Escape character is '^]'.
Connection closed by foreign host.

 

Add Zabbix Agent to Zabbix server

Visit the page Zabbix server 

click on Configuration -> Hosts -> Create Host -> Host