Module: check_mk
Branch: master
Commit: 1e9d49caceebd752bcdf5ab05cb44e9b6bee3d05
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1e9d49caceebd7…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Tue Mar 10 13:14:15 2015 +0100
#2100 if64: check can now impose limits on the number of outgoing and incoming non-unicast
packets per second
---
.werks/2100 | 9 +++++++++
ChangeLog | 1 +
checkman/if64 | 4 ++++
checks/if.include | 33 ++++++++++++++++++++++++++-------
web/plugins/wato/check_parameters.py | 26 ++++++++++++++++++--------
5 files changed, 58 insertions(+), 15 deletions(-)
diff --git a/.werks/2100 b/.werks/2100
new file mode 100644
index 0000000..fb74ea2
--- /dev/null
+++ b/.werks/2100
@@ -0,0 +1,9 @@
+Title: if64: check can now impose limits on the number of outgoing and incoming
non-unicast packets per second
+Level: 2
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1425989574
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index db23c0d..14b1041 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -119,6 +119,7 @@
* 1225
sansymphony_alerts,sansymphony_pool,sansymphony_ports,sansymphony_serverstatus,sansymphony_virtualdiskstatus:
New Checks for Datacore Sansymphony...
* 2056 winperf_processor: additionally reports user and privileged(system) time...
* 1226 mysql: New check to show the version of the mysql deamon
+ * 2100 if64: check can now impose limits on the number of outgoing and incoming
non-unicast packets per second
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checkman/if64 b/checkman/if64
index 9c2421d..69210ed 100644
--- a/checkman/if64
+++ b/checkman/if64
@@ -150,6 +150,10 @@ parameters (dict): Due to its complexity, this check now uses a
dictionary as
as bits or bytes, too. When this parameter is set to "bit"
any traffic related plugin output
is reported in bits instead of bytes(default).
+ {"nucasts"} - a pair of two float values to be used as
WARN/CRIT
+ level for the number of non-unicast packets per second. If this value
is not set,
+ no levels are imposed, which is also the default.
+
[configuration]
if_inventory_porttypes (list of strings): List of interface types the inventory should
create checks for.
Default is {[ '6', '32', '117' ]}, which means that all
Ethernet, Frame Relay and Gigabit Ethernet ports
diff --git a/checks/if.include b/checks/if.include
index a972cd5..3fd102b 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -422,6 +422,12 @@ def check_if_common_single(item, params, info, force_counter_wrap =
False, has_n
else:
err_warn, err_crit = None, None
+ # broadcast storm detection is turned off by default
+ if "nucasts" in params:
+ nucast_warn, nucast_crit = params["nucasts"]
+ else:
+ nucast_warn, nucast_crit = None, None
+
# Traffic checking might be turned off
if "traffic" in params:
bw_warn_param, bw_crit_param = params["traffic"]
@@ -595,13 +601,13 @@ def check_if_common_single(item, params, info, force_counter_wrap =
False, has_n
for name, counter, warn, crit, mmin, mmax in [
( "in", ifInOctets, bw_warn_in, bw_crit_in, 0,
speed_b_in),
( "inucast", inucast, None, None, None, None),
- ( "innucast", saveint(inmcast) + saveint(inbcast), None, None,
None, None),
+ ( "innucast", saveint(inmcast) + saveint(inbcast),
nucast_warn, nucast_crit, None, None),
( "indisc", ifInDiscards, None, None, None, None),
( "inerr", ifInErrors, err_warn, err_crit, None, None),
( "out", ifOutOctets, bw_warn_out, bw_crit_out, 0,
speed_b_out),
( "outucast", outucast, None, None, None, None),
- ( "outnucast", saveint(outmcast) + saveint(outbcast), None,
None, None, None),
+ ( "outnucast", saveint(outmcast) + saveint(outbcast),
nucast_warn, nucast_crit, None, None),
( "outdisc", ifOutDiscards, None, None, None, None),
( "outerr", ifOutErrors, err_warn, err_crit, None, None) ]:
@@ -636,9 +642,10 @@ def check_if_common_single(item, params, info, force_counter_wrap =
False, has_n
else:
return "%s/s" % get_bytes_human_readable(value)
- for what, errorrate, okrate, traffic, speed, bw_warn, bw_crit,
bw_warn_min, bw_crit_min in \
- [ ("in", rates[4], rates[1] + rates[2], rates[0], speed_in,
bw_warn_in, bw_crit_in, bw_warn_min_in, bw_crit_min_in),
- ("out", rates[9], rates[6] + rates[7], rates[5],
speed_out, bw_warn_out, bw_crit_out, bw_warn_min_out, bw_crit_min_out) ]:
+ # loop over incoming and outgoing traffic
+ for what, errorrate, urate, nurate, traffic, speed, bw_warn, bw_crit,
bw_warn_min, bw_crit_min in \
+ [ ("in", rates[4], rates[1], rates[2], rates[0], speed_in,
bw_warn_in, bw_crit_in, bw_warn_min_in, bw_crit_min_in),
+ ("out", rates[9], rates[6], rates[7], rates[5], speed_out,
bw_warn_out, bw_crit_out, bw_warn_min_out, bw_crit_min_out) ]:
infotext += ", %s: %s" % (what, format_value(traffic))
@@ -671,9 +678,10 @@ def check_if_common_single(item, params, info, force_counter_wrap =
False, has_n
state = max(state, 1)
infotext += ' (!) >= ' + format_value(bw_warn_min)
- pacrate = okrate + errorrate
+ # check percentage of error packets
+ pacrate = urate + nurate + errorrate
if pacrate > 0.0: # any packets transmitted?
- errperc = 100.0 * errorrate / (okrate + errorrate)
+ errperc = 100.0 * errorrate / pacrate
if errperc > 0:
infotext += ", %s-errors: %.2f%%" % (what,
errperc)
@@ -685,6 +693,17 @@ def check_if_common_single(item, params, info, force_counter_wrap =
False, has_n
state = max(state, 1)
infotext += "(!) >= " + str(err_warn)
+ # check rate of non-unicast packets
+ if nucast_crit or nucast_warn:
+ infotext += ", %s non-unicast packets %.2f/s" % (what,
nurate)
+
+ if nucast_crit and nurate >= nucast_crit:
+ state = 2
+ infotext += "(!!) >= " + str(nucast_crit)
+ elif nucast_warn and nurate >= nucast_warn:
+ state = max(state,1)
+ infotext += "(!) >= " + str(nucast_warn)
+
if node:
cluster_items[node] = ( state, infotext, perfdata )
else:
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 01a9565..0af05ae 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2500,7 +2500,7 @@ register_check_parameters(
( "traffic",
Alternative(
title = _("Used bandwidth (maximum traffic)"),
- help = _("Settings levels on the used bandwidth is optional. If
you do set "
+ help = _("Setting levels on the used bandwidth is optional. If
you do set "
"levels you might also consider using an
averaging."),
elements = [
Tuple(
@@ -2519,11 +2519,11 @@ register_check_parameters(
]
)
])
- ),
+ ),
( "traffic_minimum",
Alternative(
title = _("Used bandwidth (minimum traffic)"),
- help = _("Settings levels on the used bandwidth is optional. If
you do set "
+ help = _("Setting levels on the used bandwidth is optional. If
you do set "
"levels you might also consider using an
averaging."),
elements = [
Tuple(
@@ -2542,9 +2542,20 @@ register_check_parameters(
]
)
])
- ),
+ ),
+ ( "nucasts",
+ Tuple(
+ title = _("Non-unicast packet rates"),
+ help = _("Setting levels on non-unicast packet rates is
optional. This may help "
+ "to detect broadcast storms and other unwanted
traffic."),
+ elements = [
+ Integer(title = _("Warning at"), unit = _("pkts
/ sec")),
+ Integer(title = _("Critical at"), unit =
_("pkts / sec")),
+ ]
+ ),
+ ),
- ( "average",
+ ( "average",
Integer(
title = _("Average values"),
help = _("By activating the computation of averages, the levels
on "
@@ -2555,10 +2566,9 @@ register_check_parameters(
minvalue = 1,
default_value = 15,
)
- ),
-
+ ),
- ]),
+ ]),
TextAscii(
title = _("port specification"),
allow_empty = False),