CentOS安装配置ganglia

1.     下载ganglia源码包并解压

wget
http://sourceforge.net/projects/ganglia/files/ganglia%20monitoring%20core/3.1.1%20%28Wien%29/ganglia-3.1.1.tar.gz/download?use_mirror=jaist
tar -zxvf ganglia-3.1.1.tar.gz

2.     安装ganglia(安装gmetad和gmond)

cd ganglia-3.1.1

在需要web frontend的机器上安装gmetad,configure参数为:

./configure --with-gmetad --enable-gexec

gmetad依赖g++、rrdtool-devel、apr-devel、libconfuse、libexpat包,先安装上述依赖包:

yum install gcc-c++
yum install rrdtool-devel
yum install apr-devel

yum安装libconfuse、libexpat失败后解决方案:

安装libconfuse:

wget http://download.savannah.gnu.org/releases/confuse/confuse-2.7.tar.gz
tar zxvf confuse-2.6.tar.gz
./configure CFLAGS=-fPIC --disable-nls--prefix=/usr/local/confuse
make
make install

64bit机器需要拷贝动态链接库:

mkdir -p /usr/local/confuse/lib64
cp -a -f /usr/local/confuse/lib/* /usr/local/confuse/lib64/

安装libexpat:

wget http://downloads.sourceforge.net/project/expat/expat/2.0.1/expat-2.0.1.tar.gz?use_mirror=cdnetworks-kr-2
tar zxvf expat-2.0.1.tar.gz
./configure --prefix=/usr/local/expat
make
make install

64bit机器需要拷贝动态链接库:

mkdir /usr/local/expat/lib64
cp -a /usr/local/expat/lib/* /usr/local/expat/lib64/

安装完依赖包后,执行./configure命令:

./configure --with-gmetad --enable-gexec--with-libconfuse=/usr/local/confuse --with-libexpat=/usr/local/expat

出现如图所示的界面时则ganglia安装成功:

CentOS安装配置ganglia

按照提示make ganglia:

make
make install

在make的过程中可能会出现类似“mod_python.c:48:20: error: Python.h: No such file or directory”的错误,此时需要安装python:

yum install python-devel

安装python完成后再进行make即可

3.     服务器端配置gmetad

创建rrdtool数据目录:

mkdir -p /var/lib/ganglia/rrds
mkdir -p /var/lib/ganglia/dwoo
chown -R apache:apache /var/lib/ganglia

修改/etc/ganglia/gmetad.conf文件:

vim /etc/ganglia/gmetad.conf
data_source "suc" localhost
setuid_username "apache"

注意:若配置文件中data_source和setuid_username被“#”注释需要去掉注释

cp gmetad/gmetad.init /etc/init.d/gmetad
mkdir /etc/ganglia
cp gmetad/gmetad.conf /etc/ganglia/
cp -f gmetad /usr/sbin/gmetad
chkconfig --add gmetad

启动gmetad服务:

service gmetad start

若显示“Starting GANGLIA gmetad: [确定]”则表示gmetad运行正常

通过telnet localhost 8651验证gmetad是否正常

4.     本机客户端配置gmond

cp -f gmond/gmond.init /etc/init.d/gmond
cp -f gmond /usr/sbin/gmond
chkconfig --add gmond
gmond --default_config > /etc/ganglia/gmond.conf

修改/etc/ganglia/gmond.conf配置文件:

cluster {
name="suc" //和gmetad.conf配置文件对应
owner="apache" //和gmetad.conf配置文件对应
latlong="unspecified"
url="unspecified"
}

启动gmond服务:

service gmond start

若显示“Starting GANGLIA gmond: [确定]”则表示gmond运行正常

通过telnet localhost 8649验证gmond是否正常

5.     服务器端配置web

yum install php-common php-cli php php-gd httpd
mkdir /var/www/html/ganglia
cp -a -f web/* /var/www/html/ganglia

重启http服务:

service httpd restart

6.     打开浏览器查看ganlia web界面信息

http://localhost:/ganglia

显示如图所示则表示ganglia完全安装成功:

CentOS安装配置ganglia

实验环境:CentOS6.0 x86_64

上一篇:Python爬虫html解析工具beautifulSoup在pycharm中安装及失败的解决办法


下一篇:玩转TypeScript(引言&文章目录) --初看TypeScript.