Module: check_mk
Branch: master
Commit: c6895aeabe81b5e4e21b8c8dd2552e1944ff1aa4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c6895aeabe81b5…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Aug 26 14:08:45 2015 +0200
#2423 interface checks: now able to configure absolute levels for error packets
You can now configure absolute levels for the error package rate.
Note: These new levels are configured as a tuple of integers.
The previous version of this check did not distinguish between percentual levels
configured as pair of int or float.
If you configured the old error rates as int tuples (which was an error in the first
place),
you have to update these rules accordingly.
---
.werks/2423 | 15 +++++++++++++++
ChangeLog | 1 +
checks/if.include | 21 ++++++++++++++-------
web/plugins/wato/check_parameters.py | 28 +++++++++++++++++++++-------
4 files changed, 51 insertions(+), 14 deletions(-)
diff --git a/.werks/2423 b/.werks/2423
new file mode 100644
index 0000000..0c52f7e
--- /dev/null
+++ b/.werks/2423
@@ -0,0 +1,15 @@
+Title: interface checks: now able to configure absolute levels for error packets
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1440590161
+Class: feature
+
+You can now configure absolute levels for the error package rate.
+
+Note: These new levels are configured as a tuple of integers.
+The previous version of this check did not distinguish between percentual levels
+configured as pair of int or float.
+If you configured the old error rates as int tuples (which was an error in the first
place),
+you have to update these rules accordingly.
diff --git a/ChangeLog b/ChangeLog
index aa38f76..4aa320f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -63,6 +63,7 @@
* 2511 siemens_plc: Special agent can now be configured to fetch other memory areas
than DB...
* 2421 winperf_phydisk: now able to monitor the average read/write duration for each
disk...
* 2422 winperf_mem: new check to monitor memory pages per second...
+ * 2423 interface checks: now able to configure absolute levels for error packets...
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/checks/if.include b/checks/if.include
index e100031..ae416f9 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -753,16 +753,23 @@ def check_if_common_single(item, params, info, force_counter_wrap =
False,
pacrate = urate + nurate + errorrate
if pacrate > 0.0: # any packets transmitted?
errperc = 100.0 * errorrate / pacrate
-
if errperc > 0:
infotext += ", %s-errors: %.2f%%" % (what,
errperc)
+ if type(err_crit) == float: # percentual levels
+ if errperc >= err_crit:
+ state = 2
+ infotext += "(!!) >= %s%%" %
str(err_crit)
+ elif errperc >= err_warn:
+ state = max(state, 1)
+ infotext += "(!) >= %s%%" %
str(err_warn)
+ elif type(err_crit) == int: # absolute levels
+ if errorrate >= err_crit:
+ state = 2
+ infotext += ", %s-error packets: %d (!!) >=
%s" % (what, errorrate, err_crit)
+ elif errorrate >= err_warn:
+ state = max(state, 1)
+ infotext += ", %s-errors packets: %d (!!) >=
%s" % (what, errorrate, err_warn)
- if err_crit != None and errperc >= err_crit:
- state = 2
- infotext += "(!!) >= " + str(err_crit)
- elif err_warn != None and errperc >= err_warn:
- state = max(state, 1)
- infotext += "(!) >= " + str(err_warn)
# check rate of non-unicast packets
if nucast_crit or nucast_warn:
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index a4342e9..c9f6210 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3107,17 +3107,31 @@ register_check_parameters(
# keys where each was configured with an Alternative valuespec
Transform(Dictionary(
elements = [
- ( "errors",
- Tuple(
+ ( "errors",
+ Alternative(
title = _("Levels for error rates"),
help = _("These levels make the check go warning or critical
whenever the "
- "<b>percentual error rate</b> of the
monitored interface reaches "
- "the given bounds. The error rate is computed by dividing
number of "
+ "<b>percentual error rate</b> or the
<b>absolute error rate</b> of the monitored interface reaches "
+ "the given bounds. The percentual error rate is computed
by dividing number of "
"errors by the total number of packets (successful plus
errors)."),
elements = [
- Percentage(title = _("Warning at"), label =
_("errors"), default_value = 0.01, display_format = '%.3f' ),
- Percentage(title = _("Critical at"), label =
_("errors"), default_value = 0.1, display_format = '%.3f' )
- ])),
+ Tuple(
+ title = _("Percentual levels for error rates"),
+ elements = [
+ Percentage(title = _("Warning at"), unit =
_("percent errors"), default_value = 0.01, display_format = '%.3f' ),
+ Percentage(title = _("Critical at"), unit =
_("percent errors"), default_value = 0.1, display_format = '%.3f' )
+ ]
+ ),
+ Tuple(
+ title = _("Absolute levels for error rates"),
+ elements = [
+ Integer(title = _("Warning at"), unit=
_("errors") ),
+ Integer(title = _("Critical at"), unit =
_("errors") )
+ ]
+ )
+ ]
+ )
+ ),
( "speed",
OptionalDropdownChoice(
title = _("Operating speed"),