本人在centos7上安装ganglia,实测,没有成功,可能是哪里没做对,mark一下。后来过了几天莫名其妙的用yum安装又好了。
依赖软件
- http://nchc.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz
- tar xvzf pcre-8.32.tar.gz
- cd pcre-8.32
-./configure –prefix=/usr/local
- make && make install
2.http://savannah.nongnu.org/download/confuse/confuse-2.7.tar.gz
- tar xvzf confuse-2.7.tar.gz
- cd confuse-2.7
- CFLAGS=-fPIC ./configure –prefix=/usr/local –disable-nls
- make CFLAGS=-fPIC
- make CFLAGS=-fPIC install
3.http://nchc.dl.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz
- tar -xvzf expat-2.1.0.tar.gz
- cd expat-2.1.0
- ./configure –prefix=/usr/local
- make && make install
4.http://zlib.net/zlib-1.2.8.tar.gz
- tar xvzf zlib-1.2.8.tar.gz
- cd zlib-1.2.8
- CFLAGS=-fPIC ./configure –prefix=/usr/local
- make CFLAGS=-fPIC
- make CFLAGS=-fPIC install
5.ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz
- tar xvzf libxml2-2.7.8.tar.gz
- cd libxml2-2.7.8
- ./configure –prefix=/usr/local –with-zlib=/usr/local
- make && make install
6.http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.8.tar.gz
- tar xvzf rrdtool-1.4.8.tar.gz
- cd rrdtool-1.4.8
- export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
- ./configure –prefix=/usr/local
- make && make install
7.http://cznic.dl.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.6.0/ganglia-3.6.0.tar.gz
- ./configure –enable-gexec
- make && make install
ganglia配置
gmetad配置
在ganglia安装目录执行如下操作
- cp -a gmetad/gmetad.init /etc/init.d/gmetad
- chkconfig –add gmetad
- chkconfig –level 345 gmetad on
- gmetad -t | tee /usr/local/etc/gmetad.conf
- mkdir -p /var/lib/ganglia/rrds
- chown nobody:nobody /var/lib/ganglia/rrds
配置gmetad.conf
1.修改gmetad.conf 中 data_source
data_source "hadoop201" hadoop201
gmond配置
- cp -a gmond/gmond.init /etc/init.d/gmond
- chkconfig –add gmond
- chkconfig –level 345 gmond on
- gmond -t | tee /usr/local/etc/gmond.conf
配置gmond.conf
修改 cluster中 name 为在gmetad.conf 中的data_source
cluster { </p><p> name = "hadoop201"</p><p> owner = "nobody"</p><p> latlong = "unspecified"</p><p> url = "unspecified"</p><p>}</p><p>
Ganglia-web环境部署
- tar xvzf ganglia-web-3.6.2.tar.gz -C /var/www/html/
- cd /var/www/html/
- mv ganglia-web-3.5.12 ganglia
- chmod -R 777 /var/www/html/ganglia
- cd /var/www/html/ganglia
- cp conf_default.php conf.php
- vim conf.php
conf.php中有些默认配置和以上设置不一样的需要进行修改:
<code class=" hljs vala"><span class="hljs-preprocessor"># Gmetad-webfrontend version. Used to check for updates.</span></p><p><span class="hljs-preprocessor">#</span></p><p>$conf[<span class="hljs-string">'gweb_root'</span>] = <span class="hljs-string">"/var/www/html/<b style="color:black;background-color:#99ff99">ganglia</b>"</span>;</p><p>$conf[<span class="hljs-string">'gweb_confdir'</span>] = <span class="hljs-string">"/var/www/html/<b style="color:black;background-color:#99ff99">ganglia</b>"</span>;</p><p>include_once $conf[<span class="hljs-string">'gweb_root'</span>] . <span class="hljs-string">"/version.php"</span>;</p><p><span class="hljs-preprocessor">#</span></p><p><span class="hljs-preprocessor"># 'readonly': No authentication is required. All users may view all resources. No edits are allowed.</span></p><p><span class="hljs-preprocessor"># 'enabled': Guest users may view public clusters. Login is required to make changes. </span></p><p><span class="hljs-preprocessor"># An administrator must configure an authentication scheme and ACL rules.</span></p><p><span class="hljs-preprocessor"># 'disabled': Guest users may perform any actions, including edits. No authentication is required.</span></p><p>$conf[<span class="hljs-string">'auth_system'</span>] = <span class="hljs-string">'readonly'</span>;</p><p><span class="hljs-preprocessor">#</span></p><p><span class="hljs-preprocessor"># The name of the directory in "./templates" which contains the</span></p><p><span class="hljs-preprocessor"># templates that you want to use. Templates are like a skin for the</span></p><p><span class="hljs-preprocessor"># site that can alter its look and feel.</span></p><p><span class="hljs-preprocessor">#</span></p><p>$conf[<span class="hljs-string">'template_name'</span>] = <span class="hljs-string">"default"</span>;</p><p><span class="hljs-preprocessor">#</span></p><p><span class="hljs-preprocessor"># If you installed gmetad in a directory other than the default</span></p><p><span class="hljs-preprocessor"># make sure you change it here.</span></p><p><span class="hljs-preprocessor">#</span></p><p><span class="hljs-preprocessor"># Where gmetad stores the rrd archives.</span></p><p>$conf[<span class="hljs-string">'gmetad_root'</span>] = <span class="hljs-string">"/var/lib/<b style="color:black;background-color:#99ff99">ganglia</b>"</span>;</p><p>$conf[<span class="hljs-string">'rrds'</span>] = <span class="hljs-string">"${conf['gmetad_root']}/rrds"</span>;</p><p><span class="hljs-preprocessor"># Where Dwoo (PHP templating engine) store compiled templates</span></p><p>$conf[<span class="hljs-string">'dwoo_compiled_dir'</span>] = <span class="hljs-string">"${conf['gweb_confdir']}/dwoo/compiled"</span>;</p><p>$conf[<span class="hljs-string">'dwoo_cache_dir'</span>] = <span class="hljs-string">"${conf['gweb_confdir']}/dwoo/cache"</span>;</p><p><span class="hljs-preprocessor"># Where to store web-based configuration</span></p><p>$conf[<span class="hljs-string">'views_dir'</span>] = $conf[<span class="hljs-string">'gweb_confdir'</span>] . <span class="hljs-string">'/conf'</span>;</p><p>$conf[<span class="hljs-string">'conf_dir'</span>] = $conf[<span class="hljs-string">'gweb_confdir'</span>] . <span class="hljs-string">'/conf'</span>;</p><p></code>
问题及解决方式
- 编译rrdtool 错误
/.libs/librrd.so: undefined reference to
xmlTextReaderValue@LIBXML2_2.4.30'
./.libs/librrd.so: undefined reference toxmlTextReaderNodeType@LIBXML2_2.4.30’
./.libs/librrd.so: undefined reference to
xmlStrdup@LIBXML2_2.4.30'
./.libs/librrd.so: undefined reference toxmlTextReaderName@LIBXML2_2.4.30’
./.libs/librrd.so: undefined reference to
xmlNewTextReaderFilename@LIBXML2_2.4.30'
./.libs/librrd.so: undefined reference toxmlStrcasestr@LIBXML2_2.4.30’
./.libs/librrd.so: undefined reference to
xmlFree@LIBXML2_2.4.30'
./.libs/librrd.so: undefined reference toxmlTextReaderRead@LIBXML2_2.4.30’
./.libs/librrd.so: undefined reference to
xmlFreeTextReader@LIBXML2_2.4.30'
./.libs/librrd.so: undefined reference toxmlTextReaderGetParserLineNumber@LIBXML2_2.6.17’
./.libs/librrd.so: undefined reference to `xmlStrcasecmp@LIBXML2_2.4.30’
ganglia编译必须依赖rrdtool,而rrdtool安装不同机器可能出现莫名的安装错误,此时如果机器可以连接网络可以使用 yum -y install rrdtool
方式安装,但此时安装后,编译ganglia时仍然无法找到rrdtool相应的库,此时可以采用如下方法,使ganglia编译安装成功:
下载rrdtool-1.4.8.tar.gz ,解压后,将rrdtool-1.4.8/src/.libs 中相应库拷贝到如下目录:
home/hadoop/
为我本机rrdtool-1.4.8所在路径:
cp /home/hadoop/rrdtool-1.4.8/src/.libs/.so /usr/local/lib/
cp /home/hadoop/rrdtool-1.4.8/src/.libs/*.a /usr/local/lib/
cp /home/hadoop/rrdtool-1.4.8/src/.libs/*.la /usr/local/lib/
cp /home/hadoop/rrdtool-1.4.8/src/rrd*.h /usr/local/include