设为首页 收藏本站
查看: 637|回复: 0

[经验分享] 系统监控软件ganglia3.2.0

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-4-17 09:24:22 | 显示全部楼层 |阅读模式
实验环境如下图所示
wKiom1Uvc--wbcT1AAI3VwzzJyQ902.jpg
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】
一:安装所需软件
[iyunv@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.[iyunv@admingmetad]# cp gmetad.init /etc/init.d/gmetad
3.[iyunv@admingmetad]# chkconfig --add gmetad;chkconfig --list gmetad
gmetad          0:off   1:off  2:on    3:on    4:on   5:on    6:off
4.[iyunv@admingmetad]# vi /etc/init.d/gmetad 修改GMETAD=/usr/sbin/gmetad为GMETAD=/usr/local/ganglia/sbin/gmetad
5.[iyunv@admingmetad]# vi /etc/ganglia/gmetad.conf,找到第45行:data_source "my cluster" localhost,把"my cluster"可一更改为自己喜欢的名称,比如wjcyf,其他默认即可
6.创建所需目录,并设置所有者和权限
[iyunv@admin gmetad]#mkdir -p /var/lib/ganglia/rrds
[iyunv@admingmetad]# chown nobody:nobody /var/lib/ganglia/rrds/
[iyunv@admingmetad]# chmod 1777 /var/lib/ganglia/rrds/
7.启动gmetad服务
[iyunv@admingmetad]# /etc/init.d/gmetad start
Starting GANGLIAgmetad:                                   [  OK  ]
◆.配置gmond
1.[iyunv@admingmetad]# cd ../gmond/
2.[iyunv@admingmond]# cp gmond.init /etc/init.d/gmond
3.[iyunv@admingmond]# chkconfig --add gmond ;chkconfig --list gmond
gmond           0:off   1:off  2:on    3:on    4:on   5:on    6:off
4. [iyunv@admingmond]# vi /etc/init.d/gmond修改GMOND=/usr/sbin/gmond为GMOND=/usr/local/ganglia/sbin/gmond
5.生成默认配置文件gmond.conf
[iyunv@admingmond]# ./gmond -t >/etc/ganglia/gmond.conf
6. [iyunv@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
* 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服务
[iyunv@admingmond]# /etc/init.d/gmond start
Starting GANGLIAgmond:                                   [  OK  ]

六:安装apache配置ganglia-web
1. [iyunv@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. [iyunv@adminganglia]# cp conf.php conf.php.bak
5.[iyunv@admin ganglia]#vi conf.php,更改第33行define("RRDTOOL","/usr/bin/rrdtool");为
define("RRDTOOL","/usr/local/rrdtool/bin/rrdtool");
6.创建所需目录,并设置所有者和权限
[iyunv@adminganglia]# mkdir /var/lib/ganglia/dwoo
[iyunv@adminganglia]# chown apache:apache /var/lib/ganglia/dwoo/
[iyunv@adminganglia]# chmod 777 /var/lib/ganglia/dwoo/
7. [iyunv@adminganglia]# vi /etc/httpd/conf/httpd.conf,把第256行#ServerName www.example.com:80前面的#号去掉
8.启动apache服务
[iyunv@adminganglia]# /etc/init.d/httpd start ; chkconfig httpd on
Startinghttpd:                                            [  OK  ]

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


【被监控端安装ganglia】
一:安装所需软件
[iyunv@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配置文件存放目录
[iyunv@node1 ganglia-3.2.0]#mkdir /etc/ganglia
2.[root@node1ganglia-3.2.0]# cd gmond/
3.[iyunv@node1gmond]# cp gmond.init /etc/init.d/gmond
4.[iyunv@node1gmond]# chkconfig --add gmond ;chkconfig --list gmond
gmond           0:off   1:off  2:on    3:on    4:on   5:on    6:off
5. [iyunv@node1gmond]# vi /etc/init.d/gmond修改GMOND=/usr/sbin/gmond为GMOND=/usr/local/ganglia/sbin/gmond
6.生成默认配置文件gmond.conf
[iyunv@node1gmond]# ./gmond -t >/etc/ganglia/gmond.conf
7.[iyunv@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
* 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服务
[iyunv@node1 ~]#/etc/init.d/gmond start

注:node2操作同node1

五:重新访问ganglia server,则可正常显示node1和node2的信息,如下列图中所示
wKioL1UvPlKhvbIAAAVCj2mz47s315.jpg
wKioL1UvPNiyzTFCAAHlJvZJ5T0172.jpg
wKiom1UvO6KhmRttAAHWqwwNdhc181.jpg

碰到的问题
  • 在启动/etc/init.d/gmond服务时报错:gmond dead but subsys locked
A:原来是在目录/etc/ganglia/conf.d/下有个文件modpython.conf,我这样做了一个备份cp modpython.conf ~modpython.conf的缘故,删除~modpython.conf后,gmond服务正常启动



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-57980-1-1.html 上篇帖子: linux系统监控工具dstat、glances及实时进程查看工具htop(含部分进程原理) 下篇帖子: Linux程序管理:top.htop.glances,dstat等命令使用方法 监控软件
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表