ganglia 是分布式的监控系统,有两个Daemon, 分别是:客户端Ganglia Monitoring Daemon(gmond)和服务端Ganglia Meta Daemon (gmetad),还有Ganglia PHP Web Frontend(基于web的动态访问方式)组成是一个Linux下图形化监控系统运行性能的软件,界面美观、丰富,功能强大
http://ganglia.sourceforge.net/ 软件下载
实验环境:
物理主机 redhat7.0 内核版本 3.10.0-123.el7.x86_64
虚拟机 redhat6.5 内核版本 2.6.32-431.el6.x86_64
服务器端: server1.example.com 172.25.254.1
客户端: server2.example.com 172.25.254.2
所需软件包:
ganglia-3.4.0.tar.gz
rrdtool-devel-1.3.8-6.el6.x86_64.rpm
ganglia-web-3.4.2.tar.gz
libconfuse-2.6-3.el6.x86_64.rpm
libconfuse-devel-2.6-3.el6.x86_64.rpm
alert-agent-4.1.3.1-linux-x64.tar.gz
1。服务器端配置
1.1使用源码包编译rpm包安装
[root@server1 ~]# yum install rpm-build -y
[root@server1 ~]# rpmbuild -tb ganglia-3.4.0.tar.gz ##会显示需要以下 依赖包,安装即可
error: Failed build dependencies:
libpng-devel is needed by ganglia-3.4.0-1.x86_64
libart_lgpl-devel is needed by ganglia-3.4.0-1.x86_64
gcc-c++ is needed by ganglia-3.4.0-1.x86_64
python-devel is needed by ganglia-3.4.0-1.x86_64
libconfuse-devel is needed by ganglia-3.4.0-1.x86_64
pcre-devel is needed by ganglia-3.4.0-1.x86_64
autoconf is needed by ganglia-3.4.0-1.x86_64
automake is needed by ganglia-3.4.0-1.x86_64
libtool is needed by ganglia-3.4.0-1.x86_64
expat-devel is needed by ganglia-3.4.0-1.x86_64
rrdtool-devel is needed by ganglia-3.4.0-1.x86_64
freetype-devel is needed by ganglia-3.4.0-1.x86_64
apr-devel > 1 is needed by ganglia-3.4.0-1.x86_64
[root@server1 ~]# yum install libart_lgpl-devel gcc-c++ python-devel libconfuse-devel pcre-devel expat-devel rrdtool-devel apr-devel -y
[root@server1 ~]# yum install libconfuse-* rrdtool-devel-1.3.8-6.el6.x86_64.rpm -y
[root@server1 ~]# rpmbuild -tb ganglia-3.4.0.tar.gzerror: Failed build dependencies:
libpng-devel is needed by ganglia-3.4.0-1.x86_64
autoconf is needed by ganglia-3.4.0-1.x86_64
automake is needed by ganglia-3.4.0-1.x86_64
libtool is needed by ganglia-3.4.0-1.x86_64
freetype-devel is needed by ganglia-3.4.0-1.x86_64
[root@server1 ~]# yum install libpng-devel autoconf automake libtool freetype-devel -y
[root@server1 ~]# rpmbuild -tb ganglia-3.4.0.tar.gz ##再次执行就好咯!
[root@server1 ~]# cd /root/rpmbuild/RPMS/x86_64/
[root@server1 x86_64]# ls
ganglia-devel-3.4.0-1.x86_64.rpm
ganglia-gmetad-3.4.0-1.x86_64.rpm ##服务器端的
ganglia-gmond-3.4.0-1.x86_64.rpm ##客户端的
ganglia-gmond-modules-python-3.4.0-1.x86_64.rpm ##支持python的客户端的
libganglia-3.4.0-1.x86_64.rpm
1.2服务器端安装ganglia软件
[root@server1 x86_64]# yum install ganglia-gmetad-3.4.0-1.x86_64.rpm libganglia-3.4.0-1.x86_64.rpm ganglia-gmond-3.4.0-1.x86_64.rpm -y
1.3将编译好的客户端rpm包复制到客户端
[root@server1 x86_64]# scp -r libganglia-3.4.0-1.x86_64.rpm ganglia-gmond-3.4.0-1.x86_64.rpm ganglia-gmond-modules-python-3.4.0-1.x86_64.rpm 172.25.254.2:/root
[root@server1 x86_64]# ls /root/libconfuse-*
/root/libconfuse-2.6-3.el6.x86_64.rpm
/root/libconfuse-devel-2.6-3.el6.x86_64.rpm
[root@server1 x86_64]# scp -r /root/libconfuse-* 172.25.254.2:/root
1.4修改配置文件
[root@server1 x86_64]# cd /etc/ganglia/
[root@server1 ganglia]# vim gmetad.conf
#修改44行为:
44 data_source "willis cluster" localhost 172.25.254.2
[root@server1 ganglia]# vim gmond.conf
##修改24行为:
24 name = "willis cluster"
1.5 网页端监控配置
[root@server1 ganglia]# cd /root/
[root@server1 ~]# rpm -tb ganglia-web-3.4.2.tar.gz
[root@server1 ~]# yum install php php-gd -y ##提示什么就装什么
[root@server1 ~]# rpm -tb ganglia-web-3.4.2.tar.gz
[root@server1 ~]# cd /var/www/html/
[root@server1 html]# ls
gweb #有生成一个gweb目录就是网页监控端目录
1.6 启动服务器端
[root@server1 ganglia]# /etc/init.d/gmond start
Starting GANGLIA gmond: [ OK ]
[root@server1 ganglia]# /etc/init.d/gmetad start
Starting GANGLIA gmetad: [ OK ]
2.被监控客户端配置
[root@server2 ~]# rpm -ivh ganglia-gmond-3.4.0-1.x86_64.rpm lib*
[root@server2 ~]# rpm -ivh ganglia-gmond-modules-python-3.4.0-1.x86_64.rpm
[root@server2 ~]# cd /etc/ganglia/
[root@server2 ganglia]# vim gmond.conf
24 name = "willis cluster"
[root@server2 ganglia]# /etc/init.d/gmond start
Starting GANGLIA gmond: [ OK ]
3.浏览器访问测试
访问 172.25.254.1 /gweb,如果没有显示节点,且在服务器端server1上的/var/lib/ganglia/rrds路径下没有文件
则在服务器和客户端都做如下动作:
<1>ip route add 239.2.11.71 dev eth0
<2>route -n
********************************************************************
[root@server1 objects]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
239.2.11.71 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
172.25.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
********************************************************************
<3>/etc/init.d/gmond restart
/etc/init.d/gmetad restart
<4>cd /var/lib/ganglia/rrds
ls有__SummaryInfo__ 和 willis cluster两个目录 ##willis cluster里有所有局域网内可监控到的IP,包括自己
<5>浏览器再刷新访问 172.25.254.1/gweb就好了!
查看服务器server1节点
查看客户端server2节点
本文转自willis_sun 51CTO博客,原文链接:http://blog.51cto.com/willis/1866336,如需转载请自行联系原作者