July 25, 2009
Ganglia is a set of daemons used for performance monitoring. It works on OSX,
but getting it running on that platform can be a bit touchy. Here’s the series
of steps which have worked for me recently.
Note : I’m writing this for those who already knows what Ganglia is, and want
to get it running on OSX. There are lots of other articles out
Ganglia, what it’s used for, and offering more detailed configuration
- Install Apple’s Developer Tools, so you have a compiler and other necessary stuff. This is on your OSX installation DVDs (with XCode), or you can download from http://developer.apple.com/Tools/.
- Install MacPorts from http://www.macports.org/.
Install Ganglia Dependencies
rrdtool is only needed by gmetad. If you are only building gmond, you don’t
bash sudo port install rrdtool libconfuse
- Download the source code from http://sourceforge.net/projects/ganglia/files/.
- Check on the status of this bug : http://bugzilla.ganglia.info/cgi-bin/bugzilla/show_bug.cgi?id=168. If it is still not resolved, you will need to patch libmetrics/darwin/metrics.c as instructed. (A patch file is described in the ticket. It’s simple.)
bash ./configure --with-gmetad LDFLAGS="-L/opt/local/lib -L/usr/X11R6/lib" CPPFLAGS="-I/opt/local/include -I/usr/X11R6/include" make sudo make install
- Set up the ganglia configuration directory.
bash sudo mkdir -p /etc/ganglia/conf.d
- Create a default gmond configuration file. Customize as desired.
bash sudo gmond -t > /etc/ganglia/gmond.conf
- Use the default gmetad config file. Customize as desired.
bash cd /your/ganglia/source/directory sudo cp gmetad/gmetad.conf /etc/ganglia
- Create default data directory for gmetad’s rrd files. If you locate these elsewhere, make sure to update gmetad.conf.
bash sudo mkdir -p /var/lib/ganglia/rrds sudo chown nobody /var/lib/ganglia/rrds
Configure Ganglia Web Frontend
- Enable PHP in Apache. It’s already installed. You just need to turn it on. http://www.php.net/manual/en/install.macosx.bundled.php
- Copy the Ganglia web frontend to an Apache-accessible directory. My user account is ‘alex’, so I used /Users/alex/Sites/ganglia, which is accessible at http://localhost/~alex/ganglia/.
bash cd /your/ganglia/source/directory cp -R web ~/Sites/ganglia
- In your new copy of the web code, edit conf.php and change this:
php define("RRDTOOL", "/usr/bin/rrdtool"); to
php define("RRDTOOL", "/opt/local/bin/rrdtool");
Starting It All Up
- I could use some help here. I have written init.d-style startup scripts on various Linux distros, but I’ve never gotten familiar with launchd. My uses for Ganglia on OSX are purely for development and testing, so the following works ok for me…
bash sudo /usr/sbin/gmond sudo /usr/sbin/gmetad
- Start Apache. This can be done in the ‘Sharing’ pane of ‘System Preferences’. Clicking the checkbox for ‘Web Sharing’ starts up Apache.
- Browse to the location where you installed the Ganglia web frontend. You should see the first few minutes of your metrics flowing in.
☙ ☙ ☙