We’ve previously posted about measuring what’s happening on Redbubble, but with NewRelic’s
new plugin system our lives just got a bit easier. We’ve been using NewRelic for a while now and frequently make use of it’s application and server monitoring for diagnosing problems. Generally the timescales it keeps data for are sane, integration with other tools is good and the UI is easy to use.
There are already a plethora of plugins waiting for you to install, although NewRelic’s definition of a plugin is not what we expected. The plugins are small applications (agents) that poll your apps and report back to NewRelic using your licence key and an agent_guid for identification. So installation isn’t all that straightforward, depending on what you want to monitor.
In the same vein as our previous post, we’ll start with a plugin that monitors queue depth for RabbitMQ. There are two
public plugins for RabbitMQ already. MeetMe’s plugin will grab queue depth and a whole bunch of stats and Pivotal’s plugin is nice in that it’s written in Ruby, our language of choice, but doesn’t monitor as much. Our problem is that we want to show our queue depth for different queues organised by the type of consumer. This is the major flaw we can see with NewRelic’s plugin system at the moment, the dashboards can only be modified by the plugin owner. We could have installed MeetMe’s plugin, modified the agent_guid and created our own dashboard, but we wanted to get our hands dirty. So we grabbed the Ruby plugin SDK and started from scratch.
Pivotal are using a handy gem for talking to RabbitMQ’s management API, so we used that as our starting point. It’s got a really simple interface for pulling information. We’re only interested in queue size for now, so the entirety of our plugin is 31 lines
of ruby glue code. Pretty simple stuff. Our plugin is available in a public repo, let us know if the README is good enough to get started.
Once the plugin is running, a new menu item appears in the NewRelic dashboard:
As we haven’t published our plugin (our dashboard is heavily customised to our own use of RabbitMQ) you’ll have to
create your own dashboard. The easiest way to see everything is to setup your chart like so:
If you want to filter by queue name like us, NewRelic has some smarts around it’s wildcard matches so you can do partial
name matches with *’s. The end result is so pretty we put it on a sticker!
And there we have it. Really simple stats collection via NewRelic. Next on our list is to move some of our other
custom metrics into NewRelic and investigate it’s alerting capability.