A simple Django application to demonstrate RRD plots generated by collectd or any other rrd data
django-collectd-rest is a simple Django application to demonstrate RRD plots generated by collectd or any other rrd data. The application is built on top of django-rest-framework and provides REST API to access the plots.
There are two major things in django-collectd-rest, graphs are grouped into groups. Both the graphs and the groups are accessible through REST API. Using mutable access (POST, PUT, DELETE), you can configure you hierarchy, create new graphs or alter existing ones. You also can grab meta-info or ready PNG images by means of GET requests. Genuine
rrdtool is currently used to render the plots.
Newly introduced granularity object is a kind of policy hinting image freshness lifetime, or its time resolution. Currently, it is used to correctly set
max-age in response
Cache-Control header. The default granularity has
The following prerequisites are required to operate django-collectd-rest:
- django-rest-framework - powerful and flexible toolkit that makes it easy to build Web APIs.
- rrd - high performance data logging and graphing system for time series data.
To use django-collectd-rest in your django project, include the following code into your
INSTALLED_APPS = ( #... 'rest_framework', 'collectd_rest', )
urls.py you have to add the following:
urlpatterns = patterns('', #... url(r'^collectd_rest/', include('collectd_rest.urls')), )
The whole configuration is stored into the project database, there is not separate dedicated configfile. New graphs and groups are added by creating new objects. The latter can be done in different ways.
Using django database console:
from collectd_rest import models group = models.GraphGroup(title="The Group", name="group1") group.save() graph = models.Graph(title="The Graph", name="graph1", priority=0, command="DEF:cpuuser=/path/to/rrd/cpu-0/cpu-idle.rrd:value:AVERAGE LINE2:cpuuser#000000:legend", group=group) graph.save()
GraphGroup model has two parameters: human-readable
title and lookup field
name to access the group by url like
Graph model has way more fields, including
priority to sort the graphs inside one group, mandatory parent
command to generate rrd plot.
The other ways to configure the application are Django fixtures, Django admin interface, django-rest-framework web browsable interface, and REST API itself. You can also modify the graphs hierarchy dynamically by means of custom REST client.
Authentication and permissions
mygroup into corresponding
div element, and the
myothergroup into the other one.
If you have any questions, issues, or pull-requests, you are welcome to use GitHub infrastructure for them.
Copyright (c) 2014, Matwey V. Kornilov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size django-collectd-rest-0.2.2.tar.gz (12.5 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for django-collectd-rest-0.2.2.tar.gz