首页 > 代码库 > centos 安装ganglia监控工具
centos 安装ganglia监控工具
一、ganglia基本介绍
ganglia是分布式的监控系统,有两个Daemon,分别是:客户端GangliaMonitoring Daemon (gmond)和服务端GangliaMeta Daemon (gmetad),还有GangliaPHP Web
Frontend(基于web的动态访问方式)组成是一个Linux下图形化监控系统运行性能的软件,界面美观、丰富,功能强大而ganglia又依赖于一个web服务器用来显示集群状态,用rrdtool来存储数据和生成曲线图,需要xml解析因此需要expat,配置文件解析需要libconfuse。
Ganglia是一个监控服务器,集群的开源软件,能够用曲线图表现最近一个小时,最近一天,最近一周,最近一月,最近一年的服务器或者集群的cpu负载,内存,网络,硬盘等指标。
Ganglia的强大在于:ganglia服务端能够通过一台客户端收集到同一个网段的所有客户端的数据,ganglia集群服务端能够通过一台服务端收集到它下属的所有客户端数据。这个体系设计表示一台服务器能够通过不同的分层能够管理上万台机器。这个功能是其他mrtg,nagios,cacti所不能比拟。
二、下载及安装
ganglia-3.6.0.tar.gz下载地址http://down.51cto.com/data/1112626
[root@ws ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m
[root@ws ~]# uname -a
Linux ws.zdqy.com 2.6.32-431.5.1.el6.i686 #1 SMP Tue Feb 11 21:56:33 UTC 2014 i686 i686 i386 GNU/Linux
[root@ws tmp]# tar xf ganglia-3.6.0.tar.gz
[root@ws ~]# yum -y install apr-devel apr-util check-devel cairo-develpango-devel libxml2-devel rpm-build glib2-devel dbus-develfreetype-devel fontconfig-devel gcc gcc-c++ expat-devel python-devellibXrender-devel
[root@ws ganglia-3.6.0]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.ULcPJf: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[root@ws ganglia-3.6.0]# yum clean all
[root@ws ganglia-3.6.0]# yum install libconfuse* -y
Installing:
libconfuse i686 2.7-4.el6 epel 79 k
libconfuse-devel i686 2.7-4.el6 epel 17 k
[root@ws ~]# yum install libart_lgpl-devel pcre-devel libtool -y
[root@ws softs]# rpmbuild -tb ganglia-3.6.0.tar.gz
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/ganglia-3.6.0-1.i386
Wrote: /root/rpmbuild/RPMS/i386/ganglia-gmetad-3.6.0-1.i386.rpm
Wrote: /root/rpmbuild/RPMS/i386/ganglia-gmond-3.6.0-1.i386.rpm
Wrote: /root/rpmbuild/RPMS/i386/ganglia-gmond-modules-python-3.6.0-1.i386.rpm
Wrote: /root/rpmbuild/RPMS/i386/ganglia-devel-3.6.0-1.i386.rpm
Wrote: /root/rpmbuild/RPMS/i386/libganglia-3.6.0-1.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.zQCFRZ
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd ganglia-3.6.0
+ /bin/rm -rf /root/rpmbuild/BUILDROOT/ganglia-3.6.0-1.i386
+ exit 0
[root@ws softs]# cd /root/rpmbuild/RPMS/
[root@ws RPMS]# ls
i386
[root@ws RPMS]# cd i386/
[root@ws i386]# ls
ganglia-devel-3.6.0-1.i386.rpm
ganglia-gmetad-3.6.0-1.i386.rpm
ganglia-gmond-3.6.0-1.i386.rpm
ganglia-gmond-modules-python-3.6.0-1.i386.rpm
libganglia-3.6.0-1.i386.rpm
[root@ws i386]# rpm -ivh *
Preparing... ########################################### [100%]
1:libganglia ########################################### [ 20%]
2:ganglia-gmond ########################################### [ 40%]
3:ganglia-devel ########################################### [ 60%]
4:ganglia-gmond-modules-p ########################################### [ 80%]
5:ganglia-gmetad ########################################### [100%]
[root@ws ganglia]# yum install httpd -y
[root@ws conf]# /etc/init.d/gmond start
Starting GANGLIA gmond: [ OK ]
[root@ws conf]# /etc/init.d/gmetad start
Starting GANGLIA gmetad: [ OK ]
[root@ws softs]# wget http://ftp.jaist.ac.jp/pub/sourceforge/g/ga/ganglia/ganglia-web/3.5.12/ganglia-web-3.5.12.tar.gz
[root@ws softs]# tar xf ganglia-web-3.5.12.tar.gz -C /var/www/html/
[root@ws html]# mv ganglia-web-3.5.12.tar.gz /softs/
[root@ws html]# mv ganglia-web-3.5.12 ganglia
三、调试
访问页面http://192.168.0.104/ganglia/index.php
发现报错
是因为相应的目录没有建,而且权限不对
建立相应的目录,将目录权限改为777
mkdir -p /var/www/html/ganglia/dwoo/compiled
mkdir -p /var/www/html/ganglia/dwoo/cache
chmod 777 /var/www/html/ganglia/dwoo/compiled
chmod 777 /var/www/html/ganglia/dwoo/cache
[root@ws ganglia-web]# find . -type d
.
./cache
./conf
./dwoo
./dwoo/cache
./dwoo/compiled
./dwoo/compiled/templates
./dwoo/compiled/templates/default
[root@ws ganglia-web]# pwd
/var/lib/ganglia-web
然后重启httpd,重新访问
这是ganglia本机的一些监控信息
下面还需要对被监控主机进行配置。
[root@localhost yum.repos.d]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@localhost yum.repos.d]# yum install ganglia-gmond
[root@ws softs]# rpmbuild -tb ganglia-3.6.0.tar.gz
error: Failed build dependencies:
libpng-devel is needed by ganglia-3.6.0-1.i386
python-devel is needed by ganglia-3.6.0-1.i386
解决方法
[root@ws ~]# yum install libpng-devel python-devel -y
Fatal error:
Errors were detected in your configuration.
- Unable to create overlay events file: /var/lib/ganglia-web/conf/events.json
- Unable to create event color map file: /var/lib/ganglia-web/conf/event_color.json
- DWOO compiled templates directory ‘/var/lib/ganglia-web/dwoo/compiled‘ is not writeable.
Please adjust$conf[‘dwoo_compiled_dir‘]
. - DWOO cache directory ‘/var/lib/ganglia-web/dwoo/cache‘ is not writeable.
Please adjust$conf[‘dwoo_cache_dir‘]
.