python and rrdtool

RRDTool is a neat utility for collecting and graphing statistics such as server loads or network traffic. There are two main modules for interfacing with RRDTool files within python; rrdpython and pyrrd.

rrdpython is the basic bindings of the rrdtool library within python. The API is very familiar for people who program in C or use the command line tools which for me is both so it works well. However if you were expecting a “pythonic” API you will be disappointed. As there is the direct binding, you have to have either a pre-compiled module or compile it yourself with librrd-dev package installed. Depending on your setup this could be trivial or a real pain.

pyrrd initially looks good as it is a object-orientated style and (supposedly) a pure python code, so no trying to compile things… but!

Well, the problem is its not pure python. The hooks are there for it (in backend.py) for it to be implemented in python but it falls back to using the external method, and external method is a bunch of Popen calls. pyrrd also does not
support the full set of rrdtool commands.

My intention is to keep using rrdpython despite the compile hassle and possibly even use a fancier graph setup such as High Charts though there is a problem with their license for me.

Comments

4 responses to “python and rrdtool”

  1. Martin Avatar
    Martin

    High Charts, unfortunately, is “free for non-commercial use” or short “non-free”. There seems to be a nice combination of d3.js and rickshaw:

    http://code.shutterstock.com/rickshaw/examples/extensions.html

    And Debian has libjs-flot, which has some interesting uses:

    https://github.com/flot/flot/wiki/Flot-Usage

    1. Craig Avatar
      Craig

      Thanks Martin, I’ve seen d3 and libjs-flot as they are part of the ToscaWidgets suite. I’ve not heard of Rickshaw before.

      You nailed the problem with the license right away. My code will be GPL-2+ which means I cannot use things like CC-NC-SA which despite their name are non-free. Everyone is entitled the license their stuff however they want, it just mean I cannot use it!

      1. Martin Avatar
        Martin

        ToscaWidgets looks really interesting. I wonder, whether somebody will it package for Debian one day…

        1. Craig Avatar
          Craig

          There is a package called python-toscawidgets which is unfortunately TW1, not the newer TW2. I’m using Turbogears in a virtualenv so the packaging doesn’t matter that much. Toscawidgets gives a nice “python handle” on your widgets, turning a set of javascript into a python class.

Leave a Reply

Your email address will not be published. Required fields are marked *