# A unique name to identify this graph template.
name = None
+ # Headline of the graph image
+ graph_title = None
+
+ # Vertical label of the graph
+ graph_vertical_label = None
+
+ # Limits
+ lower_limit = None
+ upper_limit = None
+
# Instructions how to create the graph.
rrd_graph = None
args += self.rrd_graph_args
+ # Graph title
+ if self.graph_title:
+ args += ["--title", self.graph_title]
+
+ # Vertical label
+ if self.graph_vertical_label:
+ args += ["--vertical-label", self.graph_vertical_label]
+
+ if self.lower_limit is not None or self.upper_limit is not None:
+ # Force to honour the set limits
+ args.append("--rigid")
+
+ if self.lower_limit is not None:
+ args += ["--lower-limit", self.lower_limit]
+
+ if self.upper_limit is not None:
+ args += ["--upper-limit", self.upper_limit]
+
# Add interval
args.append("--start")
"GPRINT:idleavg:%12s\:" % _("Average") + " %6.2lf\\n",
]
- rrd_graph_args = [
- "--title", _("CPU usage"),
- "--vertical-label", _("Jiffies"),
+ lower_limit = 0
- "--lower-limit", "0", "--rigid",
- ]
+ @property
+ def graph_title(self):
+ return _("CPU usage")
+
+ @property
+ def graph_vertical_label(self):
+ return _("Jiffies")
class ProcessorObject(base.Object):
"LINE3:entropytrend#000000",
]
- rrd_graph_args = [
- "--title", _("Available entropy"),
- "--vertical-label", _("Bits"),
+ lower_limit = 0
- "--lower-limit", "0", "--rigid",
- ]
+ @property
+ def graph_title(self):
+ return _("Available entropy")
+
+ @property
+ def graph_vertical_label(self):
+ return _("Bit")
class EntropyObject(base.Object):
]
@property
- def rrd_graph_args(self):
- return [
- "--title", _("Bandwidth usage on %(interface)s"),
- "--vertical-label", _("Bit/s"),
- ]
+ def graph_title(self):
+ return _("Bandwidth usage on %(interface)s")
+
+ @property
+ def graph_vertical_label(self):
+ return _("Bit/s")
class GraphTemplateInterfacePackets(base.GraphTemplate):
]
@property
- def rrd_graph_args(self):
- return [
- "--title", _("Transferred packets on %(interface)s"),
- "--vertical-label", _("Packets/s"),
- ]
+ def graph_title(self):
+ return _("Transferred packets on %(interface)s")
+
+ @property
+ def graph_vertical_label(self):
+ return _("Packets/s")
class GraphTemplateInterfaceErrors(base.GraphTemplate):
]
@property
- def rrd_graph_args(self):
- return [
- "--title", _("Errors/dropped packets on %(interface)s"),
- "--vertical-label", _("Packets/s"),
- ]
+ def graph_title(self):
+ return _("Errors/dropped packets on %(interface)s")
+
+ @property
+ def graph_vertical_label(self):
+ return _("Packets/s")
class InterfaceObject(base.Object):
class GraphTemplateLatency(base.GraphTemplate):
name = "latency"
+ lower_limit = 0
+
@property
def rrd_graph(self):
return [
]
@property
- def rrd_graph_args(self):
- return [
- "--title", _("Latency to %(host)s"),
- "--vertical-label", _("Milliseconds"),
+ def graph_title(self):
+ return _("Latency to %(host)s")
- "--lower-limit", "0", "--rigid",
- ]
+ @property
+ def graph_vertical_label(self):
+ return _("Milliseconds")
class LatencyObject(base.Object):
"LINE:load1#dd0000",
]
- rrd_graph_args = [
- "--title", _("Load average"),
- "--vertical-label", _("Load"),
+ lower_limit = 0
- "--lower-limit", "0", "--rigid",
- ]
+ @property
+ def graph_title(self):
+ return _("Load average")
+
+ @property
+ def graph_vertical_label(self):
+ return _("Load")
class LoadAvgObject(base.Object):
class GraphTemplateMemory(base.GraphTemplate):
name = "memory"
+ upper_limit = 100
+ lower_limit = 0
+
rrd_graph = [
"DEF:used=%(file)s:used:AVERAGE",
"DEF:cached=%(file)s:cached:AVERAGE",
"GPRINT:swapavg:%12s\:" % _("Average") + " %6.2lf\\n",
]
- rrd_graph_args = [
- "--title", _("Memory Usage"),
- "--vertical-label", _("Percent"),
+ @property
+ def graph_title(self):
+ return _("Memory Usage")
- # Limit y axis.
- "--upper-limit", "100",
- "--lower-limit", "0",
- "--rigid",
- ]
+ @property
+ def graph_vertical_label(self):
+ return _("Percent")
class MemoryObject(base.Object):