Ganglia: Using the ruby gmetric gem

If you are new to Ganglia this post might not make much sense. If you are interested in Ganglia I suggest you read this paper first to get a better understanding of how it works.

Over the past year I have been moving away from Munin and towards Ganglia for my server monitoring needs (for reasons that should go in another post). One of the nice things about Munin is the number of plugins that are included out the box. Ganglia is lacking in this department. The lack of time to re-write plugins was one of the initial obstacles preventing me from ditching munin altogether. Once I found the gmetric gem for ruby that all changed.

Using the gemtric gem you can write a ganglia plugin in ruby and send the metrics directly from your ruby scirpt without integrating the “gmetric” command line tool provided by Ganglia. The other nice thing about the gem is that it supports the “group” part of the ganglia message protocol. So you can specify a grouping for the metric you submit. Using the stock “gmetric” tool that ships with ganglia in Ubuntu, all data goes into an uncategorised group in ganglia.

Here is an example of a simple gmetric plugin using the gem. It counts some files in directory and reports them to the ganglia cluster:

Ganglia file count graph

This entry was posted in /geek, /sysadmin, /unix, /work, monitoring, ruby and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled