码迷,mamicode.com
首页 > 其他好文 > 详细

系统监控软件ganglia3.2.0

时间:2015-04-16 14:28:45      阅读:272      评论:0      收藏:0      [点我收藏+]

标签:系统监控 ganglia

实验环境如下图所示

技术分享

1.上图中三台机器均为rhel 5.8 x86_64,三台机器IP地址和主机名已按上图设置完毕

2.各软件版本如下

.confuse-2.7.tar.gz

.ganglia-3.2.0.tar.gz

.rrdtool-1.4.5.tar.gz

3.管理节点(admin),hosts文件已添加完毕,如下所示

192.168.10.11       admin

192.168.10.100  node1

192.168.10.101  node2

4.本次实验ganglia通信采用单播方式

 

管理端(admin)安装ganglia

:安装所需软件

[root@admin ~]#yum -y install apr-devel expat-devel \

> pcre-devellibxml2-devel cairo-devel \

> pango-develpython-devel

 

注:RHEL 6系列不能只安装python-devel,可以直接python*,还要加装perl-ExtUtils*

 

二:编译安装confuse

[root@adminganglia-3.2.0]# tar xzf confuse-2.7.tar.gz

[root@adminganglia-3.2.0]# cd confuse-2.7

[root@adminconfuse-2.7]# ./configure --enable-shared --libdir=/usr/lib64

[root@adminconfuse-2.7]# make

[root@adminconfuse-2.7]# make install

 

:编译安装rrdtool

[root@adminganglia-3.2.0]# tar xzf rrdtool-1.4.5.tar.gz

[root@adminganglia-3.2.0]# cd rrdtool-1.4.5

[root@adminrrdtool-1.4.5]# ./configure --prefix=/usr/local/rrdtool

[root@adminrrdtool-1.4.5]# make

[root@adminrrdtool-1.4.5]# make install

 

四:编译安装ganglia

[root@adminganglia-3.2.0]# ./configure --prefix=/usr/local/ganglia \

>--sysconfdir=/etc/ganglia \

>--with-librrd=/usr/local/rrdtool \

> --with-gmetad\

>--enable-gexec \

>--enable-status

[root@adminganglia-3.2.0]# make

[root@adminganglia-3.2.0]# make install

 

五:配置ganglia

.链接命令文件

[root@adminganglia-3.2.0]# ln -s /usr/local/ganglia/bin/* /usr/local/bin/

[root@adminganglia-3.2.0]# ln -s /usr/local/ganglia/sbin/* /usr/local/sbin/

.配置gmetad

1.[root@adminganglia-3.2.0]# cd gmetad

2.[root@admingmetad]# cp gmetad.init /etc/init.d/gmetad

3.[root@admingmetad]# chkconfig --add gmetad;chkconfig --list gmetad

gmetad          0:off   1:off  2:on    3:on    4:on   5:on    6:off

4.[root@admingmetad]# vi /etc/init.d/gmetad 修改GMETAD=/usr/sbin/gmetadGMETAD=/usr/local/ganglia/sbin/gmetad

5.[root@admingmetad]# vi /etc/ganglia/gmetad.conf,找到第45行:data_source "my cluster" localhost,把"my cluster"可一更改为自己喜欢的名称,比如wjcyf,其他默认即可

6.创建所需目录,并设置所有者和权限

[root@admin gmetad]#mkdir -p /var/lib/ganglia/rrds

[root@admingmetad]# chown nobody:nobody /var/lib/ganglia/rrds/

[root@admingmetad]# chmod 1777 /var/lib/ganglia/rrds/

7.启动gmetad服务

[root@admingmetad]# /etc/init.d/gmetad start

Starting GANGLIAgmetad:                                   [  OK  ]

.配置gmond

1.[root@admingmetad]# cd ../gmond/

2.[root@admingmond]# cp gmond.init /etc/init.d/gmond

3.[root@admingmond]# chkconfig --add gmond ;chkconfig --list gmond

gmond           0:off   1:off  2:on    3:on    4:on   5:on    6:off

4. [root@admingmond]# vi /etc/init.d/gmond修改GMOND=/usr/sbin/gmondGMOND=/usr/local/ganglia/sbin/gmond

5.生成默认配置文件gmond.conf

[root@admingmond]# ./gmond -t >/etc/ganglia/gmond.conf

6. [root@admingmond]# vi /etc/ganglia/gmond.conf,本次实验配置ganglia server节点为“单收”,配置文件需要修改的地方为下面红色文字所示,其余均默认

/* This configuration is as close to 2.5.x defaultbehavior as possible

   The valuesclosely match ./gmond/metric.h definitions in 2.5.x */

globals {

  daemonize =yes

  setuid = yes

  user = nobody

  debug_level =0

 max_udp_msg_len = 1472

  mute = yes

  deaf = no

 allow_extra_data = yes

  host_dmax = 0/*secs */

  host_tmax = 20/*secs */

 cleanup_threshold = 300 /*secs */

  gexec = no

 send_metadata_interval = 0 /*secs */

}

 

/*

 * The clusterattributes specified will be used as part of the <CLUSTER>

 * tag that willwrap all hosts collected by this instance.

 */

cluster {

  name = "wjcyf"

  owner ="unspecified"

  latlong ="unspecified"

  url ="unspecified"

}

 

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

host {

  location ="unspecified"

}

 

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

   used to onlysupport having a single channel */

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

  port = 8649

  ttl = 1

}

 

/* You can specify as many udp_recv_channels as youlike as well. */

udp_recv_channel {

  port= 8649

  bind= 192.168.10.11

}

 

/* You can specify as many tcp_accept_channels as youlike to share

   an xmldescription of the state of the cluster */

tcp_accept_channel {

  port = 8649

    acl {

       default = "deny"

        access {

           ip= 127.0.0.1

           mask= 32

           action= "allow"

    }

   }

}

以下配置文件略

 

7.启动gmond服务

[root@admingmond]# /etc/init.d/gmond start

Starting GANGLIAgmond:                                   [  OK  ]

 

六:安装apache配置ganglia-web

1. [root@admingmond]# yum -y install httpd php php-gd

2. [root@adminganglia-3.2.0]# cp -r web/ /var/www/html/ganglia

3. [root@adminganglia-3.2.0]# cd /var/www/html/ganglia/

4. [root@adminganglia]# cp conf.php conf.php.bak

5.[root@admin ganglia]#vi conf.php,更改第33define("RRDTOOL","/usr/bin/rrdtool");

define("RRDTOOL","/usr/local/rrdtool/bin/rrdtool");

6.创建所需目录,并设置所有者和权限

[root@adminganglia]# mkdir /var/lib/ganglia/dwoo

[root@adminganglia]# chown apache:apache /var/lib/ganglia/dwoo/

[root@adminganglia]# chmod 777 /var/lib/ganglia/dwoo/

7. [root@adminganglia]# vi /etc/httpd/conf/httpd.conf,把第256#ServerName www.example.com:80前面的#号去掉

8.启动apache服务

[root@adminganglia]# /etc/init.d/httpd start ; chkconfig httpd on

Startinghttpd:                                            [  OK  ]

 

七:访问ganglia server

1.http://192.168.10.11/ganglia,因为此服务器被配置为“单收”,所以会出现下面的网页显示(有被监控端后,显示正常)

技术分享

 

 

被监控端安装ganglia

:安装所需软件

[root@node1 ~]#yum -y install apr-devel expat-devel pcre-devel python-devel

二:编译安装confuse

[root@node1ganglia-3.2.0]# tar xzf confuse-2.7.tar.gz

[root@node1ganglia-3.2.0]# cd confuse-2.7

[root@node1confuse-2.7]# ./configure --enable-shared --libdir=/usr/lib64

[root@node1confuse-2.7]# make

[root@node1confuse-2.7]# make install

三:编译安装ganglia

[root@node1ganglia-3.2.0]# ./configure --prefix=/usr/local/ganglia \

>--sysconfdir=/etc/ganglia \

>--enable-gexec \

>--enable-status

[root@node1ganglia-3.2.0]# make

[root@node1ganglia-3.2.0]# make install

四:配置ganglia

1.创建ganglia配置文件存放目录

[root@node1 ganglia-3.2.0]#mkdir /etc/ganglia

2.[root@node1ganglia-3.2.0]# cd gmond/

3.[root@node1gmond]# cp gmond.init /etc/init.d/gmond

4.[root@node1gmond]# chkconfig --add gmond ;chkconfig --list gmond

gmond           0:off   1:off  2:on    3:on    4:on   5:on    6:off

5. [root@node1gmond]# vi /etc/init.d/gmond修改GMOND=/usr/sbin/gmondGMOND=/usr/local/ganglia/sbin/gmond

6.生成默认配置文件gmond.conf

[root@node1gmond]# ./gmond -t >/etc/ganglia/gmond.conf

7.[root@node1gmond]# vi /etc/ganglia/gmond.conf,本次实验配置被监控节点为“单发”,配置文件需要修改的地方为下面红色文字所示,其余均默认

/* This configuration is as close to 2.5.x defaultbehavior as possible

   The valuesclosely match ./gmond/metric.h definitions in 2.5.x */

globals {

  daemonize =yes

  setuid = yes

  user = nobody

  debug_level =0

  max_udp_msg_len= 1472

  mute = no

  deaf = yes

 allow_extra_data = yes

  host_dmax = 86400/*secs */

  host_tmax = 20/*secs */

 cleanup_threshold = 300 /*secs */

  gexec = no

  send_metadata_interval= 300 /*secs */

}

 

/*

 * The clusterattributes specified will be used as part of the <CLUSTER>

 * tag that willwrap all hosts collected by this instance.

 */

cluster {

  name = "wjcyf"

  owner ="unspecified"

  latlong ="unspecified"

  url ="unspecified"

}

 

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

host {

  location ="unspecified"

}

 

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

   used to onlysupport having a single channel */

udp_send_channel {

  host= 192.168.10.11

  port= 8649

}

以下配置文件略

 

8.启动gmond服务

[root@node1 ~]#/etc/init.d/gmond start

 

注:node2操作同node1

 

五:重新访问ganglia server,则可正常显示node1node2的信息,如下列图中所示

技术分享

技术分享

技术分享


碰到的问题

  1. 在启动/etc/init.d/gmond服务时报错:gmond dead but subsys locked

A:原来是在目录/etc/ganglia/conf.d/下有个文件modpython.conf,我这样做了一个备份cp modpython.conf ~modpython.conf的缘故,删除~modpython.conf后,gmond服务正常启动



本文出自 “永不止步” 博客,谢绝转载!

系统监控软件ganglia3.2.0

标签:系统监控 ganglia

原文地址:http://wjcaiyf.blog.51cto.com/7105309/1633338

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!