前言
安装ganglia过程还是很麻烦的,之前我写过一篇文章通过yum安装ganglia3.0,但是yum库中没有找到ganglia3.1和3.2的rpm包,为了尝鲜我首先安装了ganglia3.2版本,服务配置都正常就是找不到client机器,万分无奈切换到3.1.7版本,最后很顺利使用单播方式安装成功(我的服务器是双网卡,使用多播配置总是找不到client机器,配置了route还是不行,最后放弃)
安装依赖库
#添加rpmforge库到yum
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
# 安装依赖, 32位的安装自己通过"yum list name"找到下面几个库就可以
yum install rrdtool.x86_64 rrdtool-devel.x86_64 expat.x86_64 expat-devel.x86_64 apr.x86_64 apr-devel.x86_64 apr-util.x86_64 apr-util-devel.x86_64 *confuse*
yum install rrdtool.x86_64 rrdtool-devel.x86_64 expat.x86_64 expat-devel.x86_64 apr.x86_64 apr-devel.x86_64 apr-util.x86_64 apr-util-devel.x86_64 *confuse*
安装ganglia
#下载ganglia 3.1.7
wget http://cdnetworks-kr-1.dl.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.1.7/ganglia-3.1.7.tar.gz
wget http://cdnetworks-kr-1.dl.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.1.7/ganglia-3.1.7.tar.gz
#安装
tar -zxf ganglia-3.1.7.tar.gz && cd ganglia-3.1.7
./configure --with-gmetad --sysconfdir=/etc/ganglia --enable-gexec --with-python=/usr/local/bin/python2.7
make && make install
*****************
tar -zxf ganglia-3.1.7.tar.gz && cd ganglia-3.1.7
./configure --with-gmetad --sysconfdir=/etc/ganglia --enable-gexec --with-python=/usr/local/bin/python2.7
make && make install
*****************
这里我在make的时候,发生错误“/usr/local/lib/libpython2.7.a: could not read symbols: Bad value”
解决办法:需要重装python 带上 --enable-shared 参数,如下:
./configure --enable-shared && make && make install
ganglia配置
# 准备目录
mkdir -p /var/lib/ganglia/rrds
mkdir -p /var/lib/ganglia/dwoo
mkdir -p /var/www/html/ganglia
# 确保当前目录为“ganglia-3.1.7”
# ganglia3.2在64位下要拷贝下面两个启动文件(3.1.7版本不需要),否则 service 命令找不到程序
# cp /usr/local/sbin/gmetad /usr/sbin
# cp /usr/local/sbin/gmond /usr/sbin
cp gmond/gmond.init /etc/rc.d/init.d/gmond #添加gmond到service
cp gmetad/gmetad.init /etc/rc.d/init.d/gmetad #添加gmetad到service
chkconfig --add gmond # gmond开机启动
chkconfig --add gmetad # gmetad 开机启动
cp -r web/* /var/www/html/ganglia # copy ganglia web文件倒apache
chown -R apache:apache /var/lib/ganglia/dwoo/
chown -R nobody:nobody /var/lib/ganglia/rrds/
gmond -t |tee /etc/ganglia/gmond.conf #生成gmond默认配置文件,tee的作用类似重定向符“>>”
*****************
# 几个重要的文件路径(3.2和3.1.7存放路径不一样,大家自己which和find查找吧)
/usr/local/bin/gstat #测试工具,我在多播模式下,不能使用,单播可以,奇怪....
/usr/local/sbin/gmetad #中央服务程序,通过"gmetad -d1"打印启动日志(3.17在/usr/sbin/gmetad)
/usr/local/sbin/gmond # 监控数据采集程序,通过"gmond -d1"打印启动日志(3.17在/usr/sbin/gmond)
/etc/ganglia/gmetad.conf
/etc/ganglia/gmond.conf
mkdir -p /var/lib/ganglia/rrds
mkdir -p /var/lib/ganglia/dwoo
mkdir -p /var/www/html/ganglia
# 确保当前目录为“ganglia-3.1.7”
# ganglia3.2在64位下要拷贝下面两个启动文件(3.1.7版本不需要),否则 service 命令找不到程序
# cp /usr/local/sbin/gmetad /usr/sbin
# cp /usr/local/sbin/gmond /usr/sbin
cp gmond/gmond.init /etc/rc.d/init.d/gmond #添加gmond到service
cp gmetad/gmetad.init /etc/rc.d/init.d/gmetad #添加gmetad到service
chkconfig --add gmond # gmond开机启动
chkconfig --add gmetad # gmetad 开机启动
cp -r web/* /var/www/html/ganglia # copy ganglia web文件倒apache
chown -R apache:apache /var/lib/ganglia/dwoo/
chown -R nobody:nobody /var/lib/ganglia/rrds/
gmond -t |tee /etc/ganglia/gmond.conf #生成gmond默认配置文件,tee的作用类似重定向符“>>”
*****************
# 几个重要的文件路径(3.2和3.1.7存放路径不一样,大家自己which和find查找吧)
/usr/local/bin/gstat #测试工具,我在多播模式下,不能使用,单播可以,奇怪....
/usr/local/sbin/gmetad #中央服务程序,通过"gmetad -d1"打印启动日志(3.17在/usr/sbin/gmetad)
/usr/local/sbin/gmond # 监控数据采集程序,通过"gmond -d1"打印启动日志(3.17在/usr/sbin/gmond)
/etc/ganglia/gmetad.conf
/etc/ganglia/gmond.conf
#配置gmeta
vi /etc/ganglia/gmetad.conf
data_source "hadoop" 192.168.1.10 # 集群名称,这里我配置为“hadoop”, 192.168.1.10 为集群中央机器
vi /etc/ganglia/gmetad.conf
data_source "hadoop" 192.168.1.10 # 集群名称,这里我配置为“hadoop”, 192.168.1.10 为集群中央机器
#配置gmond(单播)
vi /etc/ganglia/gmond.conf
cluster {
name = "hadoop" #与gmetad.conf 相同的名称
....
}
udp_send_channel {
#mcast_join = 239.2.11.71 #这行被注释
host = 192.168.1.10 #中央机器的IP # 添加改行
port = 8649
ttl = 1
}
udp_recv_channel {
# mcast_join = 239.2.11.71 #这行被注释
port = 8649
# bind = 239.2.11.71 #这行被注释
}
vi /etc/ganglia/gmond.conf
cluster {
name = "hadoop" #与gmetad.conf 相同的名称
....
}
udp_send_channel {
#mcast_join = 239.2.11.71 #这行被注释
host = 192.168.1.10 #中央机器的IP # 添加改行
port = 8649
ttl = 1
}
udp_recv_channel {
# mcast_join = 239.2.11.71 #这行被注释
port = 8649
# bind = 239.2.11.71 #这行被注释
}
启动和测试
service gmetad start
service gmond start
service httpd start
telnet localhost 8649 # 检查gmond进程,如果出现XML就对了
telnet localhost 8651 # 检查gmetad进程,如果出现XML就对了
打开浏览器,访问http://{you_ip}/ganglia/就可以看到Web界面了
*****************
gmetad启动后执行“service gmetad status”,报错“gmetad dead but subsys locked ”
解决:chown -R nobody:nobody /var/lib/ganglia
httpd启动时报错“Could not reliably determine the server's fully qualified domain name”
解决:vi /etc/httpd/conf/httpd.conf,设置
service gmond start
service httpd start
telnet localhost 8649 # 检查gmond进程,如果出现XML就对了
telnet localhost 8651 # 检查gmetad进程,如果出现XML就对了
打开浏览器,访问http://{you_ip}/ganglia/就可以看到Web界面了
*****************
gmetad启动后执行“service gmetad status”,报错“gmetad dead but subsys locked ”
解决:chown -R nobody:nobody /var/lib/ganglia
httpd启动时报错“Could not reliably determine the server's fully qualified domain name”
解决:vi /etc/httpd/conf/httpd.conf,设置
ServerName localhost:80
如果出图有问题,如出现"localhost"而没有显示机器名,则可能因为/etc/hosts没有正确配置IP与机器名映射关系。
添加Web访问密码
htpasswd -c /etc/httpd/conf.d/passwords ganglia #创建用户名密码,我这里用户名为“ganglia”
vi /var/www/html/ganglia/.htaccess #要指定刚才创建的用户名
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/httpd/conf.d/passwords
Require user ganglia
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/httpd/conf.d/passwords
Require user ganglia
vi /etc/httpd/conf/httpd.conf #添加目录
<Directory "/var/www/html/ganglia/">
AllowOverride AuthConfig
Options Indexes MultiViews
Order allow,deny
Allow from all
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/httpd/conf.d/passwords
Require user ganglia
</Directory>
<Directory "/var/www/html/ganglia/">
AllowOverride AuthConfig
Options Indexes MultiViews
Order allow,deny
Allow from all
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/httpd/conf.d/passwords
Require user ganglia
</Directory>
客户端部署
为了方便在服务端想客户端执行命令,我使用了批量工具“pdsh”,具体安装参考我博客文章。安装rpmforce库后,可以通过“yum install pdsh”安装。
配置好Server到client无密码SSH访问
#在Server端执行,这个脚本在不同OS,不同ganglia版本会区别
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/sbin/gmond %h:/usr/sbin/gmond
pdsh -w ssh:192.168.1.[50-100,120-150] mkdir -p /etc/ganglia/
pdsh -w exec:192.168.1.[50-100,120-150] scp /etc/ganglia/gmond.conf %h:/etc/ganglia/
pdsh -w exec:192.168.1.[50-100,120-150] scp /etc/init.d/gmond %h:/etc/init.d/
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/lib64/libganglia-3.1.7.so.0 %h:/usr/lib64/
pdsh -w exec:192.168.1.[50-100,120-150] scp /lib64/libexpat.so.0 %h:/lib64
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/lib64/libconfuse.so.0 %h:/usr/lib64/
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/lib64/libapr-1.so.0 %h:/usr/lib64/
pdsh -w exec:192.168.1.[50-100,120-150] scp -r /usr/lib64/ganglia %h:/usr/lib64/
pdsh -w ssh:192.168.1.[50-100,120-150] service gmond start
pdsh -w ssh:192.168.1.[50-100,120-150] chkconfig --add gmond
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/sbin/gmond %h:/usr/sbin/gmond
pdsh -w ssh:192.168.1.[50-100,120-150] mkdir -p /etc/ganglia/
pdsh -w exec:192.168.1.[50-100,120-150] scp /etc/ganglia/gmond.conf %h:/etc/ganglia/
pdsh -w exec:192.168.1.[50-100,120-150] scp /etc/init.d/gmond %h:/etc/init.d/
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/lib64/libganglia-3.1.7.so.0 %h:/usr/lib64/
pdsh -w exec:192.168.1.[50-100,120-150] scp /lib64/libexpat.so.0 %h:/lib64
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/lib64/libconfuse.so.0 %h:/usr/lib64/
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/lib64/libapr-1.so.0 %h:/usr/lib64/
pdsh -w exec:192.168.1.[50-100,120-150] scp -r /usr/lib64/ganglia %h:/usr/lib64/
pdsh -w ssh:192.168.1.[50-100,120-150] service gmond start
pdsh -w ssh:192.168.1.[50-100,120-150] chkconfig --add gmond
参考:
http://www.blogjava.net/xylz/archive/2011/07/21/354744.html
http://yifangyou.blog.51cto.com/900206/633002
-- end --
相关推荐
ganglia 3.1.7 rpm包合集 在CentOS5.5下已经安装成功,想要吗? 拿出诚意来吧,哈哈
ganglia监控软件的笔记
服务器监控软件ganglia安装包及其安装文档,非常详细,按照文档操作就能完成安装
走进Ganglia之源码安装
在suse11-sp1_x64下安装ganglia所需的rpm包。花了很多精力才找到。 ganglia-3.6.0-1.1.src.rpm ganglia-gmetad-3.5.0-56.1.x86_64.rpm ganglia-gmond-3.1.7-8.1.x86_64.rpm libconfuse0-2.7-86.1.x86_64.rpm ...
ganglia安装配置ganglia安装配置ganglia安装配置ganglia安装配置ganglia安装配置
ganglia相关应用 ganglia-3.1.7
ganglia安装文档--亲自安装成功 ganglia的配置、问题处理、web界面的配置
为什么用ganglia,以及怎样使用ganglia!
这里包括ganglia安装需要的所有安装包,源码安装,包括教程,亲自在centos上测试可以安装,在编译ganglia时需要将/usr/local/apr/include/apr-1下的所有文件拷贝到/usr/local/apr/include/下才可以成功哦!
而又没有epel源的时候, 可以用一台连接外网的linux服务器使用 yum install --downloadonly 来下载ganglia的包, 然后cp到内网的服务器上去安装, 这里就是为你准备好的最新版的ganglia离线安装和依赖包, 请下载吧
在 Centos6.2 64 安装 Ganglia-3.4
主要介绍ganglia的安装与配置和简单的应用
ganglia的安装步骤。
ganglia安装所需依赖和软件总包附安装教程
ganglia安装包,以及部分依赖rpm包
ganglia安装所需rpm包
ganglia 3.7.2 基于centos7可安装rpm包(rpmbuild/RPMS/x86_64目录中) 配合ganglia-web-3.7.2.tar.gz使用 参考:https://blog.csdn.net/lswnew/article/details/79175539
ganglia安装文档
ubuntu系统上安装Ganglia