Module: check_mk
Branch: master
Commit: 0330957b1c1c4ac434060e9a5d864ad711a2ed9e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0330957b1c1c4a…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Jul 31 10:32:49 2014 +0200
#0189 docsis_channels: Support for Frequency of Downstream Channels for Devices with
DOCSIS MIB
---
.werks/189 | 8 ++++
ChangeLog | 1 +
checkman/docsis_channels | 14 -------
checks/docsis_channels | 69 ++++++++++++++++++++++------------
modules/check_mk.py | 2 +
web/plugins/wato/check_parameters.py | 22 +++++++----
6 files changed, 70 insertions(+), 46 deletions(-)
diff --git a/.werks/189 b/.werks/189
new file mode 100644
index 0000000..0530618
--- /dev/null
+++ b/.werks/189
@@ -0,0 +1,8 @@
+Title: docsis_channels: Support for Frequency of Downstream Channels for Devices with
DOCSIS MIB
+Level: 1
+Component: checks
+Version: 1.2.5i6
+Date: 1406795521
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 5de59cb..2ab8d2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
* 0186 touchstone_cable_modem_fec: New Check to monitor the Forward error correction
on touchstone cable modems
* 1068 livedump: Added optional check interval (detect staleness) / option to encrypt
mails...
* 0188 touchstone_cable_modem_frequency: New check for line frequency in Mhz
+ * 0189 docsis_channels: Support for Frequency of Downstream Channels for Devices with
DOCSIS MIB
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checkman/docsis_channels b/checkman/docsis_channels
deleted file mode 100644
index 6686176..0000000
--- a/checkman/docsis_channels
+++ /dev/null
@@ -1,14 +0,0 @@
-title: DOCSIS: Frequency
-agents: snmp
-catalog: hw/network/arris
-license: GPL
-distribution:
-description:
- This check monitors the frequency on the modem line in Mhz. Levels for {WARN} and {CRIT}
can be set.
-
-item:
- None
-
-inventory:
- One service will be created
-
diff --git a/checks/docsis_channels b/checks/docsis_channels
index 030fa65..7fb84f9 100644
--- a/checks/docsis_channels
+++ b/checks/docsis_channels
@@ -24,32 +24,53 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-docsis_channels_default_levels = ( 155, 163 )
+factory_settings["docsis_channels_downstream"] = {
+ "frequency": ( 155 , 163 ),
+}
-def inventory_docsis_channels(info):
- return [ (None, "docsis_channels_default_levels") ]
+def inventory_docsis_channels_downstream(info):
+ for line in info:
+ if line[1] != '0':
+ yield line[0], {}
-def check_docsis_channels(_no_item, params, info):
- mhz = int(info[0][0]) / 1000000
- infotext = "Current Frequence is %d Mhz" % mhz
- warn, crit = params
- perfdata = [("frequence" , mhz, warn, crit )]
- levels = " (Levels Warn/Crit at %d Mhz/ %d Mhz)" % ( warn, crit )
- state = 0
- if mhz >= crit:
- state = 2
- infotext += levels
- elif mhz >= warn:
- state = 1
- infotext += levels
- return state, infotext, perfdata
+def check_docsis_channels_downstream( item, params, info):
+ for channel_id, frequency in info:
+ if channel_id == item:
+ frequency_mhz = int(frequency) / 1000000
+ # Check Frequency
+ infotext = "Current Frequence is %d Mhz" % frequency_mhz
+ warn, crit = params["frequency"]
+ perfdata = [("frequence" , frequency_mhz, warn, crit )]
+ levels = " (Levels Warn/Crit at %d Mhz/ %d Mhz)" % ( warn, crit )
+ state = 0
+ if frequency_mhz >= crit:
+ state = 2
+ infotext += levels
+ elif frequency_mhz >= warn:
+ state = 1
+ infotext += levels
+ # Change this to yield in case of future extension of the check
+ return state, infotext, perfdata
-check_info["docsis_channels"] = {
- "check_function" : check_docsis_channels,
- "inventory_function" : inventory_docsis_channels,
- "service_description" : "Frequency",
- "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.4115.820.1.0.0.0.0.0",
- "snmp_info" : ( ".1.3.6.1.2.1.10.127.1.1.1.1.2", [
3 ]),
- "group" : "docsis_channels",
+# This Check is a subcheck because there is also a upstream version possible
+check_info["docsis_channels.downstream"] = {
+ "check_function" : check_docsis_channels_downstream,
+ "inventory_function" : inventory_docsis_channels_downstream,
+ "service_description" : "Channel Downstream %s",
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
in [ ".1.3.6.1.4.1.4115.820.1.0.0.0.0.0",
+ ".1.3.6.1.4.1.9.1.827" ],
+ "snmp_info" : ( ".1.3.6.1.2.1.10.127.1.1.1.1", [
1, # Channel ID
+ 2, # Frequency
+ ]),
+ "group" : "docsis_channels_downstream",
+ "default_levels_variable" : "docsis_channels_downstream",
}
+# Information for future extensions of the check:
+# docsIfDownChannelId 1.3.6.1.2.1.10.127.1.1.1.1.1
+# docsIfDownChannelFrequency 1.3.6.1.2.1.10.127.1.1.1.1.2
+# docsIfDownChannelWidth 1.3.6.1.2.1.10.127.1.1.1.1.3
+# docsIfDownChannelModulation 1.3.6.1.2.1.10.127.1.1.1.1.4
+# docsIfDownChannelInterleave 1.3.6.1.2.1.10.127.1.1.1.1.5
+# docsIfDownChannelPower 1.3.6.1.2.1.10.127.1.1.1.1.6
+# docsIfDownChannelAnnex 1.3.6.1.2.1.10.127.1.1.1.1.7
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 8c03880..95a433c 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -6162,9 +6162,11 @@ if __name__ == "__main__":
except MKGeneralException, e:
+ print "hioer:"
sys.stderr.write("%s\n" % e)
if opt_debug:
raise
+ print "nein"
sys.exit(3)
# handle -I / -II
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 65c9ba9..3b3b9ba 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1343,17 +1343,23 @@ register_check_parameters(
register_check_parameters(
subgroup_networking,
- "docsis_channels",
- _("Modem Frequencies for Docsis"), # Name can be changed if the rule is
used for another check
- Tuple(
- help = _("Levels for the frequencies of network devices like modems."
),
+ "docsis_channels_downstream",
+ _("Docsis Downstream Channels"),
+ Dictionary(
elements = [
- Integer(title = _("warning if at"), unit = "Mhz",
default_value = 155 ),
- Integer(title = _("critical if at"), unit = "Mhz",
default_value = 163 ),
- ]),
- None,
+ ( "frequency", Tuple(
+ title = _("Frequency"),
+ help = _("Levels for the frequencies of Downstram Channels of Docsis
Devices" ),
+ elements = [
+ Integer(title = _("warning if at"), unit = "Mhz",
default_value = 155 ),
+ Integer(title = _("critical if at"), unit =
"Mhz", default_value = 163 ),
+ ])),
+ ]
+ ),
+ TextAscii( title = _("ID of the Channel")),
"first"
)
+
register_check_parameters(
subgroup_networking,
"vpn_tunnel",