11. November 2007, 18:01, by Silvan Mühlemann

Squid and Mysql metric scripts for Ganglia

Ganglia Title imageAfter a long day of meetings and other tedious manager work the perfect way to relax is to code. The best is a mini-projects where you see your results after an hour or so. I call these tasks “Plausch-Projekte” (“plah-oosh project” =”fun projects”).

This week my plah-oosh projects were two metric tools for Ganglia. Besides Nagios Ganglia is the main monitoring tool for our cluster. We monitor something like 20 metrics like load, memory, disk usage, network activity.

Ciprian and Stefan recently built a script to monitor apache (bytes/sec, hits/sec, idle processes etc.) via the /server-status interface. Based on their work I hacked two scripts:

ganglia_mysql_metrics.php monitors multiple mysql parameters like queries/sec, slow queries/sec, threads connected:
Screenshot of mysql_* metrics in Ganglia

ganglia_squid_metrics.php reports regularly about squid metrics: Requests/sec, service time, available file descriptors:

Screenshot squid metrics in Ganglia

The scripts are quick and dirty code. Procedural. Not well documented. Does only read the mcast_port from the config file and ignores the rest. But it might be a good base to be used on your cluster too. Just call them every minute via the crontab.

10 Comments

  1. Do you have these available for Nagios? Very useful but we only use nagios and not ganglia?!

    Comment by Ben — 11. November 2007 @ 23:27

  2. Unfortunately not. We use Nagios also. But not for performance monitoring. Just to let us know if the services are running or not.

    But programming custom checks in Nagios is pretty straightforward: You’ll find the guidelines here.

    Comment by Silvan Mühlemann — 14. November 2007 @ 09:00

  3. Do you guys have any documentation for writing Ganglia metric scripts ?

    We were looking for custom scripts for a Ganglia cluster node.

    Comment by digen — 17. December 2007 @ 18:06

  4. It’s really straightforward. You’ll find an explanation here.

    Your script should be a cronjob which runs every minute. And this job should call gmetric to submit the metrics to the ganglia server.

    Comment by Silvan Mühlemann — 17. December 2007 @ 18:13

  5. As a big user of ganglia (96 clusters) we’ve written similar gmetric scripts for squid and mysql, but kudos for actually motivating to make them available. :) the ganglia community thanks you, you should post them to the ganglia-general mailing list.

    Comment by allspaw — 21. May 2008 @ 18:54

  6. Is there a repository for these gmetric scripts, I want to monitor all the mysql parameters, and also apache http requests.
    thanks

    Comment by Viven Rajendra — 18. June 2008 @ 09:27

  7. Hi Viven

    There is a repository at http://ganglia.sourceforge.net/gmetric/

    Comment by Silvan Mühlemann — 22. June 2008 @ 21:08

  8. […] I haven’t had time to look at it yet but Silvan Mühlemann wrote a custom report php script for mysql […]

    Pingback by Ganglia rules! « David’s NEW Blog — 31. January 2009 @ 22:38

  9. Hy,
    I use ganglia to monitor 2 servers, and i sent this statistics to another server manager.I want to monitor new resources on them(servers) using new scripts but i don’t now haw to configure them in ganglia to collect results from them. i really appreciate if u help me

    Thanks Ciprian

    Comment by Ciprian — 25. March 2009 @ 16:41

  10. Hello guys! Great work, keep it up!

    But could you please tell us how to use this gmetric? What should I configure in gmond?

    Comment by Serg Green — 9. October 2009 @ 10:40

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

© 2017 tilllate Schweiz AG - Powered by WordPress