Ganglia:分布式监控系统

Ganglia:分布式监控系统

Ganglia的核心包含gmond、gmetad以及一个Web前端。主要是用来监控系统性能,如:cpu 、mem、硬盘利用率, I/O负载、网络流量情况等,,通过曲线很容易见到每个节点的工作状态,对合理调整、分配系统资源,提高系统整体性能起到重要作用

Ganglia监控端安装

1、安装依赖的软件包

yuminstallntpvim-enhancedgccgcc-c++flexbisonautoconfautomakebzip2-develncurses-develzlib-devellibjpeg-devellibpng-devellibtiff-develfreetype-devellibXpm-develgettext-develpam-develpython-develperlperl-develexpatexpat-develpcrepcre-develaprapr-develcairo-devel和pango-devel

需要安装rrdtool工具 最新版本的ganglia已可以直接使用yum安装rrdtool工具即可,

2、安装confuse

wgettarzxfconfuse-2.7.tar.gzcdconfuse-2.7./configureCFLAGS=-fPIC–disable-nls;make;makeinstallcd..

3、安装ganglia

wget%20monitoring%20core/3.3.1/ganglia-3.3.1.tar.gztarzxfganglia-3.3.1.tar.gzcdganglia-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-libpcremakemakeinstallcdgmetadcpgmetad.conf/opt/modules/ganglia/etc/cpgmetad.init/etc/init.d/gmetadvim/etc/init.d/gmetad修改为GMETAD=/usr/local/ganglia/sbin/gmetadiprouteadd239.2.11.71deveth0##添加广播路由

Ganglia:被监控端安装:

1、安装依赖的软件包

yuminstallntpvim-enhancedgccgcc-c++flexbisonautoconfautomakebzip2-develncurses-develzlib-devellibjpeg-devellibpng-devellibtiff-develfreetype-devellibXpm-develgettext-develpam-develpython-develperlperl-develexpatexpat-develpcrepcre-develaprapr-develwgettarzxfconfuse-2.7.tar.gzcdconfuse-2.7./configureCFLAGS=-fPIC–disable-nls;make;makeinstallcd..

2、安装ganglia

wget%20monitoring%20core/3.3.1/ganglia-3.6.0.tar.gztarzxfganglia-3.6.0.tar.gzcdganglia-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-libpcremakemakeinstallcdgmond./gmond-t>/usr/local/ganglia/etc/gmond.confcpgmetad.init/etc/init.d/gmondvim/etc/init.d/gmond修改为:GMETAD=/usr/local/ganglia/sbin/gmondmkdir/usr/local/ganglia/lib64/ganglia/python_modulescppython_modules/*/*.py/usr/local/ganglia/lib64/ganglia/python_modulesiprouteadd239.2.11.71deveth0

安装已完成,过程简单。

Web网页页面在https://github.com/ganglia/ganglia-web

自行下载配置使用即可。

下面来监控,使其能正常工作和使用。

ganglia是分布式监控系统,也可以不使用分布来用。下面就分两种方式来解说。

1、不使用分布式来监控的方式

服务器配置文件修改两项:data_source”test1″192.168.107.2data_source”test2″172.16.1.4##这里分了两个监控组data_source是关键字,“test1,test2”是监控主机组的名字,全局要唯一。后面跟着要监控的ip或主机名,如果有多个可以用空格隔开就可以了gridname”Test”这个是定义监控集的名字,

如下所示:

现在ganglia还没有启动,在启动之前执行下面命令:

可以使用命令查看是不是有配置错误的地方导致启动不了

/usr/local/ganglia/sbin/gmetad -d 5

出错的地方应该可以修改配置文件gmetad.conf得到修正、

service gmetad start 来启动服务

好了,再看客户端的配置吧

在客户端配置globals{daemonize=yessetuid=yesuser=nobodydebug_level=0max_udp_msg_len=1472mute=nodeaf=noallow_extra_data=yeshost_dmax=86400/*secs.Expires(removesfromwebinterface)hostsin1day*/host_tmax=20/*secs*/cleanup_threshold=300/*secs*/gexec=no#BydefaultgmondwillusereverseDNSresolutionwhendisplayingyourhostname#Uncommetingfollowingvaluewilloverridethatvalue.#override_hostname=”mywebserver.domain.com”#Ifyouarenotusingmulticastthisvalueshouldbesettosomethingotherthan0.#Otherwiseifyourestartaggregatorgmondyouwillgetemptygraphs.60secondsisreasonablesend_metadata_interval=0/*secs*/}cluster{name=”test1″####需要修改与服务器端设定相同的名字###owner=”nobody”###修改为nobodylatlong=”unspecified”url=”unspecified”}host{location=”unspecified”}udp_send_channel{#bind_hostname=yes#Highlyrecommended,soontobedefault.#Thisoptiontellsgmondtouseasourceaddress#thatresolvestothemachine’shostname.Without#this,themetricsmayappeartocomefromany#interfaceandtheDNSnamesassociatedwith#thoseIPswillbeusedtocreatetheRRDs.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.71retry_bind=true#SizeoftheUDPbuffer.Ifyouarehandlinglotsofmetricsyoureally#shouldbumpituptoe.g.10MBorevenhigher.#buffer=10485760}/*Youcanspecifyasmanytcp_accept_channelsasyouliketoshareanxmldescriptionofthestateofthecluster*/tcp_accept_channel{port=8649#IfyouwanttogzipXMLoutputgzip_output=no}

启动客户端

在客户端也是可以使用debug来调试配置是不是有错

/usr/local/ganglia/sbin/gmond -d 5

service gmond start

下面来说第2种分布式监控系统

2、分布式监控

主gmetad 多个次gmetad 被监控点

|——gmond

_ gmetad—|——gmond

||——gmond

|

gmetad——-|_ gmetad—|——-gmond

| | |——gmond

| |__ gmetad—-|——gmond

| |——gmond

|_gmond

|-gmond

从面可以看到多个gmetad点和多个gmond点

依赖别人的人等于折断了自己的翅膀,永远也体会不到飞翔的快乐。

Ganglia:分布式监控系统

相关文章:

你感兴趣的文章:

标签云: