Ganglia包括如下程序,他们之间通过XML格式传递监控数据,达到监控效果。 
Gmetad 这个程序负责收集各个cluster的数据,并更新到rrd数据库中。 
Gmond 收集本机的监控数据,发送到其他机器上。收集其他机器的监控数据,供Gmetad读取。默认监听端口8649 
web front-end 一个基于web的监控界面,需要和Gmetad安装在同一个节点上,从Gmetad取数据,并且读取rrd数据库,生成图片,显示出来。 
一、Ganglia的工作模式
Ganglia的收集数据工作可以工作在单播(unicast)或多播(multicast)模式下,默认为多播模式。 
单播:发送自己收集到的监控数据到特定的一台或几台机器上,可以跨网段 
多播:发送自己收集到的监控数据到同一网段内所有的机器上,同时收集同一网段内的所有机器发送过来的监控数据。因为是以广播包的形式发送,因此需要同一网段内。但同一网段内,又可以定义不同的发送通道。
二、Ganglia的安装
Ganglia的安装非常简单,分为监控管理端(Gmetad)和客户端(Gmond)安装两部分
所有服务器安装好epel 源
服务端
yum install ganglia* -y
客户端
yum install ganglia-gmond -y

三、Ganglia的配置
1、监控管理端
/etc/ganglia/gmetad.conf 
所有集群的统称 
增加一项 gridname "BIGDATA"
增加data_source
data_source "hadoop" ip:port
修改rrd路径,否则根分区容易满
rrd_rootdir "/some/other/place"
http服务修改 vi /etc/httpd/conf.d/ganglia.conf 
增加 Allow from all

2、客户端配置
客户端监控安装完成后,配置文件位于安装Ganglia的etc目录下,名称为gmond.conf:
主要修改如下几项
cluster {
name = "hadoop"  #本节点属于哪个cluster 
owner = "unspecified" 
latlong = "unspecified" 
url = "unspecified" }

udp_send_channel {
  #bind_hostname = yes # Highly recommended, soon to be default.
                       # This option tells gmond to use a source address
                       # that resolves to the machine's hostname.  Without
                       # this, the metrics may appear to come from any
                       # interface and the DNS names associated with
                       # those IPs will be used to create the RRDs.
  #mcast_join = 239.2.11.71
  host=ip    #如果使用单播模式,则要写host = host1,单播模式下也可以配置多个udp_send_channel
  port = 8654
  ttl = 1
}
取消多播,修改端口
 udp_recv_channel {     #接收udp包配置
  #mcast_join = 239.2.11.71
  port = 8654
  #bind = 239.2.11.71
修改端口
tcp_accept_channel {
  port = 8654            #通过tcp协议监听的端口,远端可以通过链接8649端口得到监控数据

 
五、管理ganglia
 
所有配置操作完成后,即可启动ganglia服务了,首先在监控管理端启动gmetad服务:
/etc/init.d/gmetad start
接着启动apache的web服务:
/etc/init.d/httpd start
最后在每个客户端启动gmond服务:
/etc/init.d/gmond start

访问方式  http://ip/ganglia   
09-15 20:55