How to install zabbix_agent 4.0 on centos7

Notice: This article is come from https://computingforgeeks.com/how-to-install-and-configure-zabbix-agent-4-0-on-ubuntu-18-04-and-centos-7/

Below steps are used to install Zabbix agent on CentOS 7

Step 1 Add Zabbix repositories

Add Zabbix 4.0 repositories using the commands below:

rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

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

yum install -y zabbix-agent zabbix-sender 

Step 2: Configuring Zabbix Agent

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

# cat /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=server1.example.com

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

You can check service status using the command:

$ sudo 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 Tue 2018-10-16 22:30:00 UTC; 50s 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]

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

For CentOS 7:

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

after installing zabbix-agent and zabbix-server you can test the connection between them by this command below on zabbix-server:
192.168.152.1 is the zabbix-agent

[root@localhost ~]# zabbix_get -s 192.168.152.1 -p 10050 -k "system.cpu.load[all,avg1]"
0.000000
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章