[checkmk-commits] Check_MK Git: check_mk: docsis_channels_downstream: Added transmit power as output

Bastian Kuhn bk at mathias-kettner.de
Fri Aug 1 11:47:28 CEST 2014


Module: check_mk
Branch: master
Commit: 765173b27beaf82a7e6f0506e3027caab08b7b8d
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=765173b27beaf82a7e6f0506e3027caab08b7b8d

Author: Bastian Kuhn <bk at mathias-kettner.de>
Date:   Fri Aug  1 11:47:16 2014 +0200

docsis_channels_downstream: Added transmit power as output

---

 checkman/docsis_channels_downstream  |    3 ++-
 checks/docsis_channels_downstream    |   29 ++++++++++++++++++++++++-----
 web/plugins/wato/check_parameters.py |   13 ++++++++++---
 3 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/checkman/docsis_channels_downstream b/checkman/docsis_channels_downstream
index dd4a83e..95fed91 100644
--- a/checkman/docsis_channels_downstream
+++ b/checkman/docsis_channels_downstream
@@ -4,7 +4,8 @@ catalog: hw/network/arris
 license: GPL
 distribution:
 description:
- This check monitors currently only montiors the frequency for each channel in Mhz. Additional information are available but not yet implemented.
+ This check monitors the frequency for each channel in Mhz and the the current operational transmit power. Levels for each value can be set.
+ Additional information are available but not implemented yet.
 
 item:
  Channel ID
diff --git a/checks/docsis_channels_downstream b/checks/docsis_channels_downstream
index 4669f3a..71ecba0 100644
--- a/checks/docsis_channels_downstream
+++ b/checks/docsis_channels_downstream
@@ -25,7 +25,8 @@
 # Boston, MA 02110-1301 USA.
 
 factory_settings["docsis_channels_downstream"] = {
-    "frequency":           ( 155 , 163 ), 
+    "frequency" :           ( 155 , 163 ), 
+    "power"     :           ( 250 , 260 ), 
 }
 
 def inventory_docsis_channels_downstream(info):
@@ -34,11 +35,25 @@ def inventory_docsis_channels_downstream(info):
             yield line[0], {}
 
 def check_docsis_channels_downstream( item, params, info):
-    for channel_id, frequency in info:
+    for channel_id, frequency, power in info:
         if channel_id == item:
-            frequency_mhz = int(frequency) / 1000000
+            # Power
+            warn, crit = params["power"]
+            power_dbmv = int(power)
+            infotext = "Power is %d dBmV" % power_dbmv
+            levels = " (Levels Warn/Crit at %d dBmV/ %d dBmV)" % ( warn, crit )
+            state = 0
+            if power_dbmv >= crit:
+                state = 2
+                infotext += power
+            elif power_dbmv >= warn:
+                state = 1
+                infotext += power
+            yield state, infotext, [ ('power', power_dbmv, warn, crit ) ]
+
             # Check Frequency
-            infotext = "Current Frequence is %d Mhz" % frequency_mhz
+            frequency_mhz = int(frequency) / 1000000
+            infotext = "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 )
@@ -50,7 +65,10 @@ def check_docsis_channels_downstream( item, params, info):
                 state  = 1
                 infotext += levels
             # Change this to yield in case of future extension of the check
-            return state, infotext, perfdata
+            yield state, infotext, perfdata
+            return
+    yield 3, "Channel information not found in output"
+
 
 # This Check is a subcheck because there is also a upstream version possible 
 check_info["docsis_channels_downstream"] = {
@@ -60,6 +78,7 @@ check_info["docsis_channels_downstream"] = {
     "snmp_scan_function"      : docsis_scan_function, 
     "snmp_info"               : ( ".1.3.6.1.2.1.10.127.1.1.1.1", [  1, # Channel ID
                                                                     2, # Frequency 
+                                                                    5, # Power
                                                                     ]),
     "group"                   : "docsis_channels_downstream",
     "default_levels_variable" : "docsis_channels_downstream",
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index ba2a544..79ace8f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1354,12 +1354,19 @@ register_check_parameters(
     _("Docsis Downstream Channels"), 
     Dictionary(
         elements = [
+            ( "power", Tuple(
+                title = _("Power"),
+                help = _(" The operational transmit power"),
+                elements = [
+                    Integer(title = _("warning at"), unit = "dBmV", default_value = 250 ),
+                    Integer(title = _("critical at"), unit = "dBmV", default_value = 260 ),
+                ])),
             ( "frequency", Tuple(
                 title = _("Frequency"),
-                help = _("Levels for the frequencies of Downstram Channels of Docsis Devices" ),
+                help = _("The current tuner frequency"),
                 elements = [
-                    Integer(title = _("warning if at"), unit = "Mhz", default_value = 155 ),
-                    Integer(title = _("critical if at"), unit = "Mhz", default_value = 163 ),
+                    Integer(title = _("warning at"), unit = "Mhz", default_value = 155 ),
+                    Integer(title = _("critical at"), unit = "Mhz", default_value = 163 ),
                 ])),
         ]
     ),



More information about the checkmk-commits mailing list