centos7 mini 及ganglia3.7.2安装

python及shell 专栏收录该内容
84 篇文章 0 订阅

 wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 rpm -ivh epel-release-latest-7.noarch.rpm
 yum repolist      ##检查是否已添加至源列表
检查好已添加至源后就可以进行yum安装了


yum install ganglia-gmond -y
yum install ganglia-gmetad -y
yum install httpd php
wget http://ncu.dl.sourceforge.net/project/ganglia/ganglia-web/3.7.2/ganglia-web-3.7.2.tar.gz
tar -zxvf ganglia-web-3.7.2.tar.gz -C /opt/soft/


service httpd status
service gmetad status
service gmond status


service httpd restart
service gmetad restart
service gmond restart


待续...
以下参考 :http://blog.csdn.net/lordk911/article/details/52299572

1 克隆一个有root用户的mini纯净系统,配动态ip
2 查看ip,上传下载好的包:
mkdir /opt/soft
ganglia-web-3.7.2.tar.gz
ganglia-3.7.2.tar.gz

安装CentOS 企业扩展YUM源


yum -y install --downloadonly --downloaddir=/opt/soft/epel-release epel-release
yum localinstall -y /opt/soft/epel-release/*.rpm
4 安装ganglia依赖包
yum -y install gcc glibc glibc-common rrdtool rrdtool-devel apr apr-devel expat expat-devel  pcre pcre-devel dejavu-lgc-sans-mono-fonts dejavu-sans-mono-fonts zlib zlib-devel libconfuse libconfuse-devel --downloadonly --downloaddir=/opt/soft/ganglia_depend
yum localinstall -y /opt/soft/ganglia_depend/*.rpm
5 监控端安装gmond及gmeta
cd /opt/soft
tar zxf ganglia-3.7.2.tar.gz
  cd ganglia-3.7.2
 ./configure --prefix=/usr/local/ganglia --with-gmetad --enable-gexec
  make && make install
6 安装nginx
 yum install nginx -y --downloadonly --downloaddir=/opt/soft/nginx
 yum localinstall -y /opt/soft/nginx/*.rpm 
 chkconfig nginx on
 systemctl start nginx
 7 安装php
 yum --enablerepo=remi,remi-php55 install php-fpm php-common php-devel php-mysqlnd php-mbstring php-mcrypt --downloadonly --downloaddir=/opt/soft/php
 yum localinstall -y /opt/soft/php/*.rpm
 chkconfig php-fpm on
 systemctl start php-fpm
 
 vi /etc/nginx/nginx.conf
 
  location / {
        }
下添加:
        location ~ \.php$ {
          root            /var/www;
          fastcgi_pass    127.0.0.1:9000;
          fastcgi_index   index.php;
          fastcgi_param   SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
          include         fastcgi_params;
        }


#重启nginx
  systemctl restart nginx
  
  mkdir  /var/www
  cd /var/www
  vi test.php
<?php
phpinfo();
?>
setenforce 0
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
vi /etc/nginx/nginx.conf
user apache;
systemctl restart nginx


访问:http//192.168.101.146/test.php,出现信息界面即为调试成功
或直接curl 192.168.101.146/test.php

配置gmeta
  mkdir -p /var/lib/ganglia/rrds
  chown nobody:nobody /var/lib/ganglia/rrds
  
  cd /opt/soft/ganglia-3.7.2
  cp ./gmetad/gmetad.init  /etc/init.d/gmetad
##修改gmetad
##具体值通过“find / -name 'gmetad' -print”查
# vi /etc/init.d/gmetad
  GMETAD=/usr/local/ganglia/sbin/gmetad
##修改gmetad.conf配置文件
##如果文件不存在:cp ./gmetad/gmetad.conf  /usr/local/ganglia/etc
 vi   /usr/local/ganglia/etc/gmetad.conf
    data_source "my cluster" 192.168.101.146
    xml_port  8651
    interactive_port  8652
    rrd_rootdir  "/var/lib/ganglia/rrds"
    case_sensitive_hostnames  0
  chkconfig --add gmetad
  
  mkdir /usr/local/ganglia/var/
  mkdir /usr/local/ganglia/var/run/
  service gmetad restart
# 可以通过日志 tail -f /var/log/messages 查看启动情况


配置gmond
  cd /opt/soft/ganglia-3.7.2
  cp ./gmond/gmond.init  /etc/init.d/gmond
  ./gmond/gmond -t > /usr/local/ganglia/etc/gmond.conf


##修改gmond配置
  vi  /etc/init.d/gmond
    GMOND=/usr/local/ganglia/sbin/gmond


##修改gmond.conf配置
  vi  /usr/local/ganglia/etc/gmond.conf
    cluster {
      name = "my cluster" #要与gmated.conf中data_source的名称相同
      owner = "nobody"
      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 = 192.168.101.146
      port = 8649
      ttl = 1
    }


    udp_recv_channel {
      #mcast_join = 239.2.11.71
      port = 8649
      #bind = 239.2.11.71
      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
    }


    tcp_accept_channel {
      port = 8649
      # If you want to gzip XML output
      gzip_output = no
    }


 重启gmond   
   service gmond restart


安装Ganglia Web
cd /opt/soft
tar -zxvf ganglia-web-3.7.2.tar.gz
cd ganglia-web-3.7.2
vi Makefile
GDESTDIR = /var/www/ganglia
APACHE_USER = apache                    # 与 /etc/php-fpm.d/www.conf 中user保持一致

安装rsync
 yum install nginx -y --downloadonly --downloaddir=/opt/soft/rsync rsync
 yum localinstall -y /opt/soft/rsync/*.rpm  
 make install


配置nginx访问ganglia


Nginx新增ganglia文件目录访问配置
 vi /etc/nginx/nginx.conf
location /ganglia {
   root   /var/www;
   index  index.html index.htm index.php;
}    

cd /var/www
chown -R apache:apache ganglia/


配置Ganglia Web

  cd /var/www/ganglia
  cp conf_default.php conf.php
  
 mkdir  /var/www/ganglia/dwoo/compiled
 mkdir /var/www/ganglia/dwoo/cache
  vi conf.php
##conf.php中有些默认配置和以上设置不一样的需要进行修改:
============================================================================================
$conf['gweb_root'] = "/var/www/ganglia";
$conf['gweb_confdir'] = "/var/www/ganglia";


include_once $conf['gweb_root'] . "/version.php";

#
# 'readonly': No authentication is required.  All users may view all resources.  No edits are allowed.
#  'enabled': Guest users may view public clusters.  Login is required to make changes.  
#             An administrator must configure an authentication scheme and ACL rules.
# 'disabled': Guest users may perform any actions, including edits.  No authentication is required.
$conf['auth_system'] = 'readonly';

#
# The name of the directory in "./templates" which contains the
# templates that you want to use. Templates are like a skin for the
# site that can alter its look and feel.
#
$conf['template_name'] = "default";

#
# If you installed gmetad in a directory other than the default
# make sure you change it here.
#

# Where gmetad stores the rrd archives.
$conf['gmetad_root'] = "/var/lib/ganglia";
$conf['rrds'] = "${conf['gmetad_root']}/rrds";


# Where Dwoo (PHP templating engine) store compiled templates
$conf['dwoo_compiled_dir'] = "${conf['gweb_confdir']}/dwoo/compiled";  ##如果不存在可以手动创建并注意权限
$conf['dwoo_cache_dir'] = "${conf['gweb_confdir']}/dwoo/cache";


# Where to store web-based configuration
$conf['views_dir'] = $conf['gweb_confdir'] . '/conf';
$conf['conf_dir'] = $conf['gweb_confdir'] . '/conf';


# Where to find filter configuration files, if not set filtering
# will be disabled
#$conf['filter_dir'] = "${conf['gweb_confdir']}/filters";


# Leave this alone if rrdtool is installed in $conf['gmetad_root'],
# otherwise, change it if it is installed elsewhere (like /usr/bin)
$conf['rrdtool'] = "/usr/bin/rrdtool"   


    service gmond restart
    service gmetad restart
    service php-fpm restart
    service nginx restart

     chmod +666 /usr/local/ganglia/var/run

    //要让这个用户可以写入:apache 有写权限即可。
    chmod +666 /var/www/ganglia/dwoo/compiled
    chmod +666 /var/www/ganglia/dwoo/cache

注意 服务的启动 start 与restart的区别。

其他需要监控的要装:

       5 监控端安装gmond及gmeta

cd /opt/soft
tar zxf ganglia-3.7.2.tar.gz
  cd ganglia-3.7.2
  ./configure --prefix=/usr/local/ganglia  --enable-gexec #这里要去掉--with-gmetad,只启用gmond
  make && make install



测试是否成功:

1 gmond :要用nc localhost 8649

2 gmetad:直接去看特定目录下是否有即时生成的文件 如默认位置:

/var/lib/ganglia/rrds/master

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值