(4)安装配置 rrdtool
# cd /opt
#wget http://down1.chinaunix.net/distfiles/rrdtool-1.4.5.tar.gz
# tar xvf rrdtool-1.4.5.tar.gz
# cd rrdtool-1.4.5
# ./configure –prefix=/usr/local/rrdtool –enable-shared
# make && make install
将rrdtool的命令加入配置环境下:
# vi /etc/profile
export PATH=$PATH:/usr/local/rrdtool/bin
#source /etc/profile
(5)安装配置其他所要依赖的包:
# yum install -y expat expat-devel pcre pcre-devel
# cd /opt
# wget http://mirror.bit.edu.cn/apache/apr/apr-1.4.6.tar.gz
#tar zxf apr-1.4.6.tar.gz
#cd apr-1.4.6
# ./configure;make;make install
#cd ..
# wget http://download.savannah.gnu.org/releases/confuse/confuse-2.7.tar.gz
# tar zxf confuse-2.7.tar.gz
# cd confuse-2.7
# ./configure CFLAGS=-fPIC --disable-nls ;make;make install
# cd ..
(6)Ganglia的安装
好了,终于要安装ganglia了,下面开始:
#wget http://nchc.dl.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.4.0/ganglia-3.4.0.tar.gz
# tar zxf ganglia-3.4.0.tar.gz
# cd ganglia-3.4.0
# ./configure --prefix=/opt/modules/ganglia --with-static-modules --enable-gexec --enable-status --with-gmetad --with-python=/usr --with-librrd=/usr/local/rrdtool --with-libexpat=/usr --with-libconfuse=/usr/local --with-libpcre=/usr/local
# make && make install
# cd gmetad
# cp gmetad.conf /opt/modules/ganglia/etc/
# cp gmetad.init /etc/init.d/gmetad
打开gmetad的配置文件,修改如下内容:
# vi /etc/init.d/gmetad
将GMETAD=/usr/bin/gmetad
改为GMETAD=/opt/modules/ganglia/sbin/gmetad
# chkconfig --add gmetad
# route add -host 239.2.11.71 dev eth0
# mkdir –p /var/lib/ganglia/rrds
# chown nobody:nobody /var/lib/ganglia/
#vi /opt/modules/ganglia/etc/gmetad.conf
data_source "ling" 10.100.10.10
在最后添加如下内容:
setuid_username "root"
rrd_rootdir "/usr/local/rrdtool"
说明:这里的”ling”表示的是集群的名称,后面的内容是这个集群中所包含的主机信息,也就是要监控的主机ip。
# service gmetad start
# netstat –tnlp |grep gmetad
tcp 0 0 0.0.0.0:8651 0.0.0.0:* LISTEN 29583/gmetad
tcp 0 0 0.0.0.0:8652 0.0.0.0:* LISTEN 29583/gmetad
