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.

This entry was posted in IT Infrastructure, PHP, Programming. Bookmark the permalink.

10 Responses to Squid and Mysql metric scripts for Ganglia

  1. Ben says:

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

  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.

  3. 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.

  4. allspaw says:

    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.

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

  6. Pingback: Ganglia rules! « David’s NEW Blog

  7. Ciprian says:

    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

  8. Serg Green says:

    Hello guys! Great work, keep it up!

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