]>
git.ipfire.org Git - collecty.git/blob - src/collecty/plugins/loadavg.py
2 ###############################################################################
4 # collecty - A system statistics collection daemon for IPFire #
5 # Copyright (C) 2012 IPFire development team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
26 from ..colours
import *
27 from ..constants
import *
30 class GraphTemplateLoadAvg(base
.GraphTemplate
):
36 "LINE2:load15%s:%s" % (
37 YELLOW
, LABEL
% _("15 Minutes"),
39 "GPRINT:load15_cur:%s" % FLOAT
,
40 "GPRINT:load15_avg:%s" % FLOAT
,
41 "GPRINT:load15_min:%s" % FLOAT
,
42 "GPRINT:load15_max:%s\\j" % FLOAT
,
44 "LINE2:load5%s:%s" % (
45 ORANGE
, LABEL
% _("5 Minutes"),
47 "GPRINT:load5_cur:%s" % FLOAT
,
48 "GPRINT:load5_avg:%s" % FLOAT
,
49 "GPRINT:load5_min:%s" % FLOAT
,
50 "GPRINT:load5_max:%s\\j" % FLOAT
,
52 "LINE2:load1%s:%s" % (
53 RED
, LABEL
% _("1 Minute"),
55 "GPRINT:load1_cur:%s" % FLOAT
,
56 "GPRINT:load1_avg:%s" % FLOAT
,
57 "GPRINT:load1_min:%s" % FLOAT
,
58 "GPRINT:load1_max:%s\\j" % FLOAT
,
61 "COMMENT:%s" % EMPTY_LABEL
,
62 "COMMENT:%s" % (COLUMN
% _("Current")),
63 "COMMENT:%s" % (COLUMN
% _("Average")),
64 "COMMENT:%s" % (COLUMN
% _("Minimum")),
65 "COMMENT:%s\\j" % (COLUMN
% _("Maximum")),
73 def graph_title(self
):
74 return _("Load Average")
77 def graph_vertical_label(self
):
81 def rrd_graph_args(self
):
83 "--legend-direction=bottomup",
87 class LoadAvgObject(base
.Object
):
91 "DS:load15:GAUGE:0:U",
99 return os
.getloadavg()
102 class LoadAvgPlugin(base
.Plugin
):
104 description
= "Load Average Plugin"
106 templates
= [GraphTemplateLoadAvg
]
110 return [LoadAvgObject(self
)]