美文网首页
分布式监控系统Ganglia安装过程

分布式监控系统Ganglia安装过程

作者: cherishpf | 来源:发表于2019-08-01 18:00 被阅读0次

    Ganglia简介

    Ganglia 是一款为 HPC(高性能计算)集群而设计的可扩展的分布式监控系统,它可以监视和显示集群中的节点的各种状态信息,它由运行在各个节点上的 gmond 守护进程来采集 CPU 、内存、硬盘利用率、 I/O 负载、网络流量情况等方面的数据,然后汇总到 gmetad守护进程下,使用 rrdtool 存储数据,最后将历史数据以曲线方式通过 PHP 页面呈现。

    Ganglia 的特点如下:
    (1)良好的扩展性,分层架构设计能够适应大规模服务器集群的需要
    (2)负载开销低,支持高并发
    (3)广泛支持各种操作系统( UNIX 等)和 cpu 架构,支持虚拟

    Ganglia组成部分

    Ganglia 监控系统有三部分组成,分别是 gmond、 gmetad、 gweb,作用如下:

    gmond: 即为 ganglia monitoring daemon,是一个守护进程,运行在每一个需要监测的节点上,用于收集本节点的信息并发送到其他节点,同时也接收其他节点发过来的数据,默认的监听端口为 8649。

    gmetad: 即为 ganglia meta daemon,是一个守护进程,运行在一个数据汇聚节点上,定期检查每个监测节点的 gmond 进程并从那里获取数据,然后将数据指标存储在本地 RRD 存储引擎中。

    gweb: 即为Ganglia Web,是一个基于 web 的图形化监控界面(PHP前端),需要和 gmetad 安装在同一个节点上,它从gmetad 获取数据,并且读取 RRD 数据库,通过 rrdtool 生成图表,用于前台展示,界面美观、丰富,功能强大。

    以上,引自https://blog.51cto.com/huaxin/1841208

    gmond用于收集监测数据,可以发送也可以接收在同一个组播或单播通道上的统计信息。gmond有两个角色,一个是发送者,另一个是接收者。当mute=no时,gmond是发送者,会收集本节点上的基本指标,比如系统负载(load_one)、cpu和memory利用率等,也可以发送用户通过添加C/Python模块来自定义的指标。当deaf=no是接收者,主要用来聚合所有从别的节点上发来的指标(如flume agent发来的metrics信息),并把他们都保存在内存缓冲区中。gmond节点之间通过UDP收集数据,gmetad通过TCP从gmond节点获取数据。

    以下步骤基于CentOS 7.6 64bit系统安装成功
    查看系统环境:

    [root@localhost ~]# lsb_release -a 
    LSB Version:    :core-4.1-amd64:core-4.1-noarch
    Distributor ID: CentOS
    Description:    CentOS Linux release 7.6.1810 (Core) 
    Release:    7.6.1810
    Codename:   Core
    

    ganglia的安装与部署

    • 1、安装httpd服务与php
    # yum -y install httpd php
    
    已安装:
    httpd.x86_64 0:2.4.6-89.el7.centos.1 php.x86_64 0:5.4.16-46.el7 
    
    作为依赖被安装:
    apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 
    httpd-tools.x86_64 0:2.4.6-89.el7.centos.1 mailcap.noarch 0:2.1.41-2.el7 
    php-cli.x86_64 0:5.4.16-46.el7 php-common.x86_64 0:5.4.16-46.el7 
    
    完毕! 
    
    • 2、安装其他依赖
    # yum -y install rrdtool perl-rrdtool rrdtool-devel
    
    已安装:
    rrdtool.x86_64 0:1.4.8-9.el7 rrdtool-devel.x86_64 0:1.4.8-9.el7 
    rrdtool-perl.x86_64 0:1.4.8-9.el7 
    
    作为依赖被安装:
    cairo.x86_64 0:1.15.12-3.el7 
    dejavu-sans-mono-fonts.noarch 0:2.33-6.el7 
    fribidi.x86_64 0:1.0.2-1.el7 
    graphite2.x86_64 0:1.3.10-1.el7_3 
    harfbuzz.x86_64 0:1.7.5-2.el7 
    libXdamage.x86_64 0:1.1.4-4.1.el7 
    libXext.x86_64 0:1.3.3-3.el7 
    libXfixes.x86_64 0:5.0.3-1.el7 
    libXxf86vm.x86_64 0:1.1.4-1.el7 
    libglvnd.x86_64 1:1.0.1-0.8.git5baa1e5.el7 
    libglvnd-egl.x86_64 1:1.0.1-0.8.git5baa1e5.el7 
    libglvnd-glx.x86_64 1:1.0.1-0.8.git5baa1e5.el7 
    libthai.x86_64 0:0.1.14-9.el7 
    libwayland-client.x86_64 0:1.15.0-1.el7 
    libwayland-server.x86_64 0:1.15.0-1.el7 
    libxshmfence.x86_64 0:1.2-1.el7 
    mesa-libEGL.x86_64 0:18.0.5-4.el7_6 
    mesa-libGL.x86_64 0:18.0.5-4.el7_6 
    mesa-libgbm.x86_64 0:18.0.5-4.el7_6 
    mesa-libglapi.x86_64 0:18.0.5-4.el7_6 
    pango.x86_64 0:1.42.4-2.el7_6 
    pixman.x86_64 0:0.34.0-1.el7 
    
    完毕! 
    
    # yum -y install apr-devel
    
    已安装:
    apr-devel.x86_64 0:1.4.8-3.el7_4.1 
    
    完毕! 
    
    • 3、安装ganglia
    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    
    获取http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    警告:/var/tmp/rpm-tmp.KbkMeA: 头V3 RSA/SHA256 Signature, 密钥 ID 0608b895: NOKEY
    准备中... ################################# [100%]
    软件包 epel-release-7-11.noarch (比 epel-release-6-8.noarch 还要新) 已经安装
    file /etc/rpm/macros.ghc-srpm from install of epel-release-6-8.noarch conflicts with file from package redhat-rpm-config-9.1.0-87.el7.centos.noarch 
    
    # yum -y install ganglia-gmetad 
    
    已安装:
    ganglia-gmetad.x86_64 0:3.7.2-2.el7 
    
    作为依赖被安装:
    ganglia.x86_64 0:3.7.2-2.el7 libconfuse.x86_64 0:2.7-7.el7 
    libevent.x86_64 0:2.0.21-4.el7 libmemcached.x86_64 0:1.0.16-5.el7 
    
    完毕!
    
    # yum -y install ganglia-gmond 
    
    已安装:
    ganglia-gmond.x86_64 0:3.7.2-2.el7 
    
    完毕! 
    
    # yum -y install ganglia-web 
    
    已安装:
    ganglia-web.x86_64 0:3.7.1-2.el7 
    
    作为依赖被安装:
    libXpm.x86_64 0:3.5.12-1.el7 libxslt.x86_64 0:1.1.28-5.el7 
    php-ZendFramework.noarch 0:1.12.20-1.el7 php-bcmath.x86_64 0:5.4.16-46.el7 
    php-gd.x86_64 0:5.4.16-46.el7 php-process.x86_64 0:5.4.16-46.el7 
    php-xml.x86_64 0:5.4.16-46.el7 t1lib.x86_64 0:5.1.2-14.el7 
    
    完毕! 
    
    • 4、修改ganglia配置文件
    # vim /etc/httpd/conf.d/ganglia.conf
    
    #
    # Ganglia monitoring system php web frontend
    #
    
    Alias /ganglia /usr/share/ganglia
    
    <Location /ganglia>
      # Require local
      Require all granted
      # Require ip 10.1.2.3
      # Require host example.org
    </Location> 
    
    特别注意:以下配置是不能起作用的
    <Location /ganglia>
      Order deny,allow
      Allow from all
    </Location> 
    

    该文件配置有误时页面会提示以下错误:
    Forbidden
    You don't have permission to access /ganglia on this server.
    错误日志提示:
    [authz_core:error] [pid 14410] [client 171.84.5.202:8444] AH01630: client denied by server configuration: /usr/share/ganglia

    • 5、修改gmetad配置文件
    # vim /etc/ganglia/gmetad.conf 
    
    #data_source "my cluster" localhost
    data_source "bigdata" localhost 
    
    # The name of this Grid. All the data sources above will be wrapped in a GRID
    # tag with this name.
    # default: unspecified
    gridname "MyGrid"
    

    5、修改gmond配置文件

    # vim /etc/ganglia/gmond.conf 
    
    cluster {
      #name = "unspecified"
      name = "bigdata"
      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 = localhost
      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
      bind = localhost
      retry_bind = true 
    
    # Size of the UDP buffer. If you are handling lots of metrics you really
    # should bump it up to e.g. 10MB or even higher.
    # buffer = 10485760
    } 
    
    • 6、查看SELinux状态
    # sestatus
    SELinux status: disabled
    

    如果不是disabled状态,需修改以下配置文件:

    vim /etc/selinux/config

    或者临时关闭SELinux:

    # setenforce 0
    
    • 7、启动ganglia
    # service httpd start
    

    若80端口已被其他应用所占,可以修改 /etc/httpd/conf/httpd.conf 文件中的Listen 80,修改该文件后需重启httpd服务:
    systemctl restart httpd.service

    # service gmetad start
    # service gmond start
    
    • 8、打开浏览器访问ganglia-web(假设192.168.9.191为本机ip)

    http://192.168.9.191:80/ganglia/

    如果完成以上操作仍出现权限不足错误,可修改/var/lib/ganglia目录的权限尝试

    # chmod -R 777 /var/lib/ganglia

    ganglia-web截图.png

    特别说明:

    使用Fedora30系统,无法成功使用yum安装ganglia-web,依赖冲突错误

    $ yum install ganglia-web
    

    错误:
    问题: conflicting requests

    • nothing provides php-ZendFramework needed by ganglia-web-3.7.2-24.fc30.x86_64
      (try to add '--skip-broken' to skip uninstallable packages)
      在fedora-release 中该安装包的名称都是小写,即使安装了php-zendframework后,仍然报上述错误,可能ganglia-web安装时是查询绝对匹配php-ZendFramework的安装包
    $ yum install php-zendframework 
    

    想要升级安装rpm也失败了:

    $ rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
    

    获取http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
    警告:/var/tmp/rpm-tmp.FILPNi: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
    错误:依赖检测失败:
    fedora-release 与 epel-release-7-11.noarch 冲突

    相关文章

      网友评论

          本文标题:分布式监控系统Ganglia安装过程

          本文链接:https://www.haomeiwen.com/subject/ispcdctx.html