十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
rhel6-ganglia安装配置
创新互联是一家集网站建设,甘泉企业网站建设,甘泉品牌网站建设,网站定制,甘泉网站建设报价,网络营销,网络优化,甘泉网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
软件下载地址:http://yunpan.cn/QbFvIIsQhvdws
1.ganglia是分布式的监控系统,有两个Daemon,分别是:客户端GangliaMonitoring Daemon
(gmond)和服务端GangliaMeta Daemon (gmetad),还有GangliaPHP Web Frontend(基于
web的动态访问方式)组成是一个Linux下图形化监控系统运行性能的软件,界面美观、丰富,功能强大
而ganglia又依赖于一个web服务器用来显示集群状态,用rrdtool来存储数据和生成曲线图,需要xml解析因此需要expat,配置文件解析需要libconfuse。安装apche的httpd还需要支持php4以上,同时还有一些依赖软件。
http://ganglia.sourceforge.net/软件下载
2. 安装
依赖包:
[root@desk32~]# 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
在解开ganglia-3.6.0.tar.gz后可以看见有一个ganglia.spec的文件证明是可以直接通过rpmbuild的方式编译出rpm包的;
build需要的依赖包:
yum -yinstall libart_lgpl-devel pcre-devel libtool
[root@desk32~]# rpm -ivh libconfuse-devel-2.6-3.el6.x86_64.rpmlibconfuse-2.6-3.el6.x86_64.rpm
[root@desk32~]# yum localinstall rrdtool-devel-1.3.8-6.el6.x86_64.rpm
[root@desk32~]# rpmbuild -tb ganglia-3.6.0.tar.gz #-tb表示从tar包中build二进制文件
[root@desk32~]# cd /root/rpmbuild/RPMS/x86_64/
[root@desk32x86_64]# ls
ganglia-devel-3.6.0-1.x86_64.rpm
ganglia-gmetad-3.6.0-1.x86_64.rpm
ganglia-gmond-3.6.0-1.x86_64.rpm
ganglia-gmond-modules-python-3.6.0-1.x86_64.rpm
libganglia-3.6.0-1.x86_64.rpm
[root@desk32x86_64]# rpm -ivh *
/etc/ganglia/主配置目录
/var/lib/ganglia/rrdsrrds图信息存储目录
[root@desk32ganglia]# vim gmond.conf
…................................
cluster{
name= "mycluster"
owner= "unspecified"
latlong = "unspecified"
url ="unspecified"
}
…................................
以下的内容并不需要修改:
udp_send_channel {#udp包的发送通道
mcast_join = 239.2.11.71 #多播,工作在239.2.11.71通道下。如果使用单播模式,则要写host= host1(接受数据的目标主机),单播模式下也可以配置多个udp_send_channel
port = 8649#监听端口
ttl = 1
}
udp_recv_channel { #接收udp包配置
mcast_join = 239.2.11.71 #同样工作在239.2.11.71通道下,如果使用单播模式,则要写host= localip,就是必须是本机的ip
port = 8649#监听端口
bind = 239.2.11.71 #绑定
}
tcp_accept_channel {
port = 8649#通过tcp协议监听的端口,远端可以通过链接8649端口得到监控数据,gmetad就是通过该端口得到xml数据
}
[root@desk32ganglia]# /etc/init.d/gmetad start
StartingGANGLIA gmetad: [ OK ]
[root@desk32ganglia]# /etc/init.d/gmond start
StartingGANGLIA gmond: [ OK ]
tcp 0 0 0.0.0.0:8649 0.0.0.0:* LISTEN 23393/gmond
tcp 0 0 0.0.0.0:8651 0.0.0.0:* LISTEN 23376/gmetad
tcp 0 0 0.0.0.0:8652 0.0.0.0:* LISTEN 23376/gmetad
[root@desk32~]# tar zxf ganglia-web-3.5.2.tar.gz -C /var/www/html/
[root@desk32~]# cd /var/www/html/
[root@desk32html]# mv ganglia-web-3.5.2/ ganglia
[root@desk32ganglia]# yum -y install rsync
[root@desk32ganglia]# make install
/etc/init.d/gmetadrestart
/etc/init.d/gmondrestart
web访问:
http://desk32/ganglia
当然ganglia所取到的数据只是desk32.example.com
现在在其他的主机上安装gmond客户端服务,那么在服务端将可监控同网中的所有客户机。
客户端软件包:ganglia-gmond-3.6.0-1.x86_64.rpm
ganglia-gmond-modules-python-3.6.0-1.x86_64.rpm
libganglia-3.6.0-1.x86_64.rpm
libconfuse-2.6-3.el6.x86_64.rpm
libconfuse-devel-2.6-3.el6.x86_64.rpm
[root@desk32x86_64]# scp ganglia-gmond-* desk3:
[root@desk32x86_64]# scp ganglia-gmond-* server60
[root@desk32x86_64]# scp libganglia-3.6.0-1.x86_64.rpm desk3:
[root@desk32x86_64]# scp libganglia-3.6.0-1.x86_64.rpm server60:
[root@desk32~]# scp libconfuse-2.6-3.el6.x86_64.rpm libconfuse-devel-2.6-3.el6.x86_64.rpm desk3:
[root@desk32~]# scp libconfuse-2.6-3.el6.x86_64.rpm libconfuse-devel-2.6-3.el6.x86_64.rpm server60:
以下操作分别在客户机desk3(192.168.122.3)与server60(192.168.122.160)上操作:
[root@desk3~]# rpm -ivh libconfuse-2.6-3.el6.x86_64.rpmlibconfuse-devel-2.6-3.el6.x86_64.rpm
[root@desk3~]# rpm -ivh libganglia-3.6.0-1.x86_64.rpm
[root@desk3~]# rpm -ivh ganglia-gmond-*
3.ganglia与nagios的整合;
关于nagios的配置参见博文rhel6-nagios安装配置:
http://wangziyin.blog.51cto.com/6948950/1305465
[root@desk32contrib]# cp/root/rpmbuild/BUILD/ganglia-3.6.0/contrib/check_ganglia.py/usr/local/nagios/libexec/
[root@desk32contrib]# cd /usr/local/nagios/libexec/
[root@desk32libexec]# chmod a+x check_ganglia.py
[root@desk32libexec]# vim check_ganglia.py
配置nagios:
[root@desk32objects]# vim commands.cfg
###############check_ganglia#############################
definecommand{
command_name check_ganglia
command_line $USER1$/check_ganglia.py -h $HOSTNAME$ -m $ARG1$ -w$ARG
2$ -c$ARG3$
}
[root@desk32objects]# vim templates.cfg
defineservice{
use generic-service
name ganglia-service
hostgroup_name ganglia-servers
service_groups ganglia-metrics
}
[root@desk32objects]# vim service.cfg
defineservicegroup{
servicegroup_name ganglia-metrics
alias ganglia-metrics
membersserver60.example.com,根分区,server60.example.com,系统负载,server60.example.com,内存空闲
}
defineservice{
use ganglia-service
host_name server60.example.com
service_description 根分区
check_command check_ganglia!disk_free_percent_rootfs!20!10
}
defineservice{
use ganglia-service
host_name server60.example.com
service_description 系统负载
check_command check_ganglia!load_one!4!5
}
defineservice{
use ganglia-service
host_name server60.example.com
service_description 内存空闲
check_command check_ganglia!mem_free!50000!30000
}
[root@desk32objects]# vim hosts.cfg
definehost{
use linux-server
host_name server60.example.com
alias ganglia client
address 192.168.122.160
}
definehostgroup{
hostgroup_name ganglia-servers
alias ganglia-servers
members desk32.example.com
}
[root@desk32objects]# /usr/local/nagios/bin/nagios -v/usr/local/nagios/etc/nagios.cfg
[root@desk32objects]# /etc/init.d/nagios restart