How to install and configure ganglia gmod and ganglia gmetad

Sarath Pillai's picture
ganglia monitoring and graphing

Hi all...In the previous post Introduction to ganglia monitoring and graphing tool we had a look at how ganglia monitoring tool works. As mentioned in that post We require 2 seperate machines to test the installation(however you can test it using a single machine by making that machine installed with both gmond and gmetad and also serve it through apache and php in that same machine). In this example configuration we will be using 2 seperate machines.

Machine 1:

Hostname: slashroot1.slashroot.in

Installation: gmond

Operating System: Red Hat Enterprise Linux 5

Node Type: client Node

Machine 2:

Hostname: slashroot2.slashroot.in

Installation: gmond & gmetad

Operating System: Red Hat Enterprise Linux 5

Node Type: Server Node

 

Note: We will be configuring ganglia gmond and gmetad with unicast.

How to install ganglia gmond on client node

First of all lets setup our client node ie. Machine 1(slashroot1.slashroot.in). This will act as a client who will fetch its own metrics related data, and submit to gmond on another server.

The first step in setting up a ganglia client node is to install the package for that operating system. If you are using package manager then its quite easy to setup gmond on the client node. I recommend enabling rpmforge yum repo before going ahead with installation.

You can download the rpmforge yum repo package for centos5/rhel5 from here rpmforge for i386 and rpmforge for x86_64.

After enabling the rpmforge repo its very easy to install the package "ganglia-gmond".

[root@myvm1 ~]# yum install ganglia-gmond

the above command will do the following things.

  1. this will install the gmond binary. this binary is located /usr/sbin/gmond
  2. You can create the default gmond configuration file with gmond binary.
  3. This will also install the gmond daemon which will continuously collect metrics from the machine.

You can easily create the default configuration option with gmond binary as follows.

[root@myvm1 ~]# gmond -t > /etc/gmond.conf

Lets give our cluster the name "slashroot.in" and make this slashroot1.slashroot.in a member of the cluster.

this can be done by editing the gmond.conf file as follows.

Please note that we have not changed anything excpet the cluster name in the gmond.conf file, everything else is kept intact as it is.

Now there must be something in this gmond.cof file which will tell this gmond to send its metric data to our collector server gmond (slashroot2.slashroot.in). So we need to have the below entries in gmond.conf file.

udp_send_channel { 

host = slashroot2.slashroot.in 

port = 8649  

ttl = 1 }

Now we need to restart the gmond service as follows

 

[root@myvm1 ~]# /etc/init.d/gmond restart
Shutting down GANGLIA gmond:                               [  OK  ]
Starting GANGLIA gmond:                                    [  OK  ]
[root@myvm1 ~]#

the gmond command options can be found by using the below command.

[root@slashroot1 ~]# gmond --help
 

Now if you want to make a number of systems part of the slashroot.in cluster you need to do just the same as we did for slashroot1.slashroot.in in the above case.

How to install ganglia gmetad on the server node

Now If you want the server node also to submit different metrics and is also a part of the cluster, then in that case you should also install gmond on the server node. That can be done exactly the same way as shown above.

Lets install gmetad the collector(the one who makes and graphs) on the server node.

Before installing gmetad we need to install rrdtool as a dependency for gmetad. Lets first install rrdtool and then will go ahead with gmetad.

While installing rrdtool you might encounter a dependency error as follows.

Error: Missing Dependency: libdbi.so.0 is needed by package rrdtool-1.4.7-1.el5.rf.i386 (rpmforge)

which says that you need a library file called libdbi.so.0 for rrdtool. To solve that error you need to install a package called "libdbi" as shown below.

[root@slashroot1 ~]# rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/libdbi-0.8.1-2.1.i386.rpm
 

the gmetad installation also requires ruby support for rrdtool package,(so ensure that you have ruby and ruby-libs installed before doing ganglia-gmetad installation through yum from rpmforge).

Installing ganglia-gmetad directly through yum also fetches the following packages, and installs rrdtool directly(ensure you have rpmforge and epel repo enabled for your distribution)

[root@myvm1 ~]# yum install ganglia-gmetad

Now after installing gmetad, lets configure the gmetad config file located in /etc/ganglia/gmetad.conf.

we will edit the following line in the gmetad.conf file as shown below.

data_source "slashroot.in" localhost

this line tells which clusters data should be collected from which source(gmond). In ourcase we can take it from localhost because slashroot1.slashroot.in and slashroot2.slashroot.in both submit gmond metric data to the gmond on this machine(slashroot2.slashroot.in).

if no port is supplied after data_source "slashroot.in" localhost then it assumes the port to be 8649, the default port of gmond.

Note: Atleast one data source is necessary for gmetad to start.

not that we have only added "slashroot.in" in that line.

We will be configuring gmond also on this machine, along with gmetad, and this gmond will collect the data from gmond installed on slashroot1.slashroot.in.Also this gmond will collect the metrics from the slashroot2.slashroot.in machine.

configuring gmond on this machine is very much necessary because we configured localhost as the data_source in gmetad.conf (so gmetad will go to localhost port 8649 for the collected XML data from both slashroot1.slashroot.in and slashroot2.slashroot.in).

this gmond will be the reciever of the metrics from slashroot1.slashroot.in. So this the gmond.conf should contain the arguments below.

udp_recv_channel {
  port = 8649
}

tcp_accept_channel {
  port = 8649
}

UDP recieve and TCP accept options will only be there on the gmond which is recieving data from other gmonds. All other options of this gmond will be same as the gmond.conf of slashroot1.slashroot.in

The UDP send channel will be same here because this gmond will also send the metrics to itself.

udp_send_channel { 

host = slashroot2.slashroot.in 

port = 8649  

ttl = 1 }

Now you can confirm whether you are getting the data from slashroot1.slashroot.in by telneting to the 8649 port on slashroot2.slashroot.in

as you can see we are getting the data from slashroot1.slashroot.in at slashroot2.slashroot.in.

Now the final step is to install the ganglia-web package.

 

How to install ganglia-web on server node.

Installing ganglia web is an easy task, which by default creates all the config files for the web front end.

[root@myvm1 ~]# yum install ganglia-web

ensure that you have php,php-common, and php-gd packages installed on your machine.

Once ganglia-web is installed, we just need to move the /var/www/html/ganglia to the desired folder of your web home directory and change the permission of the directory to the apache user.

chown -R apache.apache /var/www/html/ganglia

I have used apache user because my httpd.conf contained User and Group as apache(confirm the user you have for your apache).

Now you can open the ganglia web interface by using the URL http://yourgmetadhostIP/ganglia

IN our case it is http://slashroot2.slashroot.in/ganglia

 

Graph samples of from our newly created slashroot.in cluster

Things to note about ganglia custer graphing

  • All machines that are part of the cluster, and needs to be monitored must have gmond installed.
  • At least one machine in the cluster must have Udp recieve,tcp accept arguments in its gmond.conf file so as to collect data from other gmond nodes.
  • The gmetad must have all the source of a cluster from where it will fetch xml data. the collector gmond of a cluster must be specified as the data source in the gmetad.conf.

On the next post i will be explaining some more internal concepts of ganglia..Hope the post was useful...Doubts,suggetions are welcome through comments.

Rate this article: 
Average: 2.4 (125 votes)

Comments

Hi Sarath,

Thanks for the blog it amazing .. u saved my 4 hours of work thanks lot it worked for me

Thanks for the post very helpfull.. only like to add the permission issues ( "Forbidden error") for httpd if anyone runs into it during invoking the ganglia web page:
Modify the allow from <> and then restart the httpd service.

/etc/httpd/conf.d/ganglia.conf

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.