/ unidist / timeseries / rrd.py
Time Series: RRD
Implementation of timeseries backend methods for RRDTool.
TODO(g): Optionally ensure a ramdisk is created for the RRD file, so no disk
performance is lost. Create the file using less storage space, if you
are capturing a lot of data points with fine granularity, or accept
sacraficing the memory to remove any IO hits.
TODO(g): Add in adjustable information for saving space. Set by MB or time,
or either? Return both, if so...
Functions
|
|
|
GraphRrd
|
GraphRrd (
filename,
image_path,
create_fields,
graph_fields,
method,
title,
label_vertical,
defaults,
)
|
|
StoreInRrd
|
StoreInRrd (
filename,
interval,
occurred,
fields,
)
Data: fields = {'user':42, 'system':11, 'idle':46}
Exceptions
|
|
Exception( 'RRD file not found: %s' % filename )
|
|
|
Old_GraphRrds
|
Old_GraphRrds ()
Graph all our RRD files.
Dont discriminate, just do them all. We will come back and make this
more intelligent later (graphing by scheduled delay.)
|
|
GetRrdLastUpdateTime
|
GetRrdLastUpdateTime ( filename )
Returns: int, epooch time, last time RRD was updated
|
|
FetchFromRrd
|
FetchFromRrd (
filename,
start_time,
consolidation='AVERAGE',
)
Returns dict of dicts, keyed on time, keyed on column names, then values.
Exceptions
|
|
Exception('Failed to fetch from RRD: %s: %s' %( cmd, output_error ) )
|
|
|
CreateRrd
|
CreateRrd (
filename,
interval,
create_fields,
defaults,
start=0,
)
|
|
|