def _on_graph(self):
for cfg in self._cfg:
size = [str(s) for s in cfg["size"]]
limits = [str(s) for s in cfg["limits"]]
g = [cfg["path"], "--imgformat", "PNG",
"-w", size[0], "-h", size[1],
"--vertical-label", cfg["vlabel"], "-t", cfg["title"],
"-s", str(round(time.time()-cfg["length"])),
"-l", limits[0], "-u", limits[1]]
color_iterator = itertools.cycle(("ff0000", "00ff00", "0000ff",
"ff00ff", "ffff00", "00ffff"))
for entry in cfg["lines"]:
color = next(color_iterator)
g.append(f"DEF:{entry['name']}={entry['path']}:value:AVERAGE")
g.append(f"LINE2:{entry['name']}#{color}:{entry['name']}")
rrdtool.graph(g)
评论列表
文章目录