Tuesday, July 27, 2010

Ganglia - Basic installation and configuration guide

After playing around, with both Zabbix and Ganglia, I decided to go ahead with Ganglia. The installation is tricky but once it is installed, configuring and adding hosts is easy. Here I will discuss, installation and configuration of Ganglia. Both the client and server daemon will be installed on the same machine.


Ganglia is a monitoring system for high-performance computing systems. Ganglia comprises of two daemons. The daemon gmond, acts like a client and sends machine information( as xml fomat), to daemon gmetad which stores these statistics in a round robin database.


A PHP-based web frontend is used to dispay the graphs in near real time.
Before starting Ganglia a few dependencies are required to be installed.

# tcsh
# setenv INSTALL_DIR /opt/rrdtool-1.4.4
# setenv BUILD_DIR /opt/build/rrdbuild
# cd $BUILD_DIR  
# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.4.tar.gz 
# gunzip -c rrdtool-1.4.4.tar.gz | tar xf – # cd rrdtool-1.4.4
# ./configure --prefix=$INSTALL_DIR && make && make install
This would have installed round robin database. It is required only on the head node. The head node (server) would be the one where you want to install gmetad daemon.
Another dependency required for Ganglia is libconfuse.


# cd /opt/build
# wget http://bzero.se/confuse/confuse-2.6.tar.gz
# /bin/tar -xzf confuse-2.6.tar.gz
# cd confuse-2.6
# ./configure --prefix=/opt/ganglia
# env CFLAGS="-O3 -fPIC" ./configure --prefix=/opt/ganglia
# make
# make install


Now we download Ganglia source package and begin installation.

# cd /opt/build/ 
# wget http://sourceforge.net/projects/ganglia/files/ganglia%20monitoring%20core/3.1.7/ganglia-3.1.7.tar.gz/download 
# tar -xzf ganglia-3.1.7.tar.gz 
# cd ganglia-3.1.7  
# setenv CFLAGS "-I/opt/ganglia/include/ -I/opt/rrdtool-1.4.4/include"  
# setenv LDFLAGS "-L/opt/ganglia/lib/ -L/opt/rrdtool-1.4.4/lib"  
# ./configure --prefix=/opt/ganglia --with-gmetad --sysconfdir=/etc/ganglia  
# make  
# make install
Make sure the permissions are appropriate on path /opt/ganglia/rrds. This is the path where I have my round robin database.
# cd /opt/ganglia/sbin/
# ./gmond --default-config > gmond.conf
# ./gmetad --default-config > gmetad.conf


Setup config files for gmetad and gmond.conf
# vi gmond.conf

Set up your udp_send_channel to look like this:
 udp_send_channel {
  host = masterhostname
  port = 8650
  ttl = 1
}

# vi gmetad.conf

Modify directives as:
data_source "MyCluster" localhost
rrd_rootdir "/opt/ganglia/rrds"
# cp gmond.conf /etc/ganglia/.
# cp gmetad.conf /etc/ganglia/.
# cd $BUILD_DIR
# cp gmond/gmond.init /etc/rc.d/init.d/gmond
# vi /etc/rc.d/init.d/gmond
Set this variable as
GMOND=/opt/ganglia/sbin/gmond


Optional (this would enable running the daemons as an automated service) :
# chkconfig --add gmond
# chkconfig --list gmond
gmond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# /etc/rc.d/init.d/gmond start
Starting GANGLIA gmond: [ OK ]
# cd /opt/build/ganglia-3.1.7/gmetad
# cp gmetad.init /etc/rc.d/init.d/gmetad
# vi /etc/rc.d/init.d/gmetad


GMETAD=/opt/ganglia/sbin/gmetad


# chkconfig --add gmetad
# chkconfig --list gmetad
gmetad 0:off 1:off 2:on 3:on 4:on 5:on 6:off


# /etc/rc.d/init.d/gmetad start
Starting GANGLIA gmetad: [ OK ]
Edit httpd.conf


Add the following lines if they are not a part of your config file.
LoadModule php5_module modules/libphp5.so

Edit DirectoryIndex like
DirectoryIndex index.html index.html.var index.php
Addtype application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Copy “web” folder to httpd document root location


Edit conf.php in web folder:
define("RRDTOOL", "/opt/rrdtool-1.4.4/bin/rrdtool");


RRDTOOL should point to rrdtool path


# /sbin/service httpd restart


You can point your browser to the web front end location and it should display you the graphs.

4 comments:

Gavin W. Burris said...

Thanks for the info. Wouldn't you rather use a packaged version? That way you don't have to worry about building updates. Cheers.

Harpreet said...

I have preference for compiling the source :) and building it piece by piece. Just beginning to learn things in the unix world :)

Anonymous said...

hi,

the below links might provide more information on working and configuration on ganglia.
http://slashroot.in/introduction-ganglia-monitoring-and-graphing-tool
http://slashroot.in/how-install-and-configure-ganglia-gmod-and-ganglia-gmetad

Jerry Winsten said...

Can You Please Provide Installation Instructions for Windows Operating System.?