Set up zabbix agent on centOS

If already existing zabbix-agent then remove it with
yum remove zabbix-agent
yum remove zabbix
download zabbix binaries
wget https://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-2.2.6-1.el6.x86_64.rpm
wget https://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-agent-2.2.6-1.el6.x86_64.rpm
or browse for latest:
https://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/

By default centOS do not include wget. So you can also copy the binaries with WinSCP

Install zabbix agent
rpm -ivh zabbix-2.2.6-1.el6.x86_64.rpm
rpm -ivh zabbix-agent-2.2.6-1.el6.x86_64.rpm
Empty existing configuration
cd /etc/zabbix
truncate --size 0 zabbix_agentd.conf
There are two files in directory zabbix_agent.conf and zabbix_agentd.conf.
The right one is zabbix_agentd.conf with d at the end!

copy your configuration content to clipboard
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
DebugLevel=3 
EnableRemoteCommands=1 
Server=zabbix.domain.com
Hostname=newhost.domain.com
open zabbix configuration
cd /etc/zabbix
vi zabbix_agentd.conf
press i to insert some stuff
if use putty the press right mouse click to paste content from clipboard.
press esc and write :wq to save the file

Set zabbix to start after computer reboot
chkconfig zabbix-agent on
check iptebles if this client has exception for zabbix server
service iptables status
insert exception
iptables -I INPUT 7 -s zabbix.domain.com -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
replace 7 line number with line number where EJECT rule is having a good time
replace zabbix.domain.com with zabbix server ip adress

Save new configuration to load after reboot
iptables-save > /etc/sysconfig/iptables
Re-start zabbix agent
service zabbix-agent restart
or
service zabbix-agentd restart

No comments: