]>
git.ipfire.org Git - collecty.git/blob - src/collecty/plugins/conntrack.py
2 ###############################################################################
4 # collecty - A system statistics collection daemon for IPFire #
5 # Copyright (C) 2015 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 ###############################################################################
24 from ..colours
import *
25 from ..constants
import *
28 class ConntrackGraphTemplate(base
.GraphTemplate
):
36 "COMMENT:%s" % EMPTY_LABEL
,
37 "COMMENT:%s" % (COLUMN
% _("Current")),
38 "COMMENT:%s" % (COLUMN
% _("Average")),
39 "COMMENT:%s" % (COLUMN
% _("Minimum")),
40 "COMMENT:%s\\j" % (COLUMN
% _("Maximum")),
43 transparency(PRIMARY
, AREA_OPACITY
),
46 "GPRINT:count_cur:%s" % INTEGER
,
47 "GPRINT:count_avg:%s" % INTEGER
,
48 "GPRINT:count_min:%s" % INTEGER
,
49 "GPRINT:count_max:%s" % INTEGER
,
50 "LINE1:count%s" % PRIMARY
,
53 "LINE:max%s:%s:dashes:skipscale" % (
54 COLOUR_CRITICAL
, LABEL
% _("Maximum"),
59 def graph_title(self
):
60 return _("Connection Tracking Table")
63 def graph_vertical_label(self
):
67 class ConntrackObject(base
.Object
):
79 Read count and max values from /proc
82 self
.read_file_integer("/proc/sys/net/netfilter/nf_conntrack_count"),
83 self
.read_file_integer("/proc/sys/net/netfilter/nf_conntrack_max"),
87 class ConntrackPlugin(base
.Plugin
):
89 description
= "Conntrack Plugin"
92 ConntrackGraphTemplate
,
97 yield ConntrackObject(self
)