Module: check_mk
Branch: master
Commit: fb0fff394b34187b93f88a81f37a69dc43a809eb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fb0fff394b3418…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Feb 23 15:09:03 2015 +0100
#2036 docsis_channels_upstream: Add handling for codewords (WATO rule, rate computation,
Perf-O-Meter)
---
.werks/2036 | 9 ++++++++
ChangeLog | 1 +
checks/docsis_channels_upstream | 38 ++++++++++++++++++++++++++++++----
web/plugins/metrics/check_mk.py | 31 +++++++++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 12 +++++------
web/plugins/wato/check_parameters.py | 14 +++++++++++++
6 files changed, 95 insertions(+), 10 deletions(-)
diff --git a/.werks/2036 b/.werks/2036
new file mode 100644
index 0000000..a966729
--- /dev/null
+++ b/.werks/2036
@@ -0,0 +1,9 @@
+Title: docsis_channels_upstream: Add handling for codewords (WATO rule, rate computation,
Perf-O-Meter)
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1424700519
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 45f91fb..5abda72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -91,6 +91,7 @@
* 1889 cmciii.phase: New check to monitor input phases for Raritan PDUs
* 2005 services: change service description from service_ to Service or new
installations
* 1862 netscaler_vserver: new check to monitor VServers on Citrix Netscaler
Appliance
+ * 2036 docsis_channels_upstream: Add handling for codewords (WATO rule, rate
computation, Perf-O-Meter)
* 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/checks/docsis_channels_upstream b/checks/docsis_channels_upstream
index 6b9ce5e..5345b1c 100644
--- a/checks/docsis_channels_upstream
+++ b/checks/docsis_channels_upstream
@@ -25,7 +25,9 @@
# Boston, MA 02110-1301 USA.
factory_settings["docsis_channels_upstream_default_levels"] = {
- "signal_noise" : ( 10.0, 5.0 ), # dB
+ "signal_noise" : ( 10.0, 5.0 ), # dB
+ "corrected" : ( 5.0, 8.0 ), # Percent
+ "uncorrectable" : ( 1.0, 2.0 ), # Percent
}
def docsis_channels_upstream_convert(info):
@@ -80,9 +82,6 @@ def check_docsis_channels_upstream(item, params, info):
fields = [
( "frequency", float(mhz) / 1000000, "Frequency",
"%.2f", " MHz"),
- ( "unerroreds", int(unerroreds), "codewords without
errors", "%d", "" ),
- ( "correcteds", int(correcteds), "corrected
errors", "%d", "" ),
- ( "uncorrectables", int(uncorrectables), "uncorrectable
errors", "%d", "" ),
]
if len(entry) >= 10:
total, active, registered, avg_util = entry[6:10]
@@ -96,6 +95,37 @@ def check_docsis_channels_upstream(item, params, info):
for varname, value, title, form, unit in fields:
yield 0, title + ": " + (form + "%s") % (value, unit), [
(varname, value) ]
+ # Handle codewords. These are counters.
+ now = time.time()
+ rates = {}
+ total_rate = 0.0
+ for what, counter in [
+ ( "unerrored", int(unerroreds), ),
+ ( "corrected", int(correcteds), ),
+ ( "uncorrectable", int(uncorrectables)),
+ ]:
+ rate = get_rate("docsis_channels_upstream.%s.%s" % (item, what),
now, counter)
+ rates[what] = rate
+ total_rate += rate
+
+ if total_rate:
+ for what, title in [
+ ( "corrected", "corrected errors", ),
+ ( "uncorrectable", "uncorrectable errors", )]:
+ ratio = rates[what] / total_rate
+ perc = 100.0 * ratio
+ warn, crit = params[what]
+ infotext = "%s %s" % (get_percent_human_readable(perc), title)
+ levelstext = " (warn/crit at %.1f/%.1f%%)" % (warn, crit)
+ if perc >= crit:
+ state = 2
+ infotext += levelstext
+ elif perc >= crit:
+ state = 1
+ infotext += levelstext
+ else:
+ state = 0
+ yield state, infotext, [ ("codewords_" + what, ratio,
warn/100.0, crit/100.0) ]
return
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index 749fe85..644a742 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -123,6 +123,13 @@ unit_info["dbm"] = {
"render" : lambda v: "%s %s" % (drop_dotzero(v),
_("dBm")),
}
+unit_info["db"] = {
+ "title" : _("Decibel"),
+ "symbol" : _("dB"),
+ "render" : lambda v: physical_precision(v, 3, _("dB")),
+}
+
+
#.
# .--Metrics-------------------------------------------------------------.
@@ -344,6 +351,24 @@ metric_info["busy_workers"] = {
"color" : "#a080b0",
}
+metric_info["signal_noise"] = {
+ "title" : _("Signal/Noise Ratio"),
+ "unit" : "db",
+ "color" : "#aadd66",
+}
+
+metric_info["codewords_corrected"] = {
+ "title" : _("Corrected Codewords"),
+ "unit" : "ratio",
+ "color" : "#ff8040",
+}
+
+metric_info["codewords_uncorrectable"] = {
+ "title" : _("Uncorrectable Codewords"),
+ "unit" : "ratio",
+ "color" : "#ff4020",
+}
+
#.
# .--Checks--------------------------------------------------------------.
@@ -480,6 +505,7 @@ check_metrics["check_mk-ups_socomec_outphase"]
= {}
check_metrics["check_mk-bluecoat_sensors"] = {}
check_metrics["check_mk-zfs_arc_cache"] = {
"hit_ratio" : { "scale" : 0.01 }}
+check_metrics["check_mk-docsis_channels_upstream"] = {}
#.
# .--Perf-O-Meters-------------------------------------------------------.
@@ -534,6 +560,11 @@ perfometer_info.append(("stacked", [
( "logarithmic", ( "busy_workers", 10, 2))]))
perfometer_info.append(("linear", ( [ "hit_ratio" ], 1.0,
None)))
+perfometer_info.append(("stacked", [
+ ("logarithmic", ( "signal_noise", 50.0, 2.0)),
+ ("linear", ( [ "codewords_corrected",
"codewords_uncorrectable" ], 1.0, None)),
+]))
+perfometer_info.append(("logarithmic", ( "signal_noise", 50.0,
2.0))) # Fallback if no codewords are available
#.
# .--Graphs--------------------------------------------------------------.
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 68a1070..7df6fcf 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -1085,12 +1085,6 @@ def perfometer_dbmv(row, check_command, perf_data):
perfometers["check_mk-docsis_channels_downstream"] = perfometer_dbmv
perfometers["check_mk-docsis_cm_status"] = perfometer_dbmv
-def perfometer_docsis_snr(row, check_command, perf_data):
- dbmv = float(perf_data[0][1])
- return "%.1f dB" % dbmv, perfometer_logarithmic(dbmv, 50, 2,
"#ad6")
-
-perfometers["check_mk-docsis_channels_upstream"] = perfometer_docsis_snr
-
def perfometer_veeam_client(row, check_command, perf_data):
for graph in perf_data:
if graph[0] == "avgspeed":
@@ -1264,3 +1258,9 @@ def perfometer_check_mk_cpu_threads(row, check_command, perf_data):
return "%d" % int(perf_data[0][1]), perfometer_logarithmic(perf_data[0][1],
400, 2, color)
perfometers["check_mk-cpu.threads"] = perfometer_check_mk_cpu_threads
+
+def perfometer_docsis_snr(row, check_command, perf_data):
+ dbmv = float(perf_data[0][1])
+ return "%.1f dB" % dbmv, perfometer_logarithmic(dbmv, 50, 2,
"#ad6")
+
+perfometers["check_mk-docsis_channels_upstream"] = perfometer_docsis_snr
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 43118a0..dd74933 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1573,6 +1573,20 @@ register_check_parameters(
Float(title = _("Critical at or below"), unit =
"dB", default_value = 5.0 ),
]
)),
+ ( 'correcteds', Tuple(
+ title = _("Levels for rate of corrected errors"),
+ elements = [
+ Percentage(title = _("Warning at"), default_value = 5.0),
+ Percentage(title = _("Critical at"), default_value = 8.0),
+ ]
+ )),
+ ( 'uncorrectables', Tuple(
+ title = _("Levels for rate of uncorrectable errors"),
+ elements = [
+ Percentage(title = _("Warning at"), default_value = 1.0),
+ Percentage(title = _("Critical at"), default_value = 2.0),
+ ]
+ )),
]
),
TextAscii(title = _("ID of the channel (usually ranging from 1)")),