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"),
-
- # Limit y axis.
- "--upper-limit", "100",
- "--lower-limit", "0",
- "--rigid",
- ]
-
+ @property
+ def graph_title(self):
+ return _("Memory Usage")
-class MemoryPlugin(base.Plugin):
- name = "memory"
- description = "Memory Usage Data Source"
+ @property
+ def graph_vertical_label(self):
+ return _("Percent")
- templates = [GraphTemplateMemory,]
+class MemoryObject(base.Object):
rrd_schema = [
"DS:used:GAUGE:0:100",
"DS:cached:GAUGE:0:100",
"DS:swap:GAUGE:0:100",
]
- @classmethod
- def autocreate(cls, collecty, **kwargs):
- # Every system has got memory.
- return cls(collecty, **kwargs)
+ @property
+ def id(self):
+ return "default"
- def read(self):
+ def collect(self):
f = None
try:
finally:
if f:
f.close()
+
+
+class MemoryPlugin(base.Plugin):
+ name = "memory"
+ description = "Memory Usage Plugin"
+
+ templates = [GraphTemplateMemory]
+
+ @property
+ def objects(self):
+ yield MemoryObject(self)