Ganglia is an open source software for monitoring servers and clusters. It can use graphs to show the cpu load, memory, network, hard disk and other indicators of the server or cluster in the last hour, the last day, the last week, the last month, and the last year.
The power of Ganglia lies in the fact that the ganglia server can collect the data of all clients on the same network segment through one client, and the ganglia cluster server can collect all the data of its subordinate clients through one server. This architectural design means that a server can manage tens of thousands of machines through different layers. This function is unmatched by other mrtg, nagios and cacti.
Ganglia's extension plug-ins are very easy to write, no matter what language (shell, php, pyton) is used to write, as long as the final result is passed to gmetric, so that the corresponding data can be seen on the web.
0. Prepare
The latest version of ganglia is 3.2.0, but I recommend installing ganglia3.0.3, because this version is relatively easy to install, and the dependency package is only rrdtool. And the new version depends on too many packages.
Official website: http://ganglia.info
The download address of ganglia is http://sourceforge.net/projects/ganglia
Windows client version and ganglia source package for windows:
:http://www.sajinet.com.pe/ganglia/
http://sourceforge.net/project/showfiles.php?group_id=43021&package_id=35280
The installation of ganglia is divided into server side and client side and web side installation
Documentation Help: http://ganglia.sourceforge.net/docs/
1) Server dependency package
gmetad in Ganglia
Rrdtool (this depends on many packages, ganglia is not sensitive to the version of rrdtool, it is best to choose a better version to install)
2) Client
gmond in ganglia
3) Web side:
Apache, php, rrdtool, php-gd (you don't need to install it, if you don't install it, you just can't see a pie chart, it doesn't affect the use)
1. Server installation (gmetad)
The service of the server is gmetad. Before installation, you need to install RRDTool (database and drawing tool, the client information collected by the server is saved by it), because you want to draw a curve graph, so before installing RRDTool, you must also install libpng, freetype, zlib these libraries (also required by php's gd library), download address http://www.rrdtool.org/ .
After installing RRDTool, you can install gmetad
Click (here) to collapse or open
tar –zxvf ganglia3.0.3.tar.gz
cd ganglia3.0.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-gexec
make
make install
Copy the gmetad.init file to /etc/init.d/:
Click (here) to collapse or open
cd ganglia-3.0.3/gmetad
cp gmetad.init /etc/init.d/gmetad #If ganglia is installed in another directory, modify the gmetad path in gmetad.init
cp gmetad.conf /etc/gmetad.conf
chkconfig gmetad on
chkconfig --list gmetad
GMETAD 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Create a folder for rrd data storage, modify the property owner to: "nobody":
Click (here) to collapse or open
mkdir /var/lib/ganglia/rrds
chown nobody:nobody /var/lib/ganglia/rrds
Start gmetad:
Click (here) to collapse or open
service gmetad start
Starting GANGLIA gmetad: [ OK ]
Modify the /etc/gmetad.conf file:
Click (here) to collapse or open
data_source "taskcenter" 1.2.3.4 #The client to be monitored can write multiple
setuid_username "root" #Can be changed to other security users
# default: "/var/lib/ganglia/rrds" #Define the path where the client's data is saved
# rrd_rootdir "/some/other/place"
rrd_rootdir "/var/lib/ganglia/rrds"
Restart gmetad:
Click (here) to collapse or open
service gmetad start
Starting GANGLIA gmetad: [ OK ]
Verify that gmetad is working correctly:
Click (here) to collapse or open
telnet localhost 8651
You can get the status of each monitored host.
2. Install client gmond2.1 linux version
On each machine that needs to be monitored, install gmond
Install ganglia:
Click (here) to collapse or open
tar zxvf ganglia-3.0.3.tar.gz
cd ganglia-3.0.3
./configure --prefix=/usr/local/ganglia
make;
make install
cd gmond
./gmond –t > /etc/gmond.conf
Click (here) to collapse or open
vi gmond.init
Modify the GMOND inside to GMOND=/usr/local/ganglia/sbin/gmond
# cp gmond.init /etc/init.d/gmond
# chkconfig --add gmond
# chkconfig --list gmond
gmond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# service gmond start
Starting GANGLIA gmond: [ OK ] #If unsuccessful, start manually with /usr/local/ganglia/sbin/gmond
The failure to start may be because the multicast address is not routed
Click (here) to collapse or open
route add -host 239.2.11.71 dev eth0
Verify that gmond is working properly:
Click (here) to collapse or open
telnet localhost 8649
You can get information about the hosts running gmond in the cluster
vi /etc/gmond.conf
Configure gmond.conf:
Click (here) to collapse or open
/etc/gmond.conf:
globals
{
setuid = no
user = nobody
cleanup_threshold = 300 /*secs */
}
#Modify the monitoring group name
cluster
{
name = "taskcenter"
.......}
Restart gmond after configuration is complete
2.2 window version
Download: http://www.sajinet.com.pe/ganglia/ganglia-3.1.0-bin.zip
After unzipping, run gmond.bat
Test: telnet 127.0.0.1 8649
Installation self-starting: add gmond.bat to the startup item
3. Web installation
The web terminal is used to view the monitoring status through the web.
Because the web-side program is written in php, apache needs to be installed. At the same time, you need to compile the gd library of php. The web side needs to be integrated with the server side.
# cp -a ganglia-3.0.3 / web / var / www / html / ganglia
Make sure the web server supports PHP4
For apache, the status of the php module mod_php should be enabled, which seems to be the default ^_^
The configuration file is /var/www/html/ganglia/conf.php
Click (here) to collapse or open
# Where gmetad stores the rrd archives.
$gmetad_root = "/var/lib/ganglia";
$rrds = "/usr/local/rrdtool-1.0.50/"; #Data source path
# Leave this alone if rrdtool is installed in $gmetad_root,
# otherwise, change it if it is installed elsewhere (like /usr/bin)
define("RRDTOOL", "/usr/local/rrdtool-1.0.50/bin/rrdtool"); # rrdtool执行路径
#
# If you want to grab data from a different ganglia source specify it here.
# Although, it would be strange to alter the IP since the Round-Robin
# databases need to be local to be read.
#
$ganglia_ip = "localhost";
$ganglia_port = 8652;
#$ganglia_port = 8649;
Enter http://localhost/ganglia/ in the browser address bar and you should see a page displayed.
Demo address Berkeley's cluster monitoring (1000+ servers):
http://monitor.millennium.berkeley.edu/
The reasons why the picture cannot be drawn when visiting the web:
1) rrdtool is not installed, or not configured in conf.php
2) gemtad is not started
3) No client data
4) Selinux restricts apache to execute rrdtool
In addition, ganglia has many plugins to monitor more indicators
There is a plug-in, after installation, you can view the graph at any time
Reprinted from: