Compile Latest Ganglia for All Versions of Debian and Ubuntu

I have learned a lot since I wrote the original how-to. I do not have time to write a nice story but follow the steps below and you should be fine. This will provide you with the latest version of Ganglia on any Debian based distro.

Objectives:
1. Download latest sources from Ganglia git repository.
2. Compile, install and setup monitor-core.
3. Setup ganglia-web front-end.
4. Setup hsflowd on servers.

On your collector / PHP enabled web-server:

apt-get install build-essential automake autoconf pkg-config gperf libtool rrdtool librrd-dev libconfuse-dev libapr1-dev libpcre3-dev

cd ~
git clone https://github.com/ganglia/monitor-core.git ganglia
cd ganglia
git submodule init
git submodule update

./bootstrap

Update February 1, 2014: You need to install Concurrency Kit before running configure or it will fail.
Instructions:

"git clone http://concurrencykit.org/cgit/cgit.cgi/ck/"; "cd ck"; "./configure"; "make"; "make install"

and then switch back to your ganglia directory and continue.

./configure --with-gmetad
make
make install
ln -s /usr/local/lib64/ganglia /usr/lib/ganglia
useradd --system ganglia
groupadd --system ganglia

nano /etc/ld.so.conf
add line: /usr/local/lib

ldconfig

nano /usr/local/etc/gmetad.conf
change: data_source "your cluster name" 20 localhost
cp ~/ganglia/debian/gmond.conf /usr/local/etc/gmond.conf
nano /usr/local/etc/gmond.conf
change: mute = yes
change: name = "your cluster name"
change:
udp_send_channel {
  port = 8649
  ttl = 1
}
udp_recv_channel {
   port = 8649
}
sflow {
  udp_port = 8649
  accept_vm_metrics = yes
}
tcp_accept_channel {
  port = 8649
}

cd /var/www
git clone https://github.com/ganglia/ganglia-web.git ganglia
cd ganglia
mkdir dwoo/compiled
mkdir dwoo/cache
mkdir -p /var/lib/ganglia/rrds
chown nobody /var/lib/ganglia/rrds
chown -R www-data:www-data /var/www/ganglia
cp conf_default.php.in conf_default.php
cp version.php.in version.php
nano conf_default.php
change: $conf['gweb_confdir'] = "/var/www/ganglia";
change: $conf['gmetad_root'] = "/var/lib/ganglia";

gmond
gmetad

On servers you want to monitor:

apt-get install hsflowd

Note: This package does not appear to be included anymore. Visit their website.

nano /etc/hsflowd.conf
change: DNSSD = off
change: polling = 20
change: sampling = 2000
change:
collector {
ip = (IP running gmond+gmetad)
udpport = 8649
}

/etc/init.d/hsflowd start

Visit your webserver to see your graphs. DONE!

NOTE: There is a mistake in stacked.php as of January 16, 2013 which causes the graph to break. The exact error is: “PHP Parse error: syntax error, unexpected T_FOREACH in /var/www/ganglia/stacked.php”

To fix, search for “$min_index = min(array_keys($hosts))” and add a semi-colon to the end of the line:

nano /var/www/ganglia/stacked.php
change: $min_index = min(array_keys($hosts));

EDIT (8/5/2013): I recently read this article and decided to set my sampling rate to 2000. I was occasionally getting errors where my network speed was being measured in petabytes/s! Here is a second article about the same topic that is also worth a quick read.

Leave a Reply

Your email address will not be published. Required fields are marked *