출처 :  http://www.packetwatch.net/documents/guides/2010102203.php

 

 

Zabbix Agent in Red Hat Enterprise Linux

 

 

Last modified: Oct. 22, 2010

Contents
1 - Summary
2 - Zabbix Agent installation
3 - Service configuration
4 - Service check


 

1 - Summary

This guide will show how to install the Zabbix Agent in Red Hat Enterprise
Linux. The Zabbix Agent is the client software that installs on the servers and
sends information to the Zabbix server. Zabbix is an open source monitoring
solution. This has been tested in Red Hat Enterprise Linux 5.


2 - Zabbix Agent installation

Download the zabbix agent Linux 2.6.x package at http://www.zabbix.com/. Also,
download the zabbix source code. The source code is needed to get the init.d
script.
# cd ~
# mkdir zabbix
# cd zabbix/
# wget http://www.zabbix.com/downloads/$rel/zabbix_agents_$rel.linux2_6.$arch.tar.gz
# wget http://$mirror.sourceforge.net/zabbix/zabbix-$rel.tar.gz?download
# tar -zxvf zabbix_agents_$rel.linux2_6.$arch.tar.gz
# tar -zxvf zabbix-$rel.tar.gz
# sudo chown root:root bin/zabbix_*
Password:
# sudo chown root:root sbin/zabbix_agent*
Password:
# sudo cp bin/zabbix_* /usr/bin/
Password:
# sudo cp sbin/zabbix_agent* /usr/sbin/
Password:
# sudo cp zabbix-$rel/misc/init.d/redhat/8.0/zabbix_agentd /etc/rc.d/init.d/
Password:
# cd ~
# rm -fr zabbix/
# sudo chmod +x /etc/rc.d/init.d/zabbix_agentd
Password:
# sudo /sbin/chkconfig --add zabbix_agentd
Password:

Modify the init.d script to use the following.
  progdir="/usr/sbin/"
# sudo vi /etc/rc.d/init.d/zabbix_agentd
Password:

Create a group and user named zabbix.
# sudo /usr/sbin/groupadd -g 122 zabbix
Password:
# sudo /usr/sbin/useradd -c 'Zabbix' -d / -g zabbix -M -s /sbin/nologin zabbix
Password:


3 - Service configuration

Enable the zabbix agent service so that it will start when the system starts up.
# sudo /sbin/chkconfig zabbix_agentd on
Password:
# sudo /sbin/chkconfig --list zabbix_agentd
Password:
zabbix_agentd   0:off   1:off   2:on    3:on    4:on    5:on    6:off

Find where the configuration file should be put.
# grep .conf /etc/rc.d/init.d/zabbix_agentd
# chkconfig: - 55 45
# Source networking configuration.
. /etc/sysconfig/network
                # because of a broken config file
# strings /usr/sbin/zabbix_agentd | grep zabbix_agentd.conf
/etc/zabbix/zabbix_agentd.conf

You can create your own configuration file. Here is a simple example.
  Hostname=server.test.com
  ServerPort=10051
  Server=zabbix.test.com
# sudo mkdir /etc/zabbix/
Password:
# sudo vi /etc/zabbix/zabbix_agentd.conf
Password:

Before starting the service, make sure that tcp port 10050 is open in case you
are running firewall software. Here is a sample rule.
  -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
# sudo /sbin/service iptables stop
Password:
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
# sudo cp /etc/sysconfig/iptables /etc/sysconfig/iptables.previous
Password:
# sudo vi /etc/sysconfig/iptables
Password:
# sudo /sbin/service iptables start
Applying iptables firewall rules:                          [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]

Start the zabbix agent service.
# sudo /sbin/service zabbix_agentd start
Starting zabbix_agentd:                                    [  OK  ]
# sudo ps -U zabbix | grep zabbix_agentd
Password:
22176 ?        00:00:00 zabbix_agentd
22177 ?        00:00:00 zabbix_agentd
22179 ?        00:00:00 zabbix_agentd
22180 ?        00:00:00 zabbix_agentd
22181 ?        00:00:00 zabbix_agentd
22182 ?        00:00:00 zabbix_agentd


4 - Service check

Reboot your computer. Log in like normal and check to see that the zabbix
agent service is running. That's it, now you have the zabbix agent running in
Red Hat Enterprise Linux.
# sudo /sbin/shutdown -r now
Password:
# sudo ps -U zabbix | grep zabbix_agentd
Password:
2388 ?        00:00:00 zabbix_agentd
2390 ?        00:00:00 zabbix_agentd
2391 ?        00:00:00 zabbix_agentd
2392 ?        00:00:00 zabbix_agentd
2393 ?        00:00:00 zabbix_agentd
2394 ?        00:00:00 zabbix_agentd

 

 

+ Recent posts