{ "info": { "author": "Duncan McGreggor", "author_email": "duncan@canonical.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Topic :: Database", "Topic :: Database :: Front-Ends", "Topic :: Multimedia :: Graphics", "Topic :: System :: Networking :: Monitoring", "Topic :: System :: Systems Administration" ], "description": "~~~~~\nPyRRD\n~~~~~\n\n.. contents::\n :depth: 1\n\n\n========\nFeatures\n========\n\nPyRRD lets you use RRDTool from Python code that takes advantage of standard\nobject-oriented patterns. The makes the programmatic usage of RRDTool much\neasier and reusable.\n\nA quick review of features is available at the project wiki [#]_ . Example\ncode with graph image output is also available on the wiki [#]_ .\n\n\n============\nIntroduction\n============\n\nPyRRD is an object-oriented wrapper for the command line graphing and\nround-robin database utility, rrdtool [#]_ . PyRRD originally had two design\ngoals:\n\n1. provide an interface to rrdtool that Python programmers would love, and\n\n2. not depend upon the Python bindings for rrdtool.\n\nThe reasons for the former are obvious. The motivation for the latter were the\nmany people who had difficulty compiling the rrdtool bindings on their\noperating system of choice.\n\nEven though PyRRD's original purpose was to help those without the bingins, the\nproject now offers support for those with the bindings installed. As such,\nusers may enjoy both the speed benefits from the bindings as well as the API\nusability from PyRRD.\n\nFor docs, see the docstrings at the beginning of each class (and many of the\nfunctions). They not only contain many of the standard RRDTool docs, but they\ncontain doctests which give you a hands-on, how-it-works understanding of\nactual usage.\n\nFor those curious about the motivation for creating PyRRD, perhaps some\nbackground would be in order. Originally, there were only two ways to use\nRRDTool from Python:\n\n1. using the Python bindings which were difficult to compile and use, or\n\n2. making system calls to the \"rrdtool\" executable from Python, passing\nit all the parameters it needed.\n\nOption #1 was often difficult or impossible for many folks to get running on\ntheir preferred operating system. But even if one was able to compile it and\nrun it, usage was very cumbersome and designed to work like the command line\ntool and the C interface, not like most people typically use Python.\n\nNow, with PyRRD, there are two additional ways to use RRDTool from Python:\n\n3. an object-oriented interface that wraps system calls (Popen) to the\nrrdtool binary, and\n\n4. the same object-oriented interface that wraps the cumbersome rrdtool\nPython bindings.\n\n============\nDependencies\n============\n\nSome parts of PyRRD make use of ElementTree for XML processing. If you have\nPython 2.5 or greater, PyRRD will use xml.etree. If your Python version is less\nthan 2.5 and you want to use features that depend on XML processing (such as\ndump function and the fetch/info methods), you will need to install\nthe ElementTree library [#]_ .\n\n\n\n============\nInstallation\n============\n\nPyRRD is installed in the usual way::\n\n python setup.py install\n\nYou may also use PyRRD without installing it as long as you have ./ in your\nPYTHONPATH and you are in the top-level directory (which has the pyrrd child\ndirectory).\n\n\n=====\nUsage\n=====\n\nCreate an RRD file programmatically::\n\n >>> from pyrrd.rrd import DataSource, RRA, RRD\n >>> filename = '/tmp/test.rrd'\n >>> dataSources = []\n >>> roundRobinArchives = []\n >>> dataSource = DataSource(\n ... dsName='speed', dsType='COUNTER', heartbeat=600)\n >>> dataSources.append(dataSource)\n >>> roundRobinArchives.append(RRA(cf='AVERAGE', xff=0.5, steps=1, rows=24))\n >>> roundRobinArchives.append(RRA(cf='AVERAGE', xff=0.5, steps=6, rows=10))\n >>> myRRD = RRD(\n ... filename, ds=dataSources, rra=roundRobinArchives, start=920804400)\n >>> myRRD.create()\n\nLet's check to see that the file exists::\n\n >>> import os\n >>> os.path.isfile(filename)\n True\n\nLet's see how big it is (depending upon RRDTool version, the byte count can\nchange, so we'll just get a general sense)::\n\n >>> bytes = len(open(filename).read())\n >>> 800 < bytes < 1200\n True\n\nIn order to save writes to disk, PyRRD buffers values and then writes the\nvalues to the RRD file at one go::\n\n >>> myRRD.bufferValue('920805600', '12363')\n >>> myRRD.bufferValue('920805900', '12363')\n >>> myRRD.bufferValue('920806200', '12373')\n >>> myRRD.bufferValue('920806500', '12383')\n >>> myRRD.update()\n\nLet's add some more data::\n\n >>> myRRD.bufferValue('920806800', '12393')\n >>> myRRD.bufferValue('920807100', '12399')\n >>> myRRD.bufferValue('920807400', '12405')\n >>> myRRD.bufferValue('920807700', '12411')\n >>> myRRD.bufferValue('920808000', '12415')\n >>> myRRD.bufferValue('920808300', '12420')\n >>> myRRD.bufferValue('920808600', '12422')\n >>> myRRD.bufferValue('920808900', '12423')\n >>> myRRD.update()\n\nIf you're curious, you can take a look at your rrd file with the following::\n\n myRRD.info()\n\nThe output of that isn't printed here, 'cause it take up too much space.\nHowever, it is very similar to the output of the similarly named rrdtool\ncommand.\n\nIn order to create a graph, we'll need some data definitions. We'll also\nthrow in some calculated definitions and variable definitions for good\nmeansure::\n\n >>> from pyrrd.graph import DEF, CDEF, VDEF, LINE, AREA, GPRINT\n >>> def1 = DEF(rrdfile=myRRD.filename, vname='myspeed',\n ... dsName=dataSource.name)\n >>> cdef1 = CDEF(vname='kmh', rpn='%s,3600,*' % def1.vname)\n >>> cdef2 = CDEF(vname='fast', rpn='kmh,100,GT,kmh,0,IF')\n >>> cdef3 = CDEF(vname='good', rpn='kmh,100,GT,0,kmh,IF')\n >>> vdef1 = VDEF(vname='mymax', rpn='%s,MAXIMUM' % def1.vname)\n >>> vdef2 = VDEF(vname='myavg', rpn='%s,AVERAGE' % def1.vname)\n\n >>> line1 = LINE(value=100, color='#990000', legend='Maximum Allowed')\n >>> area1 = AREA(defObj=cdef3, color='#006600', legend='Good Speed')\n >>> area2 = AREA(defObj=cdef2, color='#CC6633', legend='Too Fast')\n >>> line2 = LINE(defObj=vdef2, color='#000099', legend='My Average',\n ... stack=True)\n >>> gprint1 = GPRINT(vdef2, '%6.2lf kph')\n\nColor is the spice of life. Let's spice it up a little::\n\n >>> from pyrrd.graph import ColorAttributes\n >>> ca = ColorAttributes()\n >>> ca.back = '#333333'\n >>> ca.canvas = '#333333'\n >>> ca.shadea = '#000000'\n >>> ca.shadeb = '#111111'\n >>> ca.mgrid = '#CCCCCC'\n >>> ca.axis = '#FFFFFF'\n >>> ca.frame = '#AAAAAA'\n >>> ca.font = '#FFFFFF'\n >>> ca.arrow = '#FFFFFF'\n\nNow we can create a graph for the data in our RRD file::\n\n >>> from pyrrd.graph import Graph\n >>> graphfile = \"/tmp/rrdgraph.png\"\n >>> g = Graph(graphfile, start=920805000, end=920810000,\n ... vertical_label='km/h', color=ca)\n >>> g.data.extend([def1, cdef1, cdef2, cdef3, vdef1, vdef2, line1, area1,\n ... area2, line2, gprint1])\n >>> g.write()\n\nLet's make sure it's there::\n\n >>> os.path.isfile(graphfile)\n True\n\nLet's get a sense of the byte size::\n\n >>> bytes = len(open(graphfile).read())\n >>> bytes != 0\n True\n >>> 8000 < bytes < 10400\n True\n\nOpen that up in your favorite image browser and confirm that the appropriate\nRRD graph is generated.\n\nLet's clean up the files we've put in the temp directory::\n\n >>> os.unlink(filename)\n >>> os.unlink(graphfile)\n\n\n===============\nPython Bindings\n===============\n\nIn addition to the command line tool, PyRRD also supports using the Python\nbindings, if you have them installed. Let's set some stuff up like we did in\nthe previous example::\n\n >>> filename = '/tmp/test.rrd'\n >>> dataSources = []\n >>> roundRobinArchives = []\n >>> dataSource = DataSource(\n ... dsName='speed', dsType='COUNTER', heartbeat=600)\n >>> dataSources.append(dataSource)\n >>> roundRobinArchives.append(RRA(cf='AVERAGE', xff=0.5, steps=1, rows=24))\n >>> roundRobinArchives.append(RRA(cf='AVERAGE', xff=0.5, steps=6, rows=10))\n\nUsage is identical to the standard PyRRD usage, with the exception of object\nconstruction::\n\n >>> from pyrrd.backend import bindings\n >>> myRRD = RRD(filename, ds=dataSources, rra=roundRobinArchives,\n ... backend=bindings)\n >>> myRRD.create()\n\nNote that since the Graph module is its own beast, you will need to indicate\nwhether you want to use the bindings or the external backend when you graph as\nwell::\n\n >>> from pyrrd.graph import Graph\n >>> graphfile = \"/tmp/rrdgraph.png\"\n >>> g = Graph(graphfile, start=920805000, end=920810000,\n ... vertical_label='km/h', color=ca, backend=bindings)\n >>> g.data.extend([def1, cdef1, cdef2, cdef3, vdef1, vdef2, line1, area1,\n ... area2, line2, gprint1])\n >>> g.write()\n\nEverything else is the same. Let's check to see that the file exists, and then\nwe'll cleanup::\n\n >>> import os\n >>> os.path.isfile(filename)\n True\n >>> os.unlink(filename)\n\n\n==========\nKnown Bugs\n==========\n\n* http://code.google.com/p/pyrrd/issues/list\n\n====\nTODO\n====\n\nNear Term\n---------\n\n* Move test code around (testing and admin/testRunner).\n\n* Fix breaking tests.\n\n* Add wiki examples for using info and fetch\n\n* Improve the wrapper for the Python RRDTool bindings\n\n * a lot of the code in PyRRD was written quite a while ago (circa 2004), and\n needs to be refactored (removing redundancies, use better idioms, etc.)\n\n* Allow for users to supply their own fd to pyrrd.graph.\n\n* Update all examples for recent dates like example4 has been updated.\n\n* Stop using actual file writes and doctests for file tests; use unit tests\n (and StringIO) instead.\n\nFuture\n------\n\n* Add an RPN class.\n\n* Add a DS collection class that has a get() method for getting a\n particular DS by name.\n\n* Add support for atomic operations.\n\n\n=======\nChanges\n=======\n\nFrom 0.0.7 to 0.1.0\n-------------------\n\nThis version marks a significant update to the code base. Some 70+ commits have\nbeen made to trunk since the last release in the period from March 2009 to\nSeptember 2011. Some of the most signficant changes include the following:\n\n* Added a wrapper for the Python bindings.\n\n* Improvements in tests and testing infrastructure.\n\n* Improved exception handling.\n\n* Many changes and improvements to the RRD -> Python object mapper.\n\n* Improved support in Windows.\n\n* Graph formatting fixes.\n\n* Many bug fixes from community members.\n\n\nFrom 0.0.6 to 0.0.7\n-------------------\n\n* Packaging improvements and loads of documentation.\n\n\nFrom 0.0.5 to 0.0.6\n-------------------\n\n* Bug fix release (missing files in source package).\n\n\nFrom 0.0.4 to 0.0.5\n-------------------\n\n* Added support for retrieving and displaying RRD from RRD files.\n\n* Added an object mapper for RRD data (via XML files).\n\n* Added community-contributed improvements.\n\n\nFrom 0.0.3 to 0.0.4\n-------------------\n\n* Updated all the examples to work with the latest code.\n\n* Added community-contributed bug fix for Windows users.\n\n\nFrom 0.0.2 to 0.0.3\n-------------------\n\n* Minor code reorg.\n\n* Fixed doctests.\n\n* Various bug fixes.\n\n* Examples updates.\n\n\nFrom 0.0.1 to 0.0.2\n-------------------\n\n* Added license.\n\n* Added unit tests.\n\n* Added more examples.\n\n\nFrom 0 to 0.0.1\n---------------\n\n* Reorganized RRD code as donated from the CoyMon project.\n\n* Got basic rrdtool functionality represented as Python classes.\n\n* Code cleanup.\n\n\n================\nAcknowledgements\n================\n\nThe following members of the community have provided valuable contributions to\nthis project:\n\n* Ravi Bhalotia, Allen Lerner, Mike Carrick and the U.S. Department of Veterans\n Affairs\n\n* AdytumSolutions, Inc., E-Secure Systems\n\n* nasvos, Leem Smit, Aaron Westendorf and Agora Games\n\n* Mladen Milankovic, Denis Fortin\n\n* Joseph Heck, Jean-Baptiste Quenot\n\n* Pavel Shramov, Brad Beattie, Colin Horsington\n\nThanks!\n\n\n==========\nReferences\n==========\n\n.. [#] http://code.google.com/p/pyrrd/wiki/FrontPage?tm=6\n\n.. [#] http://code.google.com/p/pyrrd/wiki/FullWorkingExamples\n\n.. [#] http://oss.oetiker.ch/rrdtool/\n\n.. [#] http://effbot.org/zone/element-index.htm", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://code.google.com/p/pyrrd/", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "PyRRD", "package_url": "https://pypi.org/project/PyRRD/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/PyRRD/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://code.google.com/p/pyrrd/" }, "release_url": "https://pypi.org/project/PyRRD/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "An Object-Oriented Python Interface for RRDTool", "version": "0.1.0" }, "last_serial": 286475, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "746cef7d60df796928c65a7f5d6e8042", "sha256": "aa4b0e34ece564e612317a64b049ef1001f2dca9fbe23ecf9c49a17efa8d91af" }, "downloads": -1, "filename": "PyRRD-0.0.1-py2.3.egg", "has_sig": false, "md5_digest": "746cef7d60df796928c65a7f5d6e8042", "packagetype": "bdist_egg", "python_version": "2.3", "requires_python": null, "size": 36470, "upload_time": "2006-01-24T22:03:52", "url": "https://files.pythonhosted.org/packages/cc/10/d2b713738a6f20b1c485caf6bcd54c5d62e3d0e5166647e4cfbd6b9ff29e/PyRRD-0.0.1-py2.3.egg" }, { "comment_text": "", "digests": { "md5": "226a7f296265e2e869f6f4ac7b6092e5", "sha256": "ea90886546fe2dc2d4eff718b27ebe495722233c89ad3736fe4ac7d608c715e4" }, "downloads": -1, "filename": "PyRRD-0.0.1-py2.4.egg", "has_sig": false, "md5_digest": "226a7f296265e2e869f6f4ac7b6092e5", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 36116, "upload_time": "2006-01-24T19:05:37", "url": "https://files.pythonhosted.org/packages/87/dc/462045f483e90f57052d323499f951faaf9a1faf23d4ebd6be00299de371/PyRRD-0.0.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "70f4914954be591efa678f7e5e607742", "sha256": "e3c1dd24666fd73987328b67940d05cebd18d1ca8a87d578b8b042d626449256" }, "downloads": -1, "filename": "PyRRD-0.0.1.tar.gz", "has_sig": false, "md5_digest": "70f4914954be591efa678f7e5e607742", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 379307, "upload_time": "2006-01-24T19:54:06", "url": "https://files.pythonhosted.org/packages/c6/24/2a6343156d9d5442b59f7ae849db1b56d1fe03227fa4ffeed38fb2b36239/PyRRD-0.0.1.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "6fd268eb3e783f0036d835da9e5d9170", "sha256": "a1a013cd20dc40202130e2c9f589c90422515d3d4e65acdff6a19c839aa6856a" }, "downloads": -1, "filename": "PyRRD-0.0.3-py2.4.egg", "has_sig": false, "md5_digest": "6fd268eb3e783f0036d835da9e5d9170", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 37441, "upload_time": "2008-04-11T18:56:33", "url": "https://files.pythonhosted.org/packages/bd/80/5a2817b8554ad9b8e99f2b02b7894b20d166345dd2ccb355e1b9049a1bea/PyRRD-0.0.3-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "782c04b3890e1c50742c106a97b3bf95", "sha256": "807bffec952b113f15175979fc08d5295243d62b91a6a5998c32a699da0c61db" }, "downloads": -1, "filename": "PyRRD-0.0.3-py2.5.egg", "has_sig": false, "md5_digest": "782c04b3890e1c50742c106a97b3bf95", "packagetype": "bdist_egg", "python_version": "2.5", "requires_python": null, "size": 37198, "upload_time": "2008-04-11T18:56:20", "url": "https://files.pythonhosted.org/packages/6e/ca/50c4516ffbfce3098866c427678a1d615fa1e727c4500642c6dbd26534cd/PyRRD-0.0.3-py2.5.egg" }, { "comment_text": "", "digests": { "md5": "944a6be6b3e59d07a6a61e69236bb9b7", "sha256": "6ea82e738246bfe832a77604ee5ab117be19d2cfa2b10f6b77ec6d30372d4330" }, "downloads": -1, "filename": "PyRRD-0.0.3.tar.gz", "has_sig": false, "md5_digest": "944a6be6b3e59d07a6a61e69236bb9b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 615545, "upload_time": "2008-04-11T18:56:55", "url": "https://files.pythonhosted.org/packages/b9/fd/6d887054090a44e8c391443889943d36c8114d18baa0205dd49a27b7996a/PyRRD-0.0.3.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "31cfb812d3a4a5ca11e619ce9dc8f6b4", "sha256": "4eec65d405b7ebe35aa03cbb100229f54525d1b4b303b34a74eca5794454ac9a" }, "downloads": -1, "filename": "PyRRD-0.0.7.tar.gz", "has_sig": false, "md5_digest": "31cfb812d3a4a5ca11e619ce9dc8f6b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 446987, "upload_time": "2009-03-27T06:15:53", "url": "https://files.pythonhosted.org/packages/a5/3f/3fc0e4b24bf5ea1a44f866e839dc111801c08de8ef10e13aa689cda3825f/PyRRD-0.0.7.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "c33a0760b42a23e45e423b8b9f2cd0b0", "sha256": "103b3a6f855e38946e0fc100a54ec46be69c37cc349ceb95decad35424f629a9" }, "downloads": -1, "filename": "PyRRD-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c33a0760b42a23e45e423b8b9f2cd0b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 454779, "upload_time": "2011-09-18T23:39:51", "url": "https://files.pythonhosted.org/packages/6c/fb/c2717024b02a18ddf7b7484facb9b47e2efd8e052ff5fd73c5a2185e0277/PyRRD-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c33a0760b42a23e45e423b8b9f2cd0b0", "sha256": "103b3a6f855e38946e0fc100a54ec46be69c37cc349ceb95decad35424f629a9" }, "downloads": -1, "filename": "PyRRD-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c33a0760b42a23e45e423b8b9f2cd0b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 454779, "upload_time": "2011-09-18T23:39:51", "url": "https://files.pythonhosted.org/packages/6c/fb/c2717024b02a18ddf7b7484facb9b47e2efd8e052ff5fd73c5a2185e0277/PyRRD-0.1.0.tar.gz" } ] }