宝塔面板安装Ganglia,用于服务器信息集中监控

lisahost.com

Ganglia的安装主要分为两大部分:一部分为主控端,安装ganglia-web和gmetad,一部分为被控端,安装gmond。

一、主控端,安装ganglia-web和gmetad

主控端集中在一台VPS就可以,用于集中管理、展示需要被监控的服务器。

SSH下,root用户:

前提,安装相关依赖

yum -y install apr-devel apr-util check-devel cairo-devel pango-devel libxml2-devel rpm-build glib2-devel dbus-devel freetype-devel fontconfig-devel gcc gcc-c++ expat-devel python-devel libXrender-devel

yum install -y libart_lgpl-devel pcre-devel libtool

yum install  -y rrdtool rrdtool-devel

1、安装ganglia-web和gmetad

yum install -y epel-release

yum install -y ganglia-web.x86_64
yum install -y ganglia-gmetad.x86_64

2、启动相关服务

systemctl start gmetad.service

3、gmetad的配置文件更改

vi /etc/ganglia/gmetad.conf

data_source “bigdata-kylin” localhost
gridname “kylin”
setuid_username ganglia
case_sensitive_hostnames 0

data_source “bigdata-kylin” localhost 此处设置cluster名称,gmond端务必一致,特别是在多播模式中,依此进行识别,最后的localhost是gmond传输的节点IP,因为设置gmond端将所有数据传输于gmetad处的的gmond节点,所以可以设置为localhost
gridname “kylin”此处为web端cluster处显示名称,无太多作用,就是为了去掉web中最上端显示的unspecial

4、安装宝塔面板,设置ganglia目录

安装宝塔,新建站点,配置文件更改root目录

root  /usr/share/ganglia

5、设置文件权限

chmod 777 -R /var/lib/ganglia-web/dwoo/compiled
chmod 777 -R /var/lib/ganglia-web/dwoo/cache

6、开放端口 5649

7、开机启动

systemctl start gmetad.service
systemctl enable gmetad.service

二、被控端,gmond端安装、设置

1、安装gmond

yum install -y epel-release

yum install -y ganglia-gmond

2、配置修改

vi /etc/ganglia/gmond.conf

主要修改

cluster {
  name = "bigdata-kylin"  ##需要与gmetad中定义的datasource名称一致
  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 as you like.  Gmond
   used to only support having a single channel */
udp_send_channel {
  #mcast_join = 239.27.1.1 ## 此处为多播设置,单播模式要去掉
  host = 10.239.1.35   ##向gmond传送数据的ip(ganglia-web),设置
  port = 8649 		   ## 接收gmond节点的端口
  ttl = 1
}
/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
  port = 8649  		##gmond自身节点的端口
  bind = 0.0.0.0    ##gmond监听地址,去掉也可以
  retry_bind = true
}

3、开机启动

systemctl start gmond.service
systemctl enable gmond.service

4、重启服务

systemctl restart gmetad.service 
systemctl restart gmond.service 

部分参考:https://www.cnblogs.com/marility/p/9444357.html

    所有主机信息仅是为及时分享并收录,不做推荐!