[checkmk-commits] Check_MK Git: check_mk: #0645 FIX brocade_fcport: since in newer firmware ( 7.*) swFCPortSpeed is deprecated, we then calculate port speed from IF-MIB: :ifHighSpeed

Goetz Golla gg at mathias-kettner.de
Mon Aug 18 10:59:48 CEST 2014


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

Author: Goetz Golla <gg at mathias-kettner.de>
Date:   Mon Aug 18 10:59:35 2014 +0200

#0645 FIX brocade_fcport: since in newer firmware (7.*) swFCPortSpeed is deprecated, we then calculate port speed from IF-MIB::ifHighSpeed

---

 .werks/645              |    9 +++++++++
 ChangeLog               |    1 +
 checkman/brocade_fcport |   18 +++++++++---------
 checks/brocade_fcport   |   26 ++++++++++++++++++++------
 4 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/.werks/645 b/.werks/645
new file mode 100644
index 0000000..e83e27b
--- /dev/null
+++ b/.werks/645
@@ -0,0 +1,9 @@
+Title: brocade_fcport: since in newer firmware (7.*) swFCPortSpeed is deprecated, we then calculate port speed from IF-MIB::ifHighSpeed
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1408352237
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 2cf9c9e..17cce96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@
             NOTE: Please refer to the migration notes!
     * 1152 FIX: mk-job: The check now captures currently running jobs and their start time...
     * 0198 FIX: cisco_temp_sensor: Removed dicey detection for temperature value....
+    * 0645 FIX: brocade_fcport: since in newer firmware (7.*) swFCPortSpeed is deprecated, we then calculate port speed from IF-MIB::ifHighSpeed
 
     Multisite:
     * 1066 Implemented Dashboard Designer...
diff --git a/checkman/brocade_fcport b/checkman/brocade_fcport
index 8e5b950..a17ef09 100644
--- a/checkman/brocade_fcport
+++ b/checkman/brocade_fcport
@@ -5,7 +5,7 @@ license: GPL
 distribution: check_mk
 description:
  This checks monitors a FibreChannel port of a Brocade FC switch
- to very great detail. It obsoletes the older checks {fc_brocade_port} and
+ in great detail. It obsoletes the older checks {fc_brocade_port} and
  {fc_brocade_port_detailed}. The check goes critical under the following conditions:
 
  {[1]} The physical state, operational state or adminstrative state of the port is not
@@ -31,9 +31,9 @@ item:
  The item is the port-number as two-digit or three-digit string (on switches
  with 100 or more ports) as printed on the switch (note: the SNMP-index of
  port {00} is {1}!). For ISL ports (inter-switch-links), an {ISL} is appended
- to the item, e.g. {00 ISL}. That allows you to create rules that select
+ to the item, e.g. {00 ISL}. This allows you to create rules which select
  different check parameters for ISL and normal ports without specifying each
- individual port. Also if you have configured port names, they will appear
+ individual port. Also, if you have configured port names, they will appear
  in the check item (and thus the service description). This can be turned
  off.
 
@@ -65,15 +65,15 @@ examples:
 
 perfdata:
   For each port there are sent {in}, {out}, {rxframes}, {txframes}, {rxcrcs},
-  {rxencoutframes}, {c3discards} and {notxcredits}. If averaging is turned on, then
-  each value comes twices: once normal and once with {_avg} appended as averaged
-  value. All rates are in Bytes/s or Frames/s. If you are using PNP4Nagios, then
+  {rxencoutframes}, {c3discards} and {notxcredits}. If averaging is turned on,
+  each value comes twice: once normal and once with {_avg} appended as averaged
+  value. All rates are in Bytes/s or Frames/s. If you are using PNP4Nagios,
   you are strongly encouraged to set {RRD_STORAGE_TYPE = MULTIPLE} in
-  {process_perfdata.cfg}. Please note, that you need to re-create or convert existing
-  RRD database if you change this setting.
+  {process_perfdata.cfg}. Please note that you need to re-create or convert existing
+  RRD databases if you change this setting.
 
 inventory:
-  The inventory creates checks for all operational ports. What this exactly means,
+  The inventory creates checks for all operational ports. What this exactly means
   can be configured (see CONFIGURATION VARIABLES).
 
 [parameters]
diff --git a/checks/brocade_fcport b/checks/brocade_fcport
index 79fc0dd..f4bc421 100644
--- a/checks/brocade_fcport
+++ b/checks/brocade_fcport
@@ -50,7 +50,7 @@ factory_settings["brocade_fcport_default_levels"] = {
     "rxencoutframes":   (3.0, 20.0),   # allowed percentage of Enc-OUT Frames
     "notxcredits":      (3.0, 20.0),   # allowed percentage of No Tx Credits
     "c3discards":       (3.0, 20.0),   # allowed percentage of C3 discards
-    "assumed_speed":    2.0,           # used, if speed not available in SNMP data
+    "assumed_speed":    2.0,           # used if speed not available in SNMP data
 }
 
 
@@ -67,7 +67,7 @@ def brocade_fcport_getitem(ports, index, portname, is_isl):
 
 def inventory_brocade_fcport(info):
     # info[0] is port table, info[1] is ISL table
-    if len(info) != 2:
+    if len(info) < 2:
         return
 
     inventory = []
@@ -119,9 +119,18 @@ def check_brocade_fcport(item, params, info):
         speedmsg = ("ISL at %.0fGbit/s"  % gbit)
     else: # no ISL port
         if brocade_fcport_speed[speed] in [ "auto-Neg", "unknown" ]:
-            # let user specify assumed speed via check parameter, default is 2.0
-            gbit  = params.get("assumed_speed")
-            speedmsg  = "assuming %gGbit/s" % gbit
+            try:
+                actual_speed = saveint(info[2][item_index][0])
+            except:
+                actual_speed = 0
+            if actual_speed > 0:
+                # use actual speed of port if available
+                gbit = actual_speed / 1000
+                speedmsg  = "actual speed %gGbit/s" % gbit
+            else:
+                # let user specify assumed speed via check parameter, default is 2.0
+                gbit  = params.get("assumed_speed")
+                speedmsg  = "assumed speed %gGbit/s" % gbit
         else:
             gbit = float(brocade_fcport_speed[speed].replace("Gbit", ""))
             speedmsg  = "%.0fGbit/s" % gbit
@@ -311,7 +320,7 @@ check_info["brocade_fcport"] = {
             22, # swFCPortRxCrcs
             26, # swFCPortRxEncOutFrs
             28, # swFCPortC3Discards
-            35, # swFCPortSpeed
+            35, # swFCPortSpeed, deprecated from at least firmware version 7.2.1
             36, # swFCPortName  (not supported by all devices)
         ]),
 
@@ -320,6 +329,11 @@ check_info["brocade_fcport"] = {
             2, # swNbMyPort
             5, # swNbBaudRate
         ]),
+
+        # new way to get port speed supported by Brocade
+        ( ".1.3.6.1.2.1.31.1.1.1", [
+            15, # IF-MIB::ifHighSpeed
+        ]),
     ],
     'snmp_scan_function'        : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.1588.2.1.1"),
     'group'                     : 'brocade_fcport',



More information about the checkmk-commits mailing list