Ganglia 3.4安装配置简述

首先强调一下,Ganglia采用组播模式(多播模式)进行数据请求。gmetad发送一个请求到一个组播地址(239.2.11.71),由于是组播地址,所以gmetad只需发送一次请求包即可完成对所有gmond的轮询。gmond收到请求后将采集到的数据返回给gmetad。

SERVER端安装:

apache:

  1. wget http://labs.mop.com/apache-mirror//apr/apr-1.4.6.tar.gz
  2. wget http://labs.mop.com/apache-mirror//apr/apr-util-1.5.1.tar.gz
  3. wget http://www.fayea.com/apache-mirror/httpd/httpd-2.2.23.tar.gz
  4.  
  5. tar -xf apr-1.4.6.tar.gz && cd apr-1.4.6
  6. ./configure --prefix=/usr/local/apr && make && make install
  7.  
  8. tar -xf apr-util-1.5.1.tar.gz && cd apr-util-1.5.1
  9. ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
  10. make && make install
  11.  
  12. tar -xf httpd-2.2.23.tar.gz && cd httpd-2.2.23
  13. ./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most --with-included-apr --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
  14. make && make install
  15. echo '/usr/local/apache2/bin/apachectl start' >>/etc/rc.d/rc.local
  16.  
  17. 启动
  18. /usr/local/apache2/bin/apachectl start

php:

ganglia-web需要PHP JSON模块,该模块包含在PHP 5.2及其以上版本。PHP 5.1需要自行安装JSON模块,非常的麻烦。 

  1. wget http://www.php.net/get/php-5.3.18.tar.gz/from/cn2.php.net/mirror
  2. tar -xf php-5.3.18.tar.gz && cd php-5.3.18
  3. ./configure --prefix=/usr/local/php-5.3 --with-apxs2=/usr/local/apache2/bin/apxs
  4. make && make install

vim /usr/local/apache2/conf/httpd.conf,添加如下内容:

  1. <FilesMatch \.php$>
  2. SetHandler application/x-httpd-php
  3. </FilesMatch>
  4.  
  5. <FilesMatch "\.ph(p[2-6]?|tml)$">
  6. SetHandler application/x-httpd-php
  7. </FilesMatch>
  8.  
  9. <FilesMatch "\.phps$">
  10. SetHandler application/x-httpd-php-source
  11. </FilesMatch>

01.找到<IfModule dir_module>配置段,添加index.php

重启apache,写一个index.php文件,进行测试访问:

http://SERVER/index.php

安装ganglia依赖:

libconfuse:

官方网站下载失败,下载了版本稍旧一点rpm包:ttp://pkgs.repoforge.org/libconfuse/

  1. wget http://pkgs.repoforge.org/libconfuse/libconfuse-2.6-2.el5.rf.x86_64.rpm
  2. wget http://pkgs.repoforge.org/libconfuse/libconfuse-devel-2.6-2.el5.rf.x86_64.rpm
  3. rpm -ivh libconfuse-*
pcre:
  1. wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz
  2. tar -xf pcre-8.31.tar.gz && cd pcre-8.31
  3. ./configure && make && make install
  4.  
  5. echo '/usr/local/lib' >/etc/ld.so.conf.d/libpcre.conf
  6. ldconfig -v
其它依赖:
  1. yum -y install apr-devel apr-util check-devel cairo-devel pango-devel libxml2-devel rpmbuild glib2-devel dbus-devel freetype-devel fontconfig-devel gcc-c++ expat-devel python-devel libXrender-devel
rrdtool:
  1. wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
  2. tar -xf rrdtool-1.4.7.tar.gz && cd rrdtool-1.4.7
  3. ./configure --prefix=/usr/local
  4. make && make install
  5.  
  6. echo '/usr/local/lib' >/etc/ld.so.conf.d/librrd.conf
  7. ldconfig -v
ganglia:
  1. wget http://sourceforge.net/projects/ganglia/files/ganglia%20monitoring%20core/3.4.0/ganglia-3.4.0.tar.gz/download
  2. tar -xf ganglia-3.4.0.tar.gz && cd ganglia-3.4.0
  3. ./configure --prefix=/usr/local/ganglia --with-gmetad --with-librrd=/usr/local/lib --sysconfdir=/etc/ganglia
  4. make && make install
  5.  
  6. cp gmond/gmond.init /etc/rc.d/init.d/gmond
  7. cp gmetad/gmetad.init /etc/rc.d/init.d/gmetad
  8. chkconfig --add gmond && chkconfig gmond on
  9. chkconfig --add gmetad && chkconfig gmetad on
  10.  
  11. 修改/etc/rc.d/init.d/gmetad和/etc/rc.d/init.d/gmond,分别指定如下参数:
  12. GMETAD=/usr/local/ganglia/sbin/gmetad
  13. GMOND=/usr/local/ganglia/sbin/gmond
  1. mkdir -p /var/lib/ganglia/rrds
  2. chown nobody:nobody /var/lib/ganglia/rrds
  3.  
  4. gmond -t |tee /etc/ganglia/gmond.conf
  5. vim /etc/ganglia/gmetad.conf,修改内容:
  6. data_source "PPS Hadoop Cluster" $SERVER:8649 //把$SERVER替换成自己的被监控服务器IP
  7. gridname "Hadoop"
  8.  
  9. vim /etc/ganglia/gmond.conf,修改cluster配置段内容:
  10. name = "Hadoop Cluster"

相关推荐