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 ###############################################################################
27 from ..colours
import *
28 from ..constants
import *
31 class GraphTemplateIPv6Fragmentation(base
.GraphTemplate
):
32 name
= "ipv6-fragmentation"
37 "CDEF:ip6_reasm_real_fails=ip6_reasm_fails,ip6_reasm_timeout,-",
40 "AREA:ip6_reasm_real_fails%s:%s" % \
41 (transparency(COLOUR_ERROR
, AREA_OPACITY
),
42 LABEL
% _("Failed Reassemblies"),
44 "GPRINT:ip6_reasm_fails_cur:%s" % INTEGER
,
45 "GPRINT:ip6_reasm_fails_avg:%s" % INTEGER
,
46 "GPRINT:ip6_reasm_fails_min:%s" % INTEGER
,
47 "GPRINT:ip6_reasm_fails_max:%s" % INTEGER
,
49 "AREA:ip6_reasm_timeout%s:%s:STACK" % \
50 (transparency(COLOUR_WARN
, AREA_OPACITY
),
51 LABEL
% _("Reassembly Timeouts"),
53 "GPRINT:ip6_reasm_timeout_cur:%s" % INTEGER
,
54 "GPRINT:ip6_reasm_timeout_avg:%s" % INTEGER
,
55 "GPRINT:ip6_reasm_timeout_max:%s" % INTEGER
,
56 "GPRINT:ip6_reasm_timeout_min:%s" % INTEGER
,
58 "LINE2:ip6_reasm_oks%s:%-24s" % (
60 LABEL
% _("Successful Reassemblies"),
62 "GPRINT:ip6_reasm_oks_cur:%s" % INTEGER
,
63 "GPRINT:ip6_reasm_oks_avg:%s" % INTEGER
,
64 "GPRINT:ip6_reasm_oks_max:%s" % INTEGER
,
65 "GPRINT:ip6_reasm_oks_min:%s" % INTEGER
,
70 "LINE2:ip6_frags_fails%s:%s" % (
72 LABEL
% _("Failed Fragmentations"),
74 "GPRINT:ip6_frags_fails_cur:%s" % INTEGER
,
75 "GPRINT:ip6_frags_fails_avg:%s" % INTEGER
,
76 "GPRINT:ip6_frags_fails_max:%s" % INTEGER
,
77 "GPRINT:ip6_frags_fails_min:%s" % INTEGER
,
79 "LINE2:ip6_frags_oks%s:%-24s" % (
81 LABEL
% _("Fragmented Packets"),
83 "GPRINT:ip6_frags_oks_cur:%s" % INTEGER
,
84 "GPRINT:ip6_frags_oks_avg:%s" % INTEGER
,
85 "GPRINT:ip6_frags_oks_max:%s" % INTEGER
,
86 "GPRINT:ip6_frags_oks_min:%s" % INTEGER
,
89 "COMMENT:%s" % EMPTY_LABEL
,
90 "COMMENT:%s" % (COLUMN
% _("Current")),
91 "COMMENT:%s" % (COLUMN
% _("Average")),
92 "COMMENT:%s" % (COLUMN
% _("Minimum")),
93 "COMMENT:%s\\j" % (COLUMN
% _("Maximum")),
97 def graph_title(self
):
98 if self
.object.interface
:
99 return _("IPv6 Fragmentation on %s") % self
.object.interface
101 return _("IPv6 Fragmentation")
104 def graph_vertical_label(self
):
105 return _("Packets/s")
108 def rrd_graph_args(self
):
111 "--legend-direction=bottomup",
115 class GraphTemplateIPv4Fragmentation(base
.GraphTemplate
):
116 name
= "ipv4-fragmentation"
121 "CDEF:ip4_reasm_real_fails=ip4_reasm_fails,ip4_reasm_timeout,-",
124 "AREA:ip4_reasm_real_fails%s:%s" % \
125 (transparency(COLOUR_ERROR
, AREA_OPACITY
),
126 LABEL
% _("Failed Reassemblies"),
128 "GPRINT:ip4_reasm_fails_cur:%s" % INTEGER
,
129 "GPRINT:ip4_reasm_fails_avg:%s" % INTEGER
,
130 "GPRINT:ip4_reasm_fails_min:%s" % INTEGER
,
131 "GPRINT:ip4_reasm_fails_max:%s" % INTEGER
,
133 "AREA:ip4_reasm_timeout%s:%s:STACK" % \
134 (transparency(COLOUR_WARN
, AREA_OPACITY
),
135 LABEL
% _("Reassembly Timeouts"),
137 "GPRINT:ip4_reasm_timeout_cur:%s" % INTEGER
,
138 "GPRINT:ip4_reasm_timeout_avg:%s" % INTEGER
,
139 "GPRINT:ip4_reasm_timeout_max:%s" % INTEGER
,
140 "GPRINT:ip4_reasm_timeout_min:%s" % INTEGER
,
142 "LINE2:ip4_reasm_oks%s:%-24s" % (
144 LABEL
% _("Successful Reassemblies"),
146 "GPRINT:ip4_reasm_oks_cur:%s" % INTEGER
,
147 "GPRINT:ip4_reasm_oks_avg:%s" % INTEGER
,
148 "GPRINT:ip4_reasm_oks_max:%s" % INTEGER
,
149 "GPRINT:ip4_reasm_oks_min:%s" % INTEGER
,
154 "LINE2:ip4_frags_fails%s:%s" % (
156 LABEL
% _("Failed Fragmentations"),
158 "GPRINT:ip4_frags_fails_cur:%s" % INTEGER
,
159 "GPRINT:ip4_frags_fails_avg:%s" % INTEGER
,
160 "GPRINT:ip4_frags_fails_max:%s" % INTEGER
,
161 "GPRINT:ip4_frags_fails_min:%s" % INTEGER
,
163 "LINE2:ip4_frags_oks%s:%-24s" % (
165 LABEL
% _("Fragmented Packets"),
167 "GPRINT:ip4_frags_oks_cur:%s" % INTEGER
,
168 "GPRINT:ip4_frags_oks_avg:%s" % INTEGER
,
169 "GPRINT:ip4_frags_oks_max:%s" % INTEGER
,
170 "GPRINT:ip4_frags_oks_min:%s" % INTEGER
,
173 "COMMENT:%s" % EMPTY_LABEL
,
174 "COMMENT:%s" % (COLUMN
% _("Current")),
175 "COMMENT:%s" % (COLUMN
% _("Average")),
176 "COMMENT:%s" % (COLUMN
% _("Minimum")),
177 "COMMENT:%s\\j" % (COLUMN
% _("Maximum")),
181 def graph_title(self
):
182 if self
.object.interface
:
183 return _("IPv4 Fragmentation on %s") % self
.object.interface
185 return _("IPv4 Fragmentation")
188 def graph_vertical_label(self
):
189 return _("Packets/s")
192 def rrd_graph_args(self
):
195 "--legend-direction=bottomup",
199 class IPFragmentationObject(base
.Object
):
201 "DS:ip6_frags_oks:DERIVE:0:U",
202 "DS:ip6_frags_fails:DERIVE:0:U",
203 "DS:ip6_frags_creates:DERIVE:0:U",
204 "DS:ip6_reasm_timeout:DERIVE:0:U",
205 "DS:ip6_reasm_reqds:DERIVE:0:U",
206 "DS:ip6_reasm_oks:DERIVE:0:U",
207 "DS:ip6_reasm_fails:DERIVE:0:U",
208 "DS:ip4_frags_oks:DERIVE:0:U",
209 "DS:ip4_frags_fails:DERIVE:0:U",
210 "DS:ip4_frags_creates:DERIVE:0:U",
211 "DS:ip4_reasm_timeout:DERIVE:0:U",
212 "DS:ip4_reasm_reqds:DERIVE:0:U",
213 "DS:ip4_reasm_oks:DERIVE:0:U",
214 "DS:ip4_reasm_fails:DERIVE:0:U",
219 return "<%s %s>" % (self
.__class
__.__name
__, self
.interface
)
221 return "<%s>" % self
.__class
__.__name
__
223 def init(self
, interface
=None):
224 self
.interface
= interface
228 return self
.interface
or "default"
231 p
= util
.ProcNetSnmpParser(self
.interface
)
233 # Description in RFC2465
235 p
.get("Ip6", "FragOKs"),
236 p
.get("Ip6", "FragFails"),
237 p
.get("Ip6", "FragCreates"),
238 p
.get("Ip6", "ReasmTimeout"),
239 p
.get("Ip6", "ReasmReqds"),
240 p
.get("Ip6", "ReasmOKs"),
241 p
.get("Ip6", "ReasmFails"),
242 p
.get("Ip", "FragOKs"),
243 p
.get("Ip", "FragFails"),
244 p
.get("Ip", "FragCreates"),
245 p
.get("Ip", "ReasmTimeout"),
246 p
.get("Ip", "ReasmReqds"),
247 p
.get("Ip", "ReasmOKs"),
248 p
.get("Ip", "ReasmFails"),
254 class IPFragmentationPlugin(base
.Plugin
):
255 name
= "ip-fragmentation"
256 description
= "IP Fragmentation Plugin"
259 GraphTemplateIPv6Fragmentation
,
260 GraphTemplateIPv4Fragmentation
,
266 yield IPFragmentationObject(self
)
268 # Stats per interface
269 for interface
in util
.get_network_interfaces():
270 yield IPFragmentationObject(self
, interface
)