ganglia安装_落英缤纷
全新安装ganglia 3.6
环境:centos6.4_64bit
# yum install -y ntpdate wget make crontab openssh-clients
# yum install –y gcc gcc-c++ libpng freetype zlib libdbi apr* libxml2-devel pkg-config glib pixman
# yum install pango pango-devel freetye-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel pcre* rrdtool*
# wget http://jaist.dl.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz  -P /usr/local/src/
# cd /usr/local/src
# tar -xf expat-2.1.0.tar.gz
# cd expat-2.1.0
# ./configure –prefix=/usr/local/expat
# make && make install
# cp -r /usr/local/expat/lib /usr/local/expat/lib64
# cd /usr/local/src
# wget http://ftp.twaren.net/Unix/NonGNU//confuse/confuse-2.7.tar.gz -P /usr/local/src/
# tar -xf confuse-2.7.tar.gz
# cd confuse-2.7
# ./configure CFLAGS=-fPIC –disable-nls –prefix=/usr/local/confuse
# make && make install
# cp -r /usr/local/confuse/lib /usr/local/confuse/lib64
# cd ganglia-3.6.0
# ./configure –with-gmetad –enable-gexec –with-libconfuse=/usr/local/confuse –with-libexpat=/usr/local/expat –prefix=/usr/local/ganglia –sysconfdir=/etc/ganglia
# yum install gettext ( 若报错的话,安装gettext )
# make && make install //会安装gmetad
安装gmond
# cd gmond
# mkdir /etc/ganglia
# ./gmond -t > /etc/ganglia/gmond.conf
# cp gmond.init /etc/init.d/gmond
# vi /etc/init.d/gmond   //修改里面的GMOND 改为GMOND=/usr/local/ganglia/sbin/gmond
# chkconfig –add gmond
# vi /etc/ganglia/gmond.conf
类似下面的这样:
  globals {
  daemonize = yes
  setuid = yes
  user = root /*运行Ganglia的用户*/
  debug_level = 0
  max_udp_msg_len = 1472
  mute = no
  deaf = no
  host_dmax = 120 /*secs */
  cleanup_threshold = 300 /*secs */
  gexec = no
  send_metadata_interval = 15 /*发送数据的时间间隔*/
  cluster {
  name = “master236”        /*集群名称*/
  owner = “unspecified”     /*运行Ganglia的用户*/
  latlong = “unspecified”
  url = “unspecified”
  }
  udp_send_channel {
  mcast_join = 239.2.11.71   /*组播*/
  port = 8236
  ttl = 1
  }
  udp_recv_channel {       #接受UDP包配置
  mcast_join = 239.2.11.71
  port = 8236
  bind = 239.2.11.71
  retry_bind = true
  }
  tcp_accept_channel {
  port = 8236
  gzip_output = no
  }
其中name是将要在服务端进行的分组,是服务端的数据源。接下来开启服务
# service gmond start
  Configuration file ‘/usr/local/ganglia/etc/gmond.conf’ not found.
                                                           [  OK  ]
  报错,但是服务已经启动了,可以创建一个软链接
# mkdir /usr/local/ganglia/etc
# ln -s /etc/ganglia/gmond.conf /usr/local/ganglia/etc/gmond.conf
安装ganglia-web  //需要WEB和PHP环境,如果没有安装,可以yum安装下 yum install php-fpm php-common php-devel php-mysqlnd php-mbstring php-mcrypt httpd -y
# cd /usr/local/src
# tar -xzvf ganglia-web-3.5.12.tar.gz
# cd ganglia-web-3.5.12
# vi Makefile  //根据实际情况修改
# Location where gweb should be installed to (excluding conf, dwoo dirs).
GDESTDIR = /usr/share/ganglia      //或者/var/www/ganglia
# Location where default apache configuration should be installed to.
GCONFDIR = /etc/ganglia
# Gweb statedir (where conf dir and Dwoo templates dir are stored)
GWEB_STATEDIR = /var/lib/ganglia
# Gmetad rootdir (parent location of rrd folder)
GMETAD_ROOTDIR = /var/lib/ganglia
APACHE_USER = apache 这里我修改成apache,原来是www-data
##########################################################
# make install
若报错:yum install rsync -y 即可
rsync –exclude “rpmbuild” –exclude “*.gz” –exclude “Makefile” –exclude “*debian*” –exclude “ganglia-web-3.5.12” –exclude “.git*” –exclude “*.in” –exclude “*~” –exclude “#*#” –exclude “ganglia-web.spec” –exclude “apache.conf” -a . ganglia-web-3.5.12
mkdir -p //var/lib/ganglia/dwoo/compiled && \
	mkdir -p //var/lib/ganglia/dwoo/cache && \
	mkdir -p //var/lib/ganglia && \
	rsync -a ganglia-web-3.5.12/conf //var/lib/ganglia && \
	mkdir -p //usr/share/ganglia && \
	rsync –exclude “conf” -a ganglia-web-3.5.12/* //usr/share/ganglia && \
	chown -R apache:apache //var/lib/ganglia
# vi /etc/httpd/conf.d/ganglia.conf
#
# Ganglia monitoring system php web frontend
#
Alias /ganglia /usr/share/ganglia
    Order deny,allow
#   Deny from all
    Allow from all
    Allow from 127.0.0.1
    Allow from ::1
    # Allow from .example.com
# mkdir -p /var/lib/ganglia/rrds
如果gmetad服务启动通知有问题,需要如下操作:
(
# cd /usr/share/
# chown apache:apache ganglia/
# mkdir -p /var/lib/ganglia/dwoo
# chown -R root:root /var/lib/ganglia
)
# chown nobody:nobody /var/lib/ganglia/rrds
# chmod 775 -R /var/lib/ganglia/rrds
# vi /usr/share/ganglia/conf_default.php
$conf[‘gweb_confdir’] = “/var/lib/ganglia-web”;   //修改为$conf[‘gweb_confdir’] = “/var/lib/ganglia”;
启动gmetad:
# cd /usr/local/src/ganglia-3.6.0
# cp -f gmetad/gmetad.init /etc/init.d/gmetad
# cp -f /usr/local/ganglia/sbin/gmetad /usr/sbin/gmetad
# chkconfig –add gmetad
# chkconfig gmetad on
# service gmetad start   // 启动gmetad服务
客户端配置(gmond节点)
本机安装如下:
# cp -f gmond/gmond.init /etc/init.d/gmond
# cp -f /usr/local/ganglia/sbin/gmond /usr/sbin/gmond
# chkconfig –add gmond
# gmond –default_config > /etc/ganglia/gmond.conf
对于生成的默认配置文件需要做适当的修改,参照上面的修改方法。

