try:
image_pixbuf = self.rrdplot.plot_pixbuf()
self.image.set_from_pixbuf(image_pixbuf)
- except:
+ except Exception, e:
+ print str(e)
pass # FIXME: don't ignore all the exceptions
def destroy(self, widget):
if len(args) == 0:
o.error("RRD file not specified")
+if opts.time_start and not opts.time_end:
+ import time
+ opts.time_end = "%d" % (time.time())
+
+if opts.time_start and opts.time_recent:
+ o.error("Can't have both start time and recent")
+
rrd_file = args[0]
# }}}
plotter = rrdplot.plot.RRDPlot()
plotter.load_rrd(rrd_file)
-display_window = DisplayWindow(plotter, opts.refresh)
-display_window.main()
+if opts.ds: plotter.select(opts.ds.split(','))
+if opts.title: plotter.set_title(opts.title)
+if opts.y_title: plotter.set_y_title(opts.title)
+if opts.y_min: plotter.set_y_range(min = opts.y_min)
+if opts.y_max: plotter.set_y_range(max = opts.y_max)
+if opts.y_scale: plotter.set_y_range(scale = opts.y_scale)
+if opts.consolidation_func:
+ plotter.consolidation_function(opts.consolidation_func)
+
+if opts.time_start:
+ plotter.timespan_fixed(int(opts.time_start), int(opts.time_end))
+elif opts.time_recent:
+ plotter.timespan_recent(int(opts.time_recent))
+
+# TODO:
+# * opts.width
+# * opts.height
+
+if opts.operation == 'rrdgraph':
+ cmds = []
+ for c in plotter.rrd_commands():
+ if type(c) == list:
+ cmds += c
+ else:
+ cmds.append(c)
+ for c in cmds:
+ print c
+elif opts.operation == 'png':
+ pass # TODO: use opts.output
+else:
+ display_window = DisplayWindow(plotter, opts.refresh)
+ display_window.main()
#-----------------------------------------------------------------------------
# vim:ft=python:foldmethod=marker