pvl/rrd/api.py
changeset 155 9f2967ba81ef
parent 148 92fd0898188d
child 232 5894c70dc6a8
equal deleted inserted replaced
154:11df86fd2d67 155:9f2967ba81ef
    43     pre = pvl.invoke.optargs(*pre)
    43     pre = pvl.invoke.optargs(*pre)
    44     post = pvl.invoke.optargs(*post)
    44     post = pvl.invoke.optargs(*post)
    45 
    45 
    46     return func(*(pre + opts + post))
    46     return func(*(pre + opts + post))
    47 
    47 
    48 def graph (out=None, *args, **opts) :
    48 def graph (out=None, *defs, **opts) :
    49     """
    49     """
    50         Render a graph image and/or print a report from data stored in one or several RRDs.
    50         Render a graph image and/or print a report from data stored in one or several RRDs.
    51         
    51         
    52             out     - None  -> tempfile
    52             out     - None  -> tempfile
    53                     - False -> stdout
    53                     - False -> stdout
    78         out_file = True # open later
    78         out_file = True # open later
    79     
    79     
    80     log.debug("%s", out_path)
    80     log.debug("%s", out_path)
    81 
    81 
    82     # XXX: handle tempfile close?
    82     # XXX: handle tempfile close?
    83     width, height, out_lines = cmd(rrdtool.graph, (out_path, ), opts, args)
    83     width, height, out_lines = cmd(rrdtool.graph, (out_path, ), opts, defs)
    84 
    84 
    85     if out_file is True :
    85     if out_file is True :
    86         out_file = open(out_path)
    86         out_file = open(out_path)
    87             
    87             
    88     return (width, height), out_lines, out_file
    88     return (width, height), out_lines, out_file