﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-xylz-随笔分类-Ganglia</title><link>http://www.blogjava.net/xylz/category/49134.html</link><description>关注后端架构、中间件、分布式和高性能RESTful服务</description><language>zh-cn</language><lastBuildDate>Fri, 25 Nov 2011 08:48:30 GMT</lastBuildDate><pubDate>Fri, 25 Nov 2011 08:48:30 GMT</pubDate><ttl>60</ttl><item><title>Ganglia安装指南 (基于CentOS 5.6)</title><link>http://www.blogjava.net/xylz/archive/2011/07/21/354744.html</link><dc:creator>xylz</dc:creator><author>xylz</author><pubDate>Wed, 20 Jul 2011 16:34:00 GMT</pubDate><guid>http://www.blogjava.net/xylz/archive/2011/07/21/354744.html</guid><wfw:comment>http://www.blogjava.net/xylz/comments/354744.html</wfw:comment><comments>http://www.blogjava.net/xylz/archive/2011/07/21/354744.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/xylz/comments/commentRss/354744.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xylz/services/trackbacks/354744.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 19px; background-color: #ffffff; ">
<h3 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.22em; ">Ganglia安装指南 (基于CentOS 5.6)</h3>
<h2 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.44em; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #0097ff; padding-bottom: 2px; ">安装依赖</h2>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">rpm -ivh http://mirrors.sohu.com/centos/5/os/x86_64/CentOS/zlib-devel-1.2.3-3.x86_64.rpm
rpm -ivh http://mirrors.sohu.com/centos/5/os/x86_64/CentOS/freetype-devel-2.2.1-28.el5_5.1.x86_64.rpm
rpm -ivh http://mirrors.sohu.com/centos/5/os/x86_64/CentOS/libart_lgpl-devel-2.3.17-4.x86_64.rpm
rpm -ivh http://mirrors.sohu.com/centos/5/os/x86_64/CentOS/libpng-devel-1.2.10-7.1.el5_5.3.x86_64.rpm
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">如果上述安装失败，可能需要安装以下库依赖</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">yum install zlib freetype libart_lgpl libpng
</pre>
<h2 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.44em; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #0097ff; padding-bottom: 2px; ">安装rrdtools</h2>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.27.tar.gz
tar zxvf rrdtool-1.2.27.tar
cd rrdtool-1.2.27
./configure --prefix=/usr/local/rrdtool
make
make install
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">执行下命令，看是否安装成功</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">/usr/local/rrdtool/bin/rrdtool
</pre>
<h2 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.44em; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #0097ff; padding-bottom: 2px; ">安装expat依赖</h2>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">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
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">对于64位操作系统，需要手动的拷贝下动态链接库到lib64下</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">mkdir /usr/local/expat/lib64
cp -a /usr/local/expat/lib/* /usr/local/expat/lib64/
</pre>
<h2 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.44em; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #0097ff; padding-bottom: 2px; ">安装apr以及apr-util</h2>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">http://labs.renren.com/apache-mirror/apr/apr-1.4.5.tar.gz
tar xvjf apr-1.3.2.tar.bz2
./configure --prefix=/usr/local/apr
make
make install
</pre>
<div class="vspace" style="margin-top: 1.33em; "></div>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">http://labs.renren.com/apache-mirror/apr/apr-util-1.3.12.tar.gz
tar xvjf apr-util-1.3.2.tar.bz2
./configure --with-apr=/usr/local/apr --with-expat=/usr/local/expat
make
make install
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">同样64位机器需要拷贝动态链接库</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">/bin/cp -f /usr/local/apr/include/apr-1/* /usr/local/apr/include/
mkdir -p /usr/local/apr/lib64
/bin/cp -a -f /usr/local/apr/lib/* /usr/local/apr/lib64/
</pre>
<h2 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.44em; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #0097ff; padding-bottom: 2px; ">安装confuse</h2>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">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
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">拷贝动态链接库</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">mkdir -p /usr/local/confuse/lib64
/bin/cp -a -f /usr/local/confuse/lib/* /usr/local/confuse/lib64/
</pre>
<div class="vspace" style="margin-top: 1.33em; "></div>
<h2 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.44em; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #0097ff; padding-bottom: 2px; ">安装ganglia</h2>
<p style="margin-top: 0px; margin-bottom: 0px; ">现在才是安装ganglia的开始，如果提示需要pcre的话，安装下&nbsp;<code class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; white-space: nowrap; ">yum install pcre&nbsp;</code>下载ganglia-3.2.0，解压，安装</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">./configure --prefix=/usr/local/ganglia --with-librrd=/usr/local/rrdtool --with-libapr=/usr/local/apr --with-libexpat=/usr/local/expat \
--with-libconfuse=/usr/local/confuse --with-gmetad --enable-gexec --enable-status --sysconfdir=/etc/ganglia
make
make install
</pre>
<h2 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.44em; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #0097ff; padding-bottom: 2px; ">服务端配置</h2>
<p style="margin-top: 0px; margin-bottom: 0px; ">创建rrdtool数据目录，看$ganglia-3.2.0/web/conf.php里面的gmetad_root变量，并根据apache的运行用户创建权限，例如apache运行于apache用户上 。</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">mkdir -p /var/lib/ganglia/rrds
mkdir -p /var/lib/ganglia/dwoo
chown -R apache;apache /var/lib/ganglia
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">配置一个数据源，修改/etc/ganglia/gmetad.conf文件，同时将运行用户设置为rrdtool的目录权限用户，例如apache用户</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">data_source "suc" localhost
setuid_username "apache"
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">其中suc是数据源的名称，客户端分组会依赖此名称，后面会提到。 添加自启动脚本</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">/bin/cp -f gmetad/gmetad.init /etc/init.d/gmetad
/bin/cp -f /usr/local/ganglia/sbin/gmetad /usr/sbin/gmetad
chkconfig -add gmetad
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">启动gmetad服务</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">service gmetad start
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">看见Starting GANGLIA gmetad: [ OK ]就代表运行正常了。</p>
<div class="vspace" style="margin-top: 1.33em; "></div>
<h2 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.44em; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #0097ff; padding-bottom: 2px; ">客户端配置（gmond节点）</h2>
<p style="margin-top: 0px; margin-bottom: 0px; ">本机安装如下：</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">/bin/cp -f gmond/gmond.init /etc/init.d/gmond
/bin/cp -f /usr/local/ganglia/sbin/gmond/usr/sbin/gmond
chkconfig -add gmond
gmond --default_config &gt; /etc/ganglia/gmond.conf
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">对于生成的默认配置文件需要做适当的修改</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">cluster {
name="suc"
owner="apache"
latlong="unspecified"
url="unspecified"
}
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">其中name是将要在服务端进行的分组，是服务端的数据源。接下来开启服务</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">service gmond start
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">看见Starting GANGLIA gmetad: [ OK ]代表启动成功。如果有失败，可以讲gmond.conf中的debug有0改为100，看更多的日志，然后进行排查。</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">globals {
daemonize = yes
setuid = yes
user = nobody
debug_level = 100
}
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">非本机客户端配置需要安装服务端安装一样进行配置，运行，非常麻烦，这里使用本机安装好的文件进行安装。 使用下面的脚本进行安装deploy-ganglia.sh</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">i=$1
scp /usr/sbin/gmond $i:/usr/sbin/gmond
ssh $i mkdir -p /etc/ganglia/
ssh $i mkdir -p /usr/local/ganglia/lib64
ssh $i mkdir -p /usr/local/expat/lib
scp /etc/ganglia/gmond.conf $i:/etc/ganglia/
scp /etc/init.d/gmond $i:/etc/init.d/
scp -r /usr/local/ganglia/lib64/* $i:/usr/local/ganglia/lib64/
scp /usr/local/expat/lib/libexpat.so.1 $i:/usr/local/expat/lib/libexpat.so.1
scp /usr/lib64/libapr-1.so.0 $i:/usr/lib64/
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">实际上就是将本机安装好(编译好)的动态链接库拷贝到其它机器上，使用如下命令拷贝即可</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">sh deploy-ganglia.sh 10.1.11.2
</pre>
<div class="vspace" style="margin-top: 1.33em; "></div>
<h2 style="margin-top: 1em; margin-bottom: 0.6em; font-size: 1.44em; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #0097ff; padding-bottom: 2px; ">服务端的WEB配置</h2>
<p style="margin-top: 0px; margin-bottom: 0px; ">PHP程序需要依赖Apache来运行，因此需要安装如下依赖</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">yum install php-common php-cli php php-gd httpd
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">安装web程序，这里假定apache的root路径在/var/www/html下面。</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">mkdir /var/www/html/ganglia
cp -a -f ganglia-3.2.0/web/* /var/www/html/ganglia
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">禁用SELinux&nbsp;<code class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; white-space: nowrap; ">setenforce 0&nbsp;</code>修改rrdtool的路径，文件/var/www/html/ganglia/conf.php中的RRDTOOL</p>
<pre class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; line-height: 1.2em; margin-top: 2px; margin-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; overflow-x: auto; overflow-y: auto; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-right: 2px; margin-left: 2px; background-position: initial initial; background-repeat: initial initial; ">define("RRDTOOL", "/usr/local/rrdtool/bin/rrdtool");
</pre>
<p style="margin-top: 0px; margin-bottom: 0px; ">重启httpd服务器即可看到效果&nbsp;<code class="escaped" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace; white-space: nowrap; ">service httpd restart<br />
<br />
</code></p>
</span><font face="'Lucida Console', 'Andale Mono', 'Courier New', Courier, monospace"><span style="line-height: 19px; white-space: nowrap;">更多参考 http://www.imxylz.info/wiki/Ganglia/Ganglia<br />
</span></font><img src ="http://www.blogjava.net/xylz/aggbug/354744.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xylz/" target="_blank">xylz</a> 2011-07-21 00:34 <a href="http://www.blogjava.net/xylz/archive/2011/07/21/354744.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>