Ganglia:分布式监控系统
Ganglia的核心包括gmond、gmetad和一个Web前端。主要用于监控系统性能,如cpu、mem、硬盘利用率、I/O负载、网络流量等。通过曲线可以很容易地看到各个节点的工作状态,对合理调整和分配系统资源,提高系统整体性能具有重要作用。
Ganglia监控终端安装
1.安装相关软件包。
yum install ntp vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel pam-devel python-devel perl perl-devel expat expat-devel pcre pcre-devel apr apr-devel cairo-devel和pango-devel需要安装最新版本rrdtool工具的Ganglia可以使用yum直接安装rrdtool工具。
2.安装混淆
wget http://download.savannah.gnu.org/releases/confuse/confuse-2.7.tar.gz tar zxf confuse-2.7.tar.gz cd confuse-2.7 ./configure CFLAGS=-fPIC --disable-nls ;make;make install cd ..3.安装ganglia
wget http://downloads.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.3.1/ganglia-3.3.1.tar.gz tar zxf ganglia-3.3.1.tar.gz cd ganglia-3.3.1 #server 监控端 ./configure --prefix=/usr/local/ganglia --with-static-modules --enable-gexec --enable-status --with-gmetad --with-python=/usr --with-librrd=/usr/local/rrdtool --with-libexpat=/usr --with-libconfuse=/usr/local --with-libpcre make make install cd gmetad cp gmetad.conf /opt/modules/ganglia/etc/ cp gmetad.init /etc/init.d/gmetad vim /etc/init.d/gmetad 修改为GMETAD=/usr/local/ganglia/sbin/gmetad ip route add 239.2.11.71 dev eth0 ##添加广播路由Ganglia:由被监控端安装:
1.安装相关软件包。
yum install ntp vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel pam-devel python-devel perl perl-devel expat expat-devel pcre pcre-devel apr apr-devel wget http://download.savannah.gnu.org/releases/confuse/confuse-2.7.tar.gz tar zxf confuse-2.7.tar.gz cd confuse-2.7 ./configure CFLAGS=-fPIC --disable-nls ;make;make install cd ..2.安装ganglia
wget http://downloads.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.3.1/ganglia-3.6.0.tar.gz tar zxf ganglia-3.6.0.tar.gz cd ganglia-3.6.0 ./configure --prefix=/usr/local/ganglia --enable-gexec --enable-status --with-python=/usr --with-libapr --with-libconfuse=/usr/local --with-libexpat=/usr --with-libpcre make make install cd gmond ./gmond -t > /usr/local/ganglia/etc/gmond.conf cp gmetad.init /etc/init.d/gmond vim /etc/init.d/gmond 修改为: GMETAD=/usr/local/ganglia/sbin/gmond mkdir /usr/local/ganglia/lib64/ganglia/python_modules cp python_modules/*/*.py /usr/local/ganglia/lib64/ganglia/python_modules ip route add 239.2.11.71 dev eth0安装已经完成,过程很简单。
网页在https://github.com/ganglia/ganglia-web
自己下载配置。
我们来监控一下,让它正常工作使用。
Ganglia是一个分布式的监控系统,不需要分布就可以使用。这里有两种解释方式。
1.没有使用分布式监控方法。
服务器配置文件 修改两项: data_source "test1" 192.168.107.2 data_source "test2" 172.16.1.4 ##这里分了两个监控组 data_source是关键字, “test1,test2” 是监控主机组的名字,全局要唯一。 后面跟着要监控的ip或主机名,如果有多个可以用空格隔开就可以了 gridname "Test" 这个是定义监控集的名字,如下图:
Ganglia还没开始。启动前,执行以下命令:
您可以使用命令来查看是否存在阻止您启动的配置错误。
/usr/local/ganglia/sbin/gmetad-d5
错误的地方应该可以修改配置文件gmetad.conf已被纠正,
Servicetadstart启动服务。
好了,我们来看看客户端的配置。
在客户端配置 globals { daemonize = yes setuid = yes user = nobody debug_level = 0 max_udp_msg_len = 1472 mute = no deaf = no allow_extra_data = yes host_dmax = 86400 /*secs. Expires (removes from web interface) hosts in 1 day */ host_tmax = 20 /*secs */ cleanup_threshold = 300 /*secs */ gexec = no # By default gmond will use reverse DNS resolution when displaying your hostname # Uncommeting following value will override that value. # override_hostname = "mywebserver.domain.com" # If you are not using multicast this value should be set to something other than 0. # Otherwise if you restart aggregator gmond you will get empty graphs. 60 seconds is reasonable send_metadata_interval = 0 /*secs */ } cluster { name = "test1" ####需要修改与服务器端设定相同的名字 ### owner = "nobody" ###修改为nobody latlong = "unspecified" url = "unspecified" } host { location = "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 ##与设定的要一样哦 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 } /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ tcp_accept_channel { port = 8649 # If you want to gzip XML output gzip_output = no }启动客户端
客户端也可以使用debug来调试配置是否错误。
/usr/local/ganglia/sbin/gmond-d5
服务gmond启动
下面介绍第二种分布式监控系统。
2.分布式监控
主gmetad多个次级gmetad监控点
|-gmond
_gmetad-|-gmond
||-gmond
|
gmetad-|_gmetad-|-gmond
|||-gmond
||__gmetad-|-gmond
||-gmond
|_gmond
|-gmond
从表面可以看到多个gmetad点和多个gmond点。
主要从二级节点配置:
下面对次节点配置如下 gmetad.conf 配置如下: data_source "test2" localhost ip/hostname gmond.conf配置文件如下: cluster { name = "test2" owner = "nobody" latlong = "unspecified" url = "unspecified" } host { location = "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 = 172.16.1.4 ####次节点的ip地址。也就次节点自己的ip地址 port = 8649 } udp_recv_channel { port = 8649 family = inet4 } /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ tcp_accept_channel { port = 8649 }次节点下的gmond节点配置与次节点下的gmond相同。直接复制一份到gmond就行了。
神经节的主要配置就说这么多。Ganglia的views功能还在研究中,但是添加这个视图比较麻烦。我配置了很久,只是在配置文件里添加了,在页面上没有成功添加,因为页面上没有添加查看功能。这是非常不愉快的。我在网上查了很多资料,只是在官网上找到了一些相关的电子文本。,,,,,希望路过的大牛能指点一下。谢谢大家!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)