"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 EntropyPlugin(base.Plugin):
- name = "entropy"
- description = "Entropy Data Source"
-
- templates = [GraphTemplateEntropy,]
+class EntropyObject(base.Object):
rrd_schema = [
"DS:entropy:GAUGE:0:U",
]
- @classmethod
- def autocreate(cls, collecty, **kwargs):
- if not os.path.exists(ENTROPY_FILE):
- self.log.debug(_("Entropy kernel interface does not exist."))
- return
+ @property
+ def id(self):
+ return "default"
- return cls(collecty, **kwargs)
+ def collect(self):
+ with open(ENTROPY_FILE) as f:
+ return f.readline().strip()
- def read(self):
- f = None
- try:
- f = open(ENTROPY_FILE)
- entropy = f.readline()
+class EntropyPlugin(base.Plugin):
+ name = "entropy"
+ description = "Entropy Plugin"
+
+ templates = [GraphTemplateEntropy]
+
+ @property
+ def objects(self):
+ if not os.path.exists(ENTROPY_FILE):
+ self.log.debug(_("Entropy kernel interface does not exist"))
+ return []
- return entropy.strip()
- finally:
- if f:
- f.close()
+ return [EntropyObject(self)]