Ganglia监控集群配置详解,案例分析

版权声明:文章来源:良玉的博客 http://www.uouo123.com/ 转载请注明 https://blog.csdn.net/xiangliangyu2008/article/details/82711010

Ganglia监控集群配置详解,案例分析

1 多播方式

多播方式配置比较简单。

服务端配置文件 /opt/modules/ganglia/etc/gmetad.conf (注:gmeta daemon)

注:cluster_name一定要与要监控的配置中的cluster name相同。gmond_node1-n指的要监控的机器名

data_source "cluster_name" gmond_node1 gmond_node2 ... gmond_noden

说明:cluster_name是监控机群名称。可以配置多个,也就是分组。比如将zookeeper集群作为一个监控分组,hdfs集群作为一个分组,hbase作为一个分组(如果hbase和hdfs分别部署在不同的节点上)。ganglia默认使用端口8649,因此如果你只有一个集群的话,可以使用不写端口号;如果你是监控多个分组的话,就需要以gmond_node1:port的形式列出gmond客户端。例如 

data_source "hdfs" localhost 192.168.0.101:8649

data_source "zookeeper" 210.51.44.102:8650

在多播方式下,所有的gmond节点通过多播的形式发送各自的数据,也就是每一个gmond节点上面都完整的存了一份所有gmond节点的监控数据,gmetad只需要向其中的一个gmond索取数据即可,这里gmetad首先到第一个查询,如果失败,查询第二个,以此类推。

监控客户端配置文件/opt/modules/ganglia/etc/gmond.conf (注:gmonitor daemon)

globals段:gmond的全局配置,一般不需要修改

cluster段:这一段是重要的一段,至少需要定义name变量,所有name相同的节点将认为在同一个集群(监控分组)里,其他变量是对该集群的说明。

host段:只有一个变量,location,是对这个节点的一些说明,一般不用修改。

udp_send_channel段:这也是很重要的一段,可以定义多个这样的段,不过如果在同一局域网内,只有一个集群的环境下,这一段保持默认也可以工作的很好。ganglia默认采用多播发送监控数据,mcast_join变量指定多播组。port 指定端口号,根据当前节点所在的分组,与gmetad.conf中的端口对应起来,ttl指定跳数一般为1,如果需要经过gmond中转,需要修改这个跳数。

udp_recv_channel段:对应于udp_send_channel段,也可以设置多个。

tcp_accept_channel段:指定一个端口,可以通过TCP的的方式,从这个端口读取XML格式的监控数据

总结一下,如果只是完成最简单的监控任务:整个配置文件只需要修改一个地方,就是cluster的name变量

eg:

gmetad.conf :

data_source "test" 192.168.1.11:8649 192.168.1.12:8649

192.168.1.11,就改个集群的名字,和host名字:

gmond.conf

globals {                    

  daemonize = yes              

  setuid = yes             

  user = ganglia              

  debug_level = 0               

  max_udp_msg_len = 1472        

  mute = no             

  deaf = no             

  host_dmax = 0 /*secs */ 

  cleanup_threshold = 300 /*secs */ 

  gexec = no             

  send_metadata_interval = 0     

/* If a cluster attribute is specified, then all gmond hosts are wrapped inside 

 * of a <CLUSTER> tag.  If you do not specify a cluster tag, then all <HOSTS> will 

 * NOT be wrapped inside of a <CLUSTER> tag. */ 

cluster { 

  name = "test" 

  owner = "unspecified" 

  latlong = "unspecified" 

  url = "unspecified" 

/* The host section describes attributes of the host, like the location */ 

host { 

  location = "192.168.1.11" 

/* Feel free to specify as many udp_send_channels as you like.  Gmond 

   used to only support having a single channel */ 

udp_send_channel { 

  mcast_join = 239.2.11.71

  port = 8649 

  ttl = 1 

/* You can specify as many udp_recv_channels as you like as well. */ 

udp_recv_channel { 

  mcast_join = 239.2.11.71 

  port = 8649 

  bind = 239.2.11.71 

/* You can specify as many tcp_accept_channels as you like to share 

   an xml description of the state of the cluster */ 

tcp_accept_channel { 

  port = 8649 

192.168.1.12,就改个集群的名字,和host名字:

gmond.conf

globals {                    

  daemonize = yes              

  setuid = yes             

  user = ganglia              

  debug_level = 0               

  max_udp_msg_len = 1472        

  mute = no             

  deaf = no             

  host_dmax = 0 /*secs */ 

  cleanup_threshold = 300 /*secs */ 

  gexec = no             

  send_metadata_interval = 0     

/* If a cluster attribute is specified, then all gmond hosts are wrapped inside 

 * of a <CLUSTER> tag.  If you do not specify a cluster tag, then all <HOSTS> will 

 * NOT be wrapped inside of a <CLUSTER> tag. */ 

cluster { 

  name = "test" 

  owner = "unspecified" 

  latlong = "unspecified" 

  url = "unspecified" 

/* The host section describes attributes of the host, like the location */ 

host { 

  location = "192.168.1.12" 

/* Feel free to specify as many udp_send_channels as you like.  Gmond 

   used to only support having a single channel */ 

udp_send_channel { 

  mcast_join = 239.2.11.71

  port = 8649 

  ttl = 1 

/* You can specify as many udp_recv_channels as you like as well. */ 

udp_recv_channel { 

  mcast_join = 239.2.11.71 

  port = 8649 

  bind = 239.2.11.71 

/* You can specify as many tcp_accept_channels as you like to share 

   an xml description of the state of the cluster */ 

tcp_accept_channel { 

  port = 8649 

2 单播方式

如果监控的集群跨网段,就需要使用单播方式。单播其实就是所有的gmond节点指定一台机器来存储大家的监控数据。要使用单播方式,gmetad.conf不需要修改。只需要修改gmond.conf。

udp_send_channel段,使用host变量来指定接受数据的机器。值得注意的是,mcast_join和host不能同时出现在一个channel里。

udp_recv_channel段使用bind变量指出的ip,该ip必须所有其他gmond可以访问到。事实上,可以使用0.0.0.0。这里我发现直接将bind注释掉也可以正常工作。

猜你喜欢

转载自blog.csdn.net/xiangliangyu2008/article/details/82711010
今日推荐