]> git.ipfire.org Git - collecty.git/blobdiff - src/collecty/plugins/base.py
Generate graphs in memory
[collecty.git] / src / collecty / plugins / base.py
index 476c134785a7d1dc95e3a4de0f4db646babedecc..004b2a16779476631e5108a15214ec8350c3d23e 100644 (file)
@@ -483,17 +483,9 @@ class GraphTemplate(object):
 
                        self.log.debug("  %s" % args[-1])
 
-               return self.write_graph(*args)
-
-       def write_graph(self, *args):
-               # Convert all arguments to string
+               # Convert arguments to string
                args = [str(e) for e in args]
 
-               with tempfile.NamedTemporaryFile() as f:
-                       rrdtool.graph(f.name, *args)
-
-                       # Get back to the beginning of the file
-                       f.seek(0)
+               graph = rrdtool.graphv("-", *args)
 
-                       # Return all the content
-                       return f.read()
+               return graph.get("image")