X-Git-Url: http://git.ipfire.org/?p=collecty.git;a=blobdiff_plain;f=collecty%2Fplugins%2Fmemory.py;h=64cc820b285a314e373869db7fd6d4fef04295d2;hp=952442a60233a73c26d2a3ffcb01a88133e33a0a;hb=b1ea4956360a1bbe790b79860c3ffc1128c4a3c9;hpb=89b70961640108fccc44bca6442dd59ad68a3265 diff --git a/collecty/plugins/memory.py b/collecty/plugins/memory.py index 952442a..64cc820 100644 --- a/collecty/plugins/memory.py +++ b/collecty/plugins/memory.py @@ -25,21 +25,8 @@ import base from ..i18n import _ -class PluginMemory(base.Plugin): +class GraphTemplateMemory(base.GraphTemplate): name = "memory" - description = "Memory Usage Plugin" - - rrd_schema = [ - "DS:used:GAUGE:120:0:100", - "DS:cached:GAUGE:120:0:100", - "DS:buffered:GAUGE:120:0:100", - "DS:free:GAUGE:120:0:100", - "DS:swap:GAUGE:120:0:100", - "RRA:AVERAGE:0.5:1:2160", - "RRA:AVERAGE:0.5:5:2016", - "RRA:AVERAGE:0.5:15:2880", - "RRA:AVERAGE:0.5:60:8760", - ] rrd_graph = [ "DEF:used=%(file)s:used:AVERAGE", @@ -88,6 +75,7 @@ class PluginMemory(base.Plugin): "GPRINT:swapmin:%12s\:" % _("Minimum") + " %6.2lf", "GPRINT:swapavg:%12s\:" % _("Average") + " %6.2lf\\n", ] + rrd_graph_args = [ "--title", _("Memory Usage"), "--vertical-label", _("Percent"), @@ -98,6 +86,25 @@ class PluginMemory(base.Plugin): "--rigid", ] + +class DataSourceMemory(base.DataSource): + name = "memory" + description = "Memory Usage Data Source" + + templates = [GraphTemplateMemory,] + + rrd_schema = [ + "DS:used:GAUGE:120:0:100", + "DS:cached:GAUGE:120:0:100", + "DS:buffered:GAUGE:120:0:100", + "DS:free:GAUGE:120:0:100", + "DS:swap:GAUGE:120:0:100", + "RRA:AVERAGE:0.5:1:2160", + "RRA:AVERAGE:0.5:5:2016", + "RRA:AVERAGE:0.5:15:2880", + "RRA:AVERAGE:0.5:60:8760", + ] + @classmethod def autocreate(cls, collecty, **kwargs): # Every system has got memory.