How is your DB server doing? MySQL Statistics Collection with Zabbix and Ruby

By | March 17, 2010

OK, we saw some ‘Too many connections‘ errors related to MySQL in various log files for the infrastructure. The easiest way to fix that, would be to increase the max_connections setting and be done with it.

But that brought a bigger problem back to light. We don’t really have a good understanding of what our MySQL servers are doing:-( So I was looking to improve our monitoring to include MySQL statistics as well.

Some background: We run on OpenSolaris, so a lot of stuff has to be compiled/ported to work in that setup. We use Zabbix as monitoring tool and Puppet as a configuration management tool.

So I found quickly the ‘Heavy MySQL monitoring solution‘ on the Zabbix wiki. But the problem was, we don’t really have PHP installed on our DB hosts. Instead we have Ruby installed on all our hosts because it’s the implementation language for Puppet. So I ended up translating the original PHP script into Ruby.

Here is my first version of the code: mysql_monitor.rb . It also has some changes where the original was somewhat Linux specific. It might change over the next couple of days as I experiment with it on different hosts. But the general setup works already.

Have fun,

— Marco

3 thoughts on “How is your DB server doing? MySQL Statistics Collection with Zabbix and Ruby

  1. Matt Reid

    This is a very cool combination of ruby and puppet to get things working. Just for reference, there’s another tool you might want to look at that has far more tuning equations and automation of analytics: Kontrollbase –

  2. mw46d Post author

    Thanks for your info. That’s definitely something to look at. But I’ll have to check what it does in an OpenSolaris SPARC environment.

    The docs say mostly Intel/AMD and Linux. That would be fine with me, but our production servers are running [Open]Solaris.

    I was just running into an alignment bug within the zabbix server:-( Works fine on x86, but not on SPARC. Those things take a long time to track down:-(

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.