py-rrdtool-cvs Mailing List for Python RRDTool module
Status: Beta
Brought to you by:
perky
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
From: Hye-Shik C. <pe...@us...> - 2006-09-13 09:51:55
|
perky 06/09/13 02:51:53 Modified: . AUTHORS MANIFEST.in Makefile README setup.py Added: . THANKS rrdtool.py test.py Removed: . ACKNOWLEDGEMENT Log: - Add Mihai Ibanescu's pythonic rrdtool wrapper. - Update my email address. - Mark this version as 1.0b1. - Apply a patch for rrdtool 1.2. Revision Changes Path 1.3 +2 -2 py-rrdtool/AUTHORS Index: AUTHORS =================================================================== RCS file: /cvsroot/py-rrdtool/py-rrdtool/AUTHORS,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AUTHORS 23 Dec 2003 06:40:49 -0000 1.2 +++ AUTHORS 13 Sep 2006 09:51:53 -0000 1.3 @@ -1,2 +1,2 @@ -Hye-Shik Chang <pe...@i1...> -Anthony Tarlano <ta...@us...> +Hye-Shik Chang <pe...@Fr...> +Mihai Ibanescu <mi...@re...> 1.3 +2 -2 py-rrdtool/MANIFEST.in Index: MANIFEST.in =================================================================== RCS file: /cvsroot/py-rrdtool/py-rrdtool/MANIFEST.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MANIFEST.in 8 Jan 2003 20:38:34 -0000 1.2 +++ MANIFEST.in 13 Sep 2006 09:51:53 -0000 1.3 @@ -1,6 +1,6 @@ -# $Id: MANIFEST.in,v 1.2 2003/01/08 20:38:34 perky Exp $ +# $Id: MANIFEST.in,v 1.3 2006/09/13 09:51:53 perky Exp $ -include COPYING MANIFEST.in AUTHORS ACKNOWLEDGEMENT +include COPYING MANIFEST.in AUTHORS THANKS test.py #recursive-include test * #recursive-include doc * 1.2 +2 -2 py-rrdtool/Makefile Index: Makefile =================================================================== RCS file: /cvsroot/py-rrdtool/py-rrdtool/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile 24 May 2002 04:00:53 -0000 1.1 +++ Makefile 13 Sep 2006 09:51:53 -0000 1.2 @@ -1,9 +1,9 @@ # # py-rrdtool maintainer build # -# by Hye-Shik Chang <pe...@fa...> +# by Hye-Shik Chang <pe...@Fr...> # -# $Id: Makefile,v 1.1 2002/05/24 04:00:53 perky Exp $ +# $Id: Makefile,v 1.2 2006/09/13 09:51:53 perky Exp $ # LOCALBASE?= /usr/local 1.5 +2 -7 py-rrdtool/README Index: README =================================================================== RCS file: /cvsroot/py-rrdtool/py-rrdtool/README,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- README 14 Feb 2003 02:38:16 -0000 1.4 +++ README 13 Sep 2006 09:51:53 -0000 1.5 @@ -1,4 +1,4 @@ -Python-RRDtool 0.2.1 +Python-RRDtool 1.0b1 -------------------- The python-rrdtool provides a interface to rrdtool, the wonderful @@ -11,12 +11,7 @@ Project ------- -Homepage: http://www.nongnu.org/py-rrdtool/ - -Mailing Lists: - - CVS Checkins py-...@no... - Users & Hackers py-...@no... +Homepage: http://sourceforge.net/projects/py-rrdtool/ Author 1.8 +8 -8 py-rrdtool/setup.py Index: setup.py =================================================================== RCS file: /cvsroot/py-rrdtool/py-rrdtool/setup.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- setup.py 14 Feb 2003 02:38:16 -0000 1.7 +++ setup.py 13 Sep 2006 09:51:53 -0000 1.8 @@ -4,11 +4,11 @@ # # py-rrdtool distutil setup # -# Author : Hye-Shik Chang <pe...@fa...> -# Date : $Date: 2003/02/14 02:38:16 $ +# Author : Hye-Shik Chang <pe...@Fr...> +# Date : $Date: 2006/09/13 09:51:53 $ # Created : 24 May 2002 # -# $Revision: 1.7 $ +# $Revision: 1.8 $ # # ========================================================================== # This file is part of py-rrdtool. @@ -36,16 +36,16 @@ include_dir = os.environ.get('INCDIR', os.path.join(RRDBASE, 'include')) setup(name = "py-rrdtool", - version = "0.2.1", + version = "1.0b1", description = "Python Interface to RRDTool", author = "Hye-Shik Chang", - author_email = "pe...@fa...", + author_email = "pe...@Fr...", license = "LGPL", - url = "http://www.freesoftware.fsf.org/py-rrdtool/", - packages = ['rrdtool'], + url = "http://sourceforge.net/projects/py-rrdtool/", + py_modules = ['rrdtool'], ext_modules = [ Extension( - "rrdtool._rrdtool", + "_rrdtool", ["src/_rrdtoolmodule.c"], libraries=['rrd'], library_dirs=[library_dir], 1.1 py-rrdtool/THANKS Index: THANKS =================================================================== ACKNOWLEDGMENT ============== This is a list of people who have made contributions to py-rrdtool. Matthew W. Samsonoff <mw...@ro...> Brian E. Gallew <gee...@cm...> 1.1 py-rrdtool/rrdtool.py Index: rrdtool.py =================================================================== #!/usr/bin/env python # # Wrapper module for rrdtool # # # Copyright 2006, Red Hat, Inc # Mihai Ibanescu <mi...@re...> # # This software may be freely redistributed under the terms of the # Lesser GNU general public license. # # You should have received a copy of the Lesser GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # # Id: rrd.py 101964 2006-09-08 02:55:53Z misa """ This module is a wrapper for the python bindings for rrdtool (the round robin database). How to create an rrd database: r = RoundRobinDatabase("iostats.rrd") heartbeat = 1200 r.create( DataSource("tps", type=GaugeDST, heartbeat=heartbeat), DataSource("rtps", type=GaugeDST, heartbeat=heartbeat), DataSource("wtps", type=GaugeDST, heartbeat=heartbeat), RoundRobinArchive(cf=AverageCF, xff=0.5, steps=1, rows=1200), RoundRobinArchive(cf=AverageCF, xff=0.5, steps=12, rows=2400), start=-864000, step=600) How to update an rrd database: r = RoundRobinDatabase("iostats.rrd") r.update(Val(1, 1), template=('rtps', 'wtps')) r.update(Val(1, 1, timestamp=time.time() - 3600), template=('rtps', 'wtps')) How to graph: g = RoundRobinGraph("iostats.png") g.graph( Def("tps", "iostats.rrd", data_source="tps", cf=AverageCF), Def("rtps", "iostats.rrd", data_source="rtps", cf=AverageCF), Def("wtps", "iostats.rrd", data_source="wtps", cf=AverageCF), LINE1("tps", rrggbb="ff0000", legend="tps"), LINE1("rtps", rrggbb="00ff00", legend="rtps"), LINE1("wtps", rrggbb="0000ff", legend="wtps"), alt_y_mrtg=None, width=900, height=200, x="HOUR:1:HOUR:2:HOUR:4:0:%H", title="IO stats", start=(time.time() - 86400), end=(time.time() - 3600), ) """ import os from _rrdtool import create, error, fetch, graph, info, last, resize, tune, update from types import ListType, TupleType __all__ = [ 'create', 'error', 'fetch', 'graph', 'info', 'last', 'resize', 'tune', 'update', 'BasicType', 'DataSourceType', 'GaugeDST', 'CounterDST', 'DeriveDST', 'AbsoluteDST', 'ConsolidationFunction', 'AverageCF', 'MinCF', 'MaxCF', 'LastCF', 'SpecializedConsolidationFunction', 'HWPredictCF', 'SeasonalCF', 'DevseasonalCF', 'DevpredictCF', 'FailuresCF', 'Val', 'GraphType', 'TimeUnitType', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR', 'RoundRobinDatabase', 'RoundRobinGraph', 'Def', 'Graph', 'HRULE', 'VRULE', 'LINE1', 'LINE2', 'LINE3', 'AREA', 'STACK', 'PRINT', 'GPRINT', 'COMMENT', 'DataSource', 'RoundRobinArchive', 'XAxis', ] class BasicType: "Base type class" def __init__(self, name): self.name = name def __str__(self): return self.name def __repr__(self): return '<%s instance; string repr="%s">' % (self.__class__.__name__, self.name) class DataSourceType(BasicType): "Class that describes a DST" pass GaugeDST = DataSourceType('GAUGE') CounterDST = DataSourceType('COUNTER') DeriveDST = DataSourceType('DERIVE') AbsoluteDST = DataSourceType('ABSOLUTE') class ConsolidationFunction(BasicType): "Class that describes a CF" pass AverageCF = ConsolidationFunction('AVERAGE') MinCF = ConsolidationFunction('MIN') MaxCF = ConsolidationFunction('MAX') LastCF = ConsolidationFunction('LAST') class SpecializedConsolidationFunction(ConsolidationFunction): "Class that describes a specialized CF" pass HWPredictCF = SpecializedConsolidationFunction('HWPREDICT') SeasonalCF = SpecializedConsolidationFunction('SEASONAL') DevseasonalCF = SpecializedConsolidationFunction('DEVSEASONAL') DevpredictCF = SpecializedConsolidationFunction('DEVPREDICT') FailuresCF = SpecializedConsolidationFunction('FAILURES') class Val: """Class that describes an RRD value To init: Val(1, 2, 3), Val(1, 2, 3, timestamp=time.time() - 3600) """ def __init__(self, *args, **kwargs): if kwargs: if len(kwargs.keys()) > 1: raise ValueError, "Val only accepts one keyword, timestamp" k = kwargs.keys()[0] valid = ('timestamp', 'ts') if k not in valid: raise ValueError, "Unknown keyword %s" % k self.timestamp = int(kwargs[k]) else: self.timestamp = 'N' self.vals = args def __str__(self): return "%s:%s" % (self.timestamp, str.join(':', map(str, self.vals))) def __len__(self): return len(self.vals) class GraphType(BasicType): "Class that describes a graph type" pass _Hrule = GraphType("HRULE") _Vrule = GraphType("VRULE") _Line1 = GraphType("LINE1") _Line2 = GraphType("LINE2") _Line3 = GraphType("LINE3") _Area = GraphType("AREA") _Stack = GraphType("STACK") _Print = GraphType("PRINT") _GPrint = GraphType("GPRINT") _Comment = GraphType("COMMENT") class TimeUnitType(BasicType): "Class that describes a time unit type" pass SECOND = TimeUnitType("SECOND") MINUTE = TimeUnitType("MINUTE") HOUR = TimeUnitType("HOUR") DAY = TimeUnitType("DAY") WEEK = TimeUnitType("WEEK") MONTH = TimeUnitType("MONTH") YEAR = TimeUnitType("YEAR") class RoundRobinDatabase: """ A Round Robin Database The constructor takes the rrd name which is subsequently applied to all the functions that deal with an rrd """ def __init__(self, rrd_name): self._rrd_name = rrd_name # Wrappers around RRD's functions def create(self, *args, **kwargs): "Same as rrdtool create" args = [self._rrd_name] + map(str, args) for k, v in kwargs.items(): args.append("--%s" % k) args.append(str(v)) #print "DEBUG: rrdtool create", " ".join(args) return create(*args) def update(self, *args, **kwargs): "Same as rrdtool update" self._sanity() if kwargs: if len(kwargs.keys()) > 1: raise ValueError, "only accepts one keyword, template" k = kwargs.keys()[0] valid = ('template', 't') if k not in valid: raise ValueError, "Unknown keyword %s" % k val = kwargs[k] if type(val) not in [ListType, TupleType]: raise ValueError, "Invalid type for template value" template = val valnum = len(template) else: template = None valnum = None # Sanity check: all the entries have the same number of values for a in args: if not isinstance(a, Val): raise ValueError, "Not a Val instance" if not valnum: valnum = len(a) continue if len(a) != valnum: raise ValueError, "Number of values does not match" args = [self._rrd_name] + map(str, args) if template: args = ['--template', str.join(':', template)] + args #print "DEBUG: rrdtool update", " ".join(args) return update(*args) def last(self): "Same as rrdtool last" self._sanity() return last(self._rrd_name) # Housekeeping functions def exists(self): return os.path.exists(self._rrd_name) def get_name(self): return self._rrd_name def _sanity(self): if not self.exists(): raise OSError, "Could not open file %s" % self._rrd_name class RoundRobinGraph: "A grapher class for a Round Robin Database" def __init__(self, filename): self._filename = filename def graph(self, *args, **kwargs): "Same as rrdtool graph" args = [self._filename] + map(str, args) for k, v in kwargs.items(): args.append("--%s" % k.replace("_", "-")) if v is not None: args.append(str(v)) return graph(*args) class Def: "Helper class for building DEF values" def __init__(self, name, rrd, data_source=None, cf=None): if not os.path.isfile(rrd): raise OSError, "Could not open file %s" % rrd self._rrd = rrd self._name = name if data_source is None: # By default, same as the name data_source = self._name self._data_source = data_source if cf is None: raise ValueError, "Consolidation function not specified" if not isinstance(cf, ConsolidationFunction): raise ValueError, "%s not a valid consolidation function" % cf self._cf = cf def __str__(self): return "DEF:%s=%s:%s:%s" % (self._name, self._rrd, self._data_source, self._cf) class Graph: "Base graph class" def __init__(self, graph_type=None, name=None, rrggbb=None, legend=None, optional_color=None): if rrggbb is None and not optional_color: raise ValueError, "Colors not defined" if name is None: raise ValueError, "Name not defined" if graph_type is None: raise ValueError, "Graph type not defined" if not isinstance(graph_type, GraphType): raise ValueError, "Invalid graph type %s" % graph_type self._graph_type = graph_type self._name = name self._rrggbb = rrggbb self._legend = legend self._optional_color = optional_color def __str__(self): if self._optional_color and self._rrggbb is None: rest = "" else: if self._rrggbb: rrggbb = "#%s" % self._rrggbb else: rrggbb = "" if self._legend: legend = ":%s" % self._legend else: legend = "" rest = "%s%s" % (rrggbb, legend) return "%s:%s%s" % (self._graph_type, self._name, rest) class HRULE(Graph): "HRULE class" def __init__(self, name, rrggbb=None, legend=None): Graph.__init__(self, name=name, graph_type=_Hrule, rrggbb=rrggbb, legend=legend) class VRULE(Graph): "VRULE class" def __init__(self, name, rrggbb=None, legend=None): Graph.__init__(self, name=name, graph_type=_Vrule, rrggbb=rrggbb, legend=legend) class LINE1(Graph): "LINE1 class" def __init__(self, name, rrggbb=None, legend=None): Graph.__init__(self, name=name, graph_type=_Line1, rrggbb=rrggbb, legend=legend, optional_color=1) class LINE2(Graph): "LINE2 class" def __init__(self, name, rrggbb=None, legend=None): Graph.__init__(self, name=name, graph_type=_Line2, rrggbb=rrggbb, legend=legend, optional_color=1) class LINE3(Graph): "LINE3 class" def __init__(self, name, rrggbb=None, legend=None): Graph.__init__(self, name=name, graph_type=_Line3, rrggbb=rrggbb, legend=legend, optional_color=1) class AREA(Graph): "AREA class" def __init__(self, name, rrggbb=None, legend=None): Graph.__init__(self, name=name, graph_type=_Area, rrggbb=rrggbb, legend=legend, optional_color=1) class STACK(Graph): "STACK class" def __init__(self, name, rrggbb=None, legend=None): Graph.__init__(self, name=name, graph_type=_Stack, rrggbb=rrggbb, legend=legend, optional_color=1) class PRINT(Graph): "PRINT class" _graph_type = _Print def __init__(self, name, cf=None, format=None): self._name = name if cf is None: raise ValueError, "Missing Consolidation Function" self._cf = cf if format is None: raise ValueError, "Missing format" self._format = format def __str__(self): return "%s:%s:%s:%s" % (self._graph_type, self._name, self._cf, self._format) class GPRINT(PRINT): "GPRINT class" _graph_type = _GPrint class COMMENT(Graph): "COMMENT class" _graph_type = _Comment def __init__(self, text): self._text = text def __str__(self): return "%s:%s" % (self._graph_type, self._text) class DataSource: "Class for DS" def __init__(self, name, type=None, heartbeat=300, min=None, max=None): self.name = name self.heartbeat = heartbeat if type is None: raise ValueError, "No Data Source Type specified" if not isinstance(type, DataSourceType): raise ValueError, "Data Source Type not an instance of DataSourceType" self.type = type if min is None: self.min = 'U' else: self.min = int(min) if max is None: self.max = 'U' else: self.max = int(max) def __str__(self): return "DS:%s:%s:%s:%s:%s" % (self.name, self.type, self.heartbeat, self.min, self.max) class RoundRobinArchive: "Class for RRA" def __init__(self, cf=None, xff=None, steps=None, rows=None): if cf is None: raise ValueError, "No Consolidation Function specified" if not isinstance(cf, ConsolidationFunction): raise ValueError, "Consolidation Function not an instance of ConsolidationFunction" self.cf = cf if xff is None: raise ValueError, "xfiles factor not defined" self.xff = float(xff) if steps is None: raise ValueError, "steps not defined" self.steps = int(steps) if rows is None: raise ValueError, "rows not defined" self.rows = int(rows) def __str__(self): return "RRA:%s:%.2f:%s:%s" % (self.cf, self.xff, self.steps, self.rows) class XAxis: "Class for the x-axis" def __init__(self, **kwargs): if not kwargs: # No option specified self.no_grid = 1 return self.no_grid = 0 self.keywords = ['base_grid', 'major_grid', 'label'] unit_keywords = map(lambda x: x + "_unit", self.keywords) delta_keywords = map(lambda x: x + "_delta", self.keywords) precision_keywords = ['label_precision'] strftime_keywords = ['label_strftime'] # Start processing keywords for k in unit_keywords: if not kwargs.has_key(k) or kwargs[k] is None: raise ValueError, "Missing value for keyword %s" % k val = kwargs[k] if not isinstance(val, TimeUnitType): raise ValueError( "Wrong value for keyword %s, expected TimeUnitType" % k) setattr(self, k, val) del kwargs[k] for k in delta_keywords + precision_keywords: if not kwargs.has_key(k) or kwargs[k] is None: raise ValueError, "Missing value for keyword %s" % k val = kwargs[k] try: val = int(val) except ValueError: raise ValueError( "Incorrect value %s for keyword %s, expected int" % (val, k)) setattr(self, k, val) del kwargs[k] for k in strftime_keywords: if not kwargs.has_key(k) or kwargs[k] is None: val = "%X" else: val = kwargs[k] setattr(self, k, val) if kwargs.has_key(k): del kwargs[k] # If more keywords, raise exception if kwargs: raise ValueError("Unknown keywords %s; supported keywords %s" % (kwargs.keys(), unit_keywords + delta_keywords + precision_keywords + strftime_keywords)) def __str__(self): if self.no_grid: return "none" values = map(lambda x, h=self: getattr(h, x), reduce(lambda a, b: a + b, map(lambda x: ["%s_unit" % x, "%s_delta" % x], self.keywords)) + ["label_precision", "label_strftime"]) return str.join(':', map(str, values)) 1.1 py-rrdtool/test.py Index: test.py =================================================================== #!/usr/bin/env python # # test script for rrd.py # # # Copyright 2006, Red Hat, Inc # Mihai Ibanescu <mi...@re...> # # This software may be freely redistributed under the terms of the # Lesser GNU general public license. # # You should have received a copy of the Lesser GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # # Id: test.py 101964 2006-09-08 02:55:53Z misa import sys import time import shutil import rrdtool as rrd def main(): rrd_db = "/tmp/test-rrd" shutil.rmtree(rrd_db, ignore_errors=1) r = rrd.RoundRobinDatabase(rrd_db) heartbeat = 30 # 30-second PDPs for 8 hours r1_steps = 1 r1_rows = 8 * 3600 / (r1_steps * heartbeat) # 5-minute PDPs for 24 hours r2_steps = 10 r2_rows = 24 * 3600 / (r2_steps * heartbeat) # 1-hour PDPs for 7 days r3_steps = 120 r3_rows = 7 * 24 * 3600 / (r3_steps * heartbeat) # 6-hour PDPs for 30 days r4_steps = 6 * 3600 / heartbeat r4_rows = 30 * 24 * 3600 / (r4_steps * heartbeat) # Attempt to provide enough information for the coarsest grained RRA now = int(time.time() / 30) * 30 first = now - r4_steps * r4_rows * heartbeat rras = [ rrd.RoundRobinArchive(cf=rrd.LastCF, xff=0.5, steps=r1_steps, rows=r1_rows) ] # The steps and rows for each RRA srl = [(r2_steps, r2_rows), (r3_steps, r3_rows), (r4_steps, r4_rows)] # Consolidation functions cfl = [rrd.AverageCF, rrd.MaxCF, rrd.MinCF, rrd.LastCF] for steps, rows in srl: for cf in cfl: rras.append(rrd.RoundRobinArchive(cf=cf, xff=0.5, steps=steps, rows=rows)) r.create( rrd.DataSource("tps", type=rrd.GaugeDST, heartbeat=heartbeat), rrd.DataSource("rtps", type=rrd.GaugeDST, heartbeat=heartbeat), rrd.DataSource("wtps", type=rrd.GaugeDST, heartbeat=heartbeat), start=(first-heartbeat), step=heartbeat, *rras) template = ('rtps', 'wtps') t = first while t <= now: #r.update(rrd.Val(1, 1, timestamp=t), template=template) rps = ((t - first) / heartbeat) % 250 wps = 250 - ((t - first) / heartbeat) % 250 tps = max(rps, wps) r.update(rrd.Val(tps, rps, wps, timestamp=t)) t += heartbeat g = rrd.RoundRobinGraph("/tmp/test.png") g.graph( rrd.Def("tps", rrd_db, data_source="tps", cf=rrd.AverageCF), rrd.Def("rtps", rrd_db, data_source="rtps", cf=rrd.AverageCF), rrd.Def("wtps", rrd_db, data_source="wtps", cf=rrd.AverageCF), rrd.LINE1("tps", rrggbb="ff0000", legend="tps"), rrd.LINE1("rtps", rrggbb="00ff00", legend="rtps"), rrd.LINE1("wtps", rrggbb="0000ff", legend="wtps"), alt_y_mrtg=None, width=900, height=200, x="HOUR:1:HOUR:2:HOUR:4:0:%H", title="IO stats", start=(first - heartbeat), end=now, ) if __name__ == '__main__': sys.exit(main() or 0) |
From: Hye-Shik C. <pe...@us...> - 2006-09-13 09:51:53
|
perky 06/09/13 02:51:53 Modified: src _rrdtoolmodule.c Log: - Add Mihai Ibanescu's pythonic rrdtool wrapper. - Update my email address. - Mark this version as 1.0b1. - Apply a patch for rrdtool 1.2. Revision Changes Path 1.15 +26 -15 py-rrdtool/src/_rrdtoolmodule.c Index: _rrdtoolmodule.c =================================================================== RCS file: /cvsroot/py-rrdtool/py-rrdtool/src/_rrdtoolmodule.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- _rrdtoolmodule.c 22 Feb 2003 07:41:19 -0000 1.14 +++ _rrdtoolmodule.c 13 Sep 2006 09:51:53 -0000 1.15 @@ -3,11 +3,11 @@ * * RRDTool Python binding * - * Author : Hye-Shik Chang <pe...@fa...> - * Date : $Date: 2003/02/22 07:41:19 $ + * Author : Hye-Shik Chang <pe...@Fr...> + * Date : $Date: 2006/09/13 09:51:53 $ * Created : 23 May 2002 * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * * ========================================================================== * This file is part of py-rrdtool. @@ -28,7 +28,7 @@ * */ -static const char *__version__ = "$Revision: 1.14 $"; +static const char *__version__ = "$Revision: 1.15 $"; #include "Python.h" #include "rrd.h" @@ -94,7 +94,8 @@ PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); r = NULL; - } else { + } + else { Py_INCREF(Py_None); r = Py_None; } @@ -122,7 +123,8 @@ PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); r = NULL; - } else { + } + else { Py_INCREF(Py_None); r = Py_None; } @@ -154,7 +156,8 @@ PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); r = NULL; - } else { + } + else { /* Return : ((start, end, step), (name1, name2, ...), [(data1, data2, ..), ...]) */ PyObject *range_tup, *dsnam_tup, *data_list, *t; @@ -189,7 +192,8 @@ if (isnan(dv)) { PyTuple_SET_ITEM(t, j, Py_None); Py_INCREF(Py_None); - } else { + } + else { PyTuple_SET_ITEM(t, j, PyFloat_FromDouble((double)dv)); } } @@ -233,15 +237,18 @@ PyObject *r; char **argv, **calcpr; int argc, xsize, ysize, i; + double ymin, ymax; if (create_args("graph", args, &argc, &argv) < 0) return NULL; - if (rrd_graph(argc, argv, &calcpr, &xsize, &ysize) == -1) { + if (rrd_graph(argc, argv, &calcpr, &xsize, &ysize, NULL, + &ymin, &ymax) == -1) { PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); r = NULL; - } else { + } + else { r = PyTuple_New(3); PyTuple_SET_ITEM(r, 0, PyInt_FromLong((long)xsize)); @@ -260,7 +267,8 @@ free(calcpr[i]); } free(calcpr); - } else { + } + else { Py_INCREF(Py_None); PyTuple_SET_ITEM(r, 2, Py_None); } @@ -290,7 +298,8 @@ PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); r = NULL; - } else { + } + else { Py_INCREF(Py_None); r = Py_None; } @@ -316,7 +325,8 @@ PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); r = NULL; - } else + } + else r = PyInt_FromLong((long)ts); destroy_args(&argv); @@ -341,7 +351,8 @@ PyErr_SetString(ErrorObject, rrd_get_error()); rrd_clear_error(); r = NULL; - } else { + } + else { Py_INCREF(Py_None); r = Py_None; } @@ -499,6 +510,6 @@ } /* - * $Id: _rrdtoolmodule.c,v 1.14 2003/02/22 07:41:19 perky Exp $ + * $Id: _rrdtoolmodule.c,v 1.15 2006/09/13 09:51:53 perky Exp $ * ex: ts=8 sts=4 et */ |
From: Hye-Shik C. <pe...@us...> - 2006-09-13 09:28:58
|
perky 06/09/13 02:28:55 Removed: rrdtool __init__.py Log: Clear old package directory. |
From: Hye-Shik C. <pe...@us...> - 2003-12-23 07:40:45
|
perky 03/12/22 23:40:44 Modified: rrdtool __init__.py Log: Use full package path Revision Changes Path 1.7 +3 -3 py-rrdtool/rrdtool/__init__.py Index: __init__.py =================================================================== RCS file: /cvsroot/py-rrdtool/py-rrdtool/rrdtool/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- __init__.py 8 Jan 2003 19:38:22 -0000 1.6 +++ __init__.py 23 Dec 2003 07:40:43 -0000 1.7 @@ -4,10 +4,10 @@ # py-rrdtool package initializer # # Author : Hye-Shik Chang <pe...@fa...> -# Date : $Date: 2003/01/08 19:38:22 $ +# Date : $Date: 2003/12/23 07:40:43 $ # Created : 24 May 2002 # -# $Revision: 1.6 $ +# $Revision: 1.7 $ # # ========================================================================== # This file is part of py-rrdtool. @@ -27,4 +27,4 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -from _rrdtool import * +from rrdtool._rrdtool import * |