Install ZABBIX agent on Linux (CentOS)

 

This was tested on Centos5, but should just about work on any similar OS.


1. Install the Zabbix-Agent on the Linux server that you want to monitor. 


[root@mail]#

[root@mail]# tar -xzvf zabbix-1.6.2.tar.gz

[root@mail]# cd zabbix-1.6.2     #the version should be suit for your current software

[root@mail zabbix-1.6.2]#./configure --enable-agent --prefix=/usr/local/zabbix [root@mail zabbix-1.6.2]# make install


Possible errors = error: no acceptable C compiler found in $PATH
The solution depends on what has already been installed on the server. Usually ‘yum install gcc’ is all that is required.

  • yum install gcc
  • Still not working? Try ‘yum update yum’, then ‘yum remove gcc gcc.x86_64’ then ‘yum install gcc’. It should work!


2. Configure the Zabbix-Agent.

First we need to add the zabbix user.

[root@mail zabbix-1.6.2]#

[root@mail zabbix-1.6.2]# adduser zabbix


Add the zabbix agent ports to your /etc/services file.


[root@mail zabbix-1.6.2]#

[root@mail zabbix-1.6.2]# echo ‘zabbix_agent 10050/tcp’ >> /etc/services [root@mail zabbix-1.6.2]# echo ‘zabbix_trap 10051/tcp’ >> /etc/services

[root@mail zabbix-1.6.2]#


Copy the sample configs to /etc/zabbix for the agentd.


[root@mail zabbix-1.6.2]#

[root@mail zabbix-1.6.2]# mkdir /etc/zabbix

[root@mail zabbix-1.6.2]# cp misc/conf/zabbix_agentd.conf /etc/zabbix

[root@mail zabbix-1.6.2]#


Now go to /etc/zabbix/zabbix_agentd.conf, and edit:

Server=192.168.0.69[Example IP address of the Zabbix Server]
Hostname=Mail_Server[Exactly the same name as our zabbix host name – See #1 above. NOTE:This name is case sensitive!]

 

Next, configure /etc/init.d/

Note: If you are not using a redhat OS, look in zabbix-1.6.2/misc/init.d/ and choose a more appropriate directory before executing the following command.

[root@mail zabbix-1.6.2]#

[root@mail zabbix-1.6.2]# cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentd

[root@mail zabbix-1.6.2]#


Now go to /etc/init.d/zabbix_agentd, and edit
Just below #!/bin/sh: add these two lines, including the # hash marks.

# chkconfig: 345 95 95 # description: Zabbix Agentd


Then edit these two lines, to read as shown below:
BASEDIR=/usr/local/zabbix ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_agentd [change bin to sbin]

Configure automatic starting and stopping of services.

[root@mail zabbix-1.6.2]#

[root@mail zabbix-1.6.2]# chkconfig --level 345 zabbix_agentd on

[root@mail zabbix-1.6.2]#


Next, edit /etc/hosts.allow on the Linux agent to allow the Zabbix Server IP address.

3. Dealing with the Firewall.

If using Webmin, you need to insert a line such as this:
If protocol is 
TCP and source is <IPofZabbix-Server> and destination port is 10050
This will result in a line in iptables as follows:
ACCEPT tcp – <IPofZabbix-Server> 0.0.0.0/0 tcp dpt: 10050

If you don’t have Webmin, you may need to ‘man iptables’ to check the commands necessary to insert that line in your iptables.

Almost there now:

[root@mail]#

[root@mail]# /etc/init.d/zabbix_agentd start

[root@mail]#


Check the zabbix_agentd log to see if all is okay!

[root@mail]# cat /tmp/zabbix_agentd.log 5392:20090202:115848 zabbix_agentd started. ZABBIX 1.6.2. 5393:20090202:115848 zabbix_agentd collector started 5394:20090202:115848 zabbix_agentd listener started 5395:20090202:115848 zabbix_agentd listener started 5396:20090202:115848 zabbix_agentd listener started 5397:20090202:115848 zabbix_agentd active check started [192.168.0.69:10051]

Log looks ok!

Now go back to the Zabbix Server web-interface and enable the Mail_Server(by default is zabbix_server) host. After a few moments you should be able to see data in Monitoring –> Latest data.

Before enabling the Triggers, check Configuration –> Items and disable any item that is shown as ‘Unsupported’, and any item that you don’t need (e.g. FTP server, etc.).

 

PS: If the zabbix server still cannot monitor the host, you should check out the outgoing IPaddr in you zabbix_server.conf.

 

cited from: http://www.zabbix.com/wiki/howto/monitor/os/linux/agentinstallonlinux and made a little revision

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值