Installing Ganglia…the nuts and bolts!

Ganglia

Since my project involves ganglia i have had to install it on my machine (RHEL). I searched online to find an easy way of doing it but couldn’t find step by step instructions that would do it without assuming i had sudo access. So i thought i would put something out there. If you think i could have done something simpler please do let me know.

Now before I scare anyone there is a very simple way to install ganglia so that you can have monitoring up and running for you cluster. The following is a very simple tutorial that you can follow to do a simple “yum install”. I however want to play with the code of ganglia and thus want to be able to compile it and change it and thus this did not work for me.

Abracadabra

For Simple Install and deployment check out:
The simple way to install
# yum install rrdtool ganglia ganglia-gmetad ganglia-gmond ganglia-web httpd php
For further instuctions please visit the above mentioned blog (idolinux.blogspot.com). I really don’t want to copy his entire post.
Anyway since we wish to compile ganglia more work needs to be done rather than using the magic of yum!

Step 1: Download Ganglia

Ganglia can be downloaded from: http://ganglia.info/?page_id=66
I downloaded version 3.1.2
Once you have it downloaded unzip the files

Step 2: We need to get all the dependencies installed.

Ganglia has a bunch of dependencies so take a deep breath and start installing!

1. Round-Robin Database Tool (http://www.rrdtool.org)

Once you have downloaded the files for RRD we begin to install that.
Run the configure script. If it says permission denied as it did for me you need to set permissoins
To set execute permission
# chmod u+x configure
Since we do not have root permissions we need to set the path
# ./configure --prefix=/net/hu20/mchaudar/gInstall/rrdtool
# make install
Now that we have rrdtool installed we continue

2. LibConfuse (http://www.nongnu.org/confuse/)

Download the source from the above mentioned website
# ./configure --prefix=/net/hu20/mchaudar/gInstall/libconfuse
# make install
My LibConfuse installation was giving me problems and i was getting the following error while compiling ganglia
/usr/bin/ld: /net/hu20/mchaudar/gInstall/libconfuse/lib/libconfuse.a(confuse.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/net/hu20/mchaudar/gInstall/libconfuse/lib/libconfuse.a: could not read symbols: Bad value
So i tried recompiling libconfuse with the following
# ./configure --prefix=/net/hu20/mchaudar/gInstall/libconfuse --with-pic
# make install
Done with libconfuse!

3. The Expat XML Parser (http://expat.sourceforge.net/)

Download the source and run the following
# ./configure --prefix=/net/hu20/mchaudar/gInstall/libexpat
# make install

4. Apache Portable Runtime (APR)  or libapr (http://apr.apache.org/)

# ./configure --prefix=/net/hu20/mchaudar/gInstall/libapr
# make install
I ran into some problems with this and got an error releated to libtool.
To fix this i used the following configure command
# ./configure --prefix=/net/hu20/mchaudar/gInstall/libapr --with-pic --with-installbuilddir=/net/hu20/mchaudar/gInstall/libaprbuild
# make install
I dont remember now if this was required or not, but i installed it anyway. I suspect its not necessary so you can skip installing apr-util.

5. apr-util

# ./configure --prefix=/net/hu20/mchaudar/gInstall/apr-util --with-apr=/net/hu20/mchaudar/gInstall/libapr
# make install

Step 3 Preparing Ganglia for install

Since we have all the dependencies installed for ganglia we can no proceed to run the configure script.

#. ./configure --prefix=/net/hu20/mchaudar/gInstall/ganglia --with-gmetad --with-librrd=/net/hu20/mchaudar/gInstall/rrdtool --with-libconfuse=/net/hu20/mchaudar/gInstall/libconfuse --with-libexpat=/net/hu20/mchaudar/gInstall/libexpat --with-libapr=/net/hu20/mchaudar/gInstall/libapr
# make install
The above was giving me errors while running make. It could not find apr header files. After looking into it i realized that the libapr include files were not in the include folder as the make was expecting them to be, but instead they were in a sub folder called apr-1. I had to copy these files out to the include folder.
This time the make worked fine!

Step 4 Running Ganglia

When i tried to run gmond it could not find its conf file as it was looking in the wrong place.
To generate a default configuration file i used the following command:
# ./gmond --default_config > gmond.conf
To run gmond with that config file
# ./gmond -c gmond.conf

Now when i tried to run gmond it seemed like it crashed, i confirmed it by setting a debug flag and i saw the following output.

[mchaudar@alonso sbin]$ ./gmond -c gmond.conf -d 3
loaded module: core_metrics
loaded module: cpu_module
loaded module: disk_module
loaded module: load_module
loaded module: mem_module
loaded module: net_module
loaded module: proc_module
loaded module: sys_module
Must be root to setuid to "nobody"
So i went into the configuration file gmond.conf to try and fix it.
globals {
daemonize = yes
setuid = yes
user = mchaudar
debug_level = 0
max_udp_msg_len = 1472
mute = no
deaf = no
allow_extra_data = yes
host_dmax = 0 /*secs */
cleanup_threshold = 300 /*secs */
gexec = no
send_metadata_interval = 0
}
I changed the user from nobody to myself. and now gmond was running fine. To check if its working fine, do a
# telnet localhost 8649
and you should get a dump of the xml generated by gmond.
To get the configuration file for gmetad look in the gmetad folder present in the source folder. There should be a gmetad.conf file present.
I was getting the setuid error again so i had to change the following in the configuration file.
#-------------------------------------------------------------------------------
# If you don't want gmetad to setuid then set this to off
# default: on
setuid off
#
#-------------------------------------------------------------------------------
# User gmetad will setuid to (defaults to "nobody")
# default: "nobody"
setuid_username "mchaudar"
#
#-------------------------------------------------------------------------------
Also by default gmetad saves the rrds data in /var/lib/ganglia/rrds, since i did not have write permission there i had to chage the following.
#-------------------------------------------------------------------------------
# Where gmetad stores its round-robin databases
# default: "/var/lib/ganglia/rrds"
rrd_rootdir "/net/hu20/mchaudar/gInstall/ganglia/rrds"
Finally i have both gmond and gmetad running on my machine and i did not need sudo access!
Feel free to give comments and suggestions to make the whole experience easier. The whole motivation behind the post and the entire blog is to document the problems i face so that others can benefit from my experience and not have to bang their heads on the desk!
Ganglia documentation was of great help. If you have problems consult that :
Advertisements

3 thoughts on “Installing Ganglia…the nuts and bolts!

  1. Another important matter I would like to comment on. The gmond version on the compute node and the head node has to be the same for the ganglia monitor to show all the nodes properly.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s