Ganglia is a monitoring server, cluster of open source software, can be used to graph the last one hours, the most recent day, last week, the last January, the last year of the server or cluster CPU load, memory, network, hard disk and other indicators.
The power of ganglia is that the ganglia server is able to collect data from all clients on the same network segment through a client, ganglia the cluster server can collect all client data from its subordinates through a single server. This system is designed to indicate that a single server can manage tens of thousands of machines through different tiers. This feature is unmatched by other mrtg,nagios,cacti.
Ganglia's extension is very good to write, regardless of the language (Shell,php,pyton) can be written, as long as the final result is passed to gmetric, so that the web can see the corresponding data.
0. Preparation
The latest ganglia version is 3.2.0, but I recommend installing ganglia3.0.3 because this version installs relatively simple and relies on packages that are only rrdtool. And the new version relies on too many packages.
Official website:Http://ganglia.info
Ganglia's Http://sourceforge.net/projects/ganglia
Windows Client Edition and ganglia source packages:
http://www.sajinet.com.pe/ganglia/
http://sourceforge.net/project/showfiles.php?group_id=43021&package_id=35280
Ganglia installation is divided into server-side and client-side and web-end installations
Document Help: Http://ganglia.sourceforge.net/docs/
1) service-side dependency package
The Gmetad in ganglia.
Rrdtool (This depends on a lot of packages, ganglia for Rrdtool version is not sensitive, it is best to choose a better installation version installed)
2) Client
The Gmond in ganglia.
3) Web-side:
APACHE,PHP,RRDTOOL,PHP-GD (can not be installed, do not have to see a pie chart, do not affect the use of)
1. server-side installation (Gmetad)
Service side of the service is Gmetad, before installation needs to install RRDtool (database and drawing tools, the server collects client information from it to save), because to draw the graph, so before installing RRDtool, you must also install the Libpng,freetype, Zlib These libraries (also required by the GD Library of PHP),http://www.rrdtool.org/ .
After installing RRDtool, you can install Gmetad.
1 tar–zxvf ganglia3. 0.3 . tar.gz 2 cd ganglia3. 0.3 3 ./configure cflags="-i/usr/local/rrdtool-1.0.50/include" cppflags= " -i/usr/local/rrdtool-1.0.50/include" ldflags="-l/usr/local/ Rrdtool-1.0.50/lib" --with-gmetad--enable-gexec4make5 make Install
Copy the Gmetad.init file to /etc/init.d/:
3.0 . 3 /gmetad 2 CP gmetad.init/etc/ Init.d/gmetad #若是ganglia安装在别的目录, modify the Gmetad path in gmetad.init 3 cp gmetad.conf/etc/gmetad.conf 4 chkconfig Gmetad on 5 chkconfig-- list Gmetad 6 Gmetad 0 : Off 1 : Off 2 : On 3 : On 4 : On 5 : On 6 : Off
Create a folder for the RRD data store, modify the property owner as: "Nobody":
1 mkdir/var/lib/ganglia/rrds 2 chown nobody:nobody/var/lib/ Ganglia/rrds
Start Gmetad:
1 service Gmetad start 2 starting GANGLIA Gmetad: [OK]
To modify the/etc/gmetad.conf file:
1Data_source"Taskcenter" 1.2.3.4#所要监控的客户端 can write multiple2Setuid_username"Root"#可改为其他安全用户3#default:"/var/lib/ganglia/rrds"#定义该客户端的数据保存的路径4# Rrd_rootdir"/some/other/place"5Rrd_rootdir"/var/lib/ganglia/rrds"
Restart Gmetad:
1 service Gmetad start 2 starting GANGLIA Gmetad: [OK]
Verify that the Gmetad is working correctly:
1 telnet localhost 8651
The status of each host that can be monitored.
2. Install the client gmond2.1 Linux Edition
Install the Gmond on each machine that needs to be monitored
Install Ganglia:
1 tar zxvf ganglia-3.0. 3 . tar.gz 2 CD ganglia-3.0. 3 3 ./configure--prefix=/usr/local/Ganglia4make; 5 Make Install 6 CD Gmond 7 ./gmond–t >/etc/gmond.conf
1 VI gmond.init2Change the inside Gmond to gmond=/usr/local/ganglia/sbin/Gmond3# CP Gmond.init/etc/init.d/Gmond4# Chkconfig--Add Gmond5# Chkconfig--List Gmond6Gmond0: Off1: Off2: On3: On4: On5: On6: Off7 # service Gmond start8Starting GANGLIA Gmond: [OK] #若不成功的话, start manually with/usr/local/ganglia/sbin/gmond
Startup failure is possible because multicast addresses are not routed
1 Route add-host 239.2. 11.71 Dev eth0
Verify that the Gmond is working correctly:
1 telnet localhost 8649
You can get information about the hosts running Gmond in the cluster
Vi/etc/gmond.conf
Configuration gmond.conf:
1/etc/gmond.conf:2 Globals3 {4Setuid =No5user =Nobody6Cleanup_threshold = - /*secs*/7 }8 #修改监控组名称9 ClusterTen { OneName ="Taskcenter" A.......}
Restart Gmond after configuration is complete
2.2 Window version
Download:http://www.sajinet.com.pe/ganglia/ganglia-3.1.0-bin.zip
After decompression, run Gmond.bat
Test: Telnet 127.0.0.1 8649
Install from boot: Add Gmond.bat to the startup item
3.web -End Installation
The web side is used to view the monitoring status through the Web.
Because the web-side program is written by PHP, you need to install Apache. Also need to compile the PHP GD library. Web side needs and server side in one piece.
# cp-a Ganglia-3.0.3/web/var/www/html/ganglia
Determine Web server support PHP4
For Apache, PHP module mod_php status should be enabled, seemingly default is the ^_^
The configuration file is/var/www/html/ganglia/conf.php
1 # Where Gmetad stores the RRD archives.2$gmetad _root ="/var/lib/ganglia";3$rrds ="/usr/local/rrdtool-1.0.50/"; #数据源路径4# Leave ThisAloneifRRDtool isInstalledinch$gmetad _root,5# Otherwise, change itifIt isInstalled elsewhere (like/usr/bin)6Define"RRDTOOL","/usr/local/rrdtool-1.0.50/bin/rrdtool"); # RRDtool Execution Path7 #8# If you want to grab data froma different ganglia source specify it here.9# Although, it would is strange to alter the IP since the round-RobinTen # Databases need to is local to be read. One # A$ganglia _ip ="localhost"; -$ganglia _port =8652; -# $ganglia _port =8649;
Enter http://localhost/ganglia/in the browser address bar should be able to see a page display.
Demo address cluster Monitoring at the University of Berkeley (1000 + servers):
http://monitor.millennium.berkeley.edu/
The reason why a picture can't be seen on the Web:
1) RRDtool not installed, or not configured in conf.php
2) Gemtad not started
3) No client data
4) SELinux limits Apache execution RRDtool
In addition, ganglia also has many plugins to monitor more indicators
There is a plug-in that can be viewed at any time after installation of the graph
Open source monitoring software Ganglia installation manual