Server Density is a fantastic product for monitoring server performance, but by default Memcached it not a supported service, fortunately you can write plugins in Python to extend monitoring to any kind of metric.

For Memcached there was a pre-existing plugin written by chrisreid, but this depends on the python-memcached library, which as a total newcomer to Python and packaging for Red Hat I found pretty difficult to install.

So I tried the simplest thing which could possibly work, turns out you can telnet into the memcached port 11211 and ask for stats. So with a little knowledge of Python regex and lots of tinkering I present a Server Density Memcached plugin.

quite a boring screenshot of memcached working as expected

Install instructions are really easy to follow and hopefully you won’t have too much trouble getting it setup, if the server is running on another IP or port to the defaults (127.0.0.1:11211) you’ll need to hack the plugin as there’s no way for me to allow config in SD.

What’s great about any of the plugins you install for SD is that they all act the same as the native metrics, so if you want to get alerted when your Memcached misses grow larger than your hits you can create an alert just as easy as you would for a high load or memory.

If you’ve got some improvements to make, please fork the plugin and send me a pull request, the plugin source is released under the New BSD License.