goldb.org home

AS OF MAY 2008, THIS BLOG IS NO LONGER BEING UPDATED.
Visit the new blog at: http://coreygoldberg.blogspot.com



 Tuesday, April 29, 2008

Python - RRDTool Utilities (module and scripts for RRDs)

I started a project on Google Code to create a set of Python tools to make dealing with Round Robin Databases (RRD) less painful.  Setting up RRD's can be tough if you don't know what you are doing.

anyone interested can check it out here:  rrdpy

I used it to create a simple HTTP monitoring script (included in source) to graph web response latency like this:

#    Comments [4] |
Tuesday, April 29, 2008 1:24:32 PM (Eastern Standard Time, UTC-05:00)
Not long ago I dumped some code I'd had sitting around for many years into Launchpad that monitors/graphs stuff with python/rrd. Its code i wrote basically to do a specific thing, so it's not very flexible; but it was written somewhat as a framework so that i could add monitors. I've had several servers running the code for years, and it works well for what it is.

In essence you just subclass an object and define the data fields and a method to gather info. It then auto-creates RRD files if needed, and sits in a loop updating them. That's about all there is to it.

I provide a sample CGI just using RRDTool's CGI interface that dumps a large number of graphs onto a single page, but these days for viewing graphs I most often just use "ddraw" <http://web.taranis.org/drraw/> because it's simple and has some flexibility without much effort (though it's written in perl, alas).

I haven't looked at your code/approach at all. I may later, but I don't have much time these days. Just thought i'd mention my old code in case of any interest. Feel free to ignore me. (-:

http://bazaar.launchpad.net/~timtoo/pyrrdall/main/files

Tuesday, April 29, 2008 2:20:40 PM (Eastern Standard Time, UTC-05:00)
cool... i'll have a look at your code. thanks.

mine is pretty dumb.. I use an object to wrap the command line interface for RRDTool. Seems to work well though.

-Corey
Wednesday, April 30, 2008 11:21:43 PM (Eastern Standard Time, UTC-05:00)
Hey Corey, did you see <a href="http://code.google.com/p/pyrrd/">PyRRD</a>? It's an OO wrapper for calling out to the rrd binary. I wrote it a couple years ago due to a deployment we had where the python bindings couldn't be installed on machines.

There are some full examples <a href="http://code.google.com/p/pyrrd/wiki/FullWorkingExamples">here</a> with some nice custom rrd graphs.

It uses the Twisted python coding standard, has doctests, and is on PyPI as well as google hosting.
Thursday, May 01, 2008 8:35:41 AM (Eastern Standard Time, UTC-05:00)
i will take a look at your code.. thanks!

initially I looked at the python bindings that come with RRDTool and I was totally lost. So I just knocked up a quick version to wrap the command line.

-Corey
Comments are closed.