Module: check_mk
Branch: master
Commit: a0a2c6dee6a1abcafb5ca47ed95a5ccc46f2e408
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a0a2c6dee6a1ab…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Oct 24 15:15:41 2014 +0200
#1161 FIX fc_port: Fixed invalid values of counters, fixed wrong values in graphs
Previous versions of the checks computed wrong values for all counters like
transfered bytes, errors etc. This has been fixed now.
The performance graphs, for example error counters, were using wrong datasources
which made the graphs show dramatically wrong values.
---
.werks/1161 | 13 ++++++++++++
.werks/195 | 11 ----------
ChangeLog | 3 +--
checks/fc_port | 22 ++++++++------------
pnp-templates/check_mk-fc_port.php | 40 ++++++++++++++++++++++++------------
5 files changed, 50 insertions(+), 39 deletions(-)
diff --git a/.werks/1161 b/.werks/1161
new file mode 100644
index 0000000..691530a
--- /dev/null
+++ b/.werks/1161
@@ -0,0 +1,13 @@
+Title: fc_port: Fixed invalid values of counters, fixed wrong values in graphs
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1414156402
+Class: fix
+
+Previous versions of the checks computed wrong values for all counters like
+transfered bytes, errors etc. This has been fixed now.
+
+The performance graphs, for example error counters, were using wrong datasources
+which made the graphs show dramatically wrong values.
diff --git a/.werks/195 b/.werks/195
deleted file mode 100644
index 51106ed..0000000
--- a/.werks/195
+++ /dev/null
@@ -1,11 +0,0 @@
-Title: fc_port: Check temporary disabled cause of problems with automatic detection
-Level: 1
-Component: checks
-Compatible: incomp
-Version: 1.2.5i6
-Date: 1407158053
-Class: fix
-
-There are currently a problem with the scan function who lead to a positive result on not
supported devices.
-The Check will be renabled asap the problems are fixed.
-
diff --git a/ChangeLog b/ChangeLog
index d5b1e7c..a83beef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -82,8 +82,6 @@
* 0194 FIX: raritan_pdu_inlet: Check now outputs the correct values...
NOTE: Please refer to the migration notes!
* 1071 FIX: oracle_rman_backups: Only inventorize ARCHIVELOG / DB FULL / DB INCR
entries...
- * 0195 FIX: fc_port: Check temporary disabled cause of problems with automatic
detection...
- 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
@@ -118,6 +116,7 @@
* 1128 FIX: bluecat_dns: now reports UNKNOWN if no snmp data is available
* 1131 FIX: esx_vsphere_hostsystem.maintenance: fixed misspelling in service
description...
NOTE: Please refer to the migration notes!
+ * 1161 FIX: fc_port: Fixed invalid values of counters, fixed wrong values in
graphs...
Multisite:
* 1066 New Dashboard Designer...
diff --git a/checks/fc_port b/checks/fc_port
index 93b02c6..52c6c51 100644
--- a/checks/fc_port
+++ b/checks/fc_port
@@ -87,15 +87,11 @@ def fc_port_getitem(num_ports, index, portname):
return itemname
def fc_parse_counter(value):
- if type(value) == str: # unsigned 64bit counter
- num = 64
- result = 0
- for c in value:
- num = num - 8
- result += ord(c) * 2 ** num
- return result
- else:
- return value
+ # The counters are sent via SNMP as OCTETSTR, which is converted to
+ # a byte string by Check_MKs SNMP code. The counters seem to be
+ # 64 bit big endian values, which are converted to integers here
+ import struct
+ return int(struct.unpack('>Q', value)[0])
def inventory_fc_port(info):
if not info:
@@ -332,23 +328,23 @@ check_info["fc_port"] = {
"1.10.1.17", # connUnitPortName
# 5
"1.10.1.23", # connUnitPortHWSTate:
# 6
# hardware detected state of the port
- "4.5.1.4", # connUnitPortStatTxObjects:
# 7
+ "4.5.1.4", # connUnitPortStatCountTxObjects:
# 7
# The number of frames/packets/IOs/etc that have been
transmitted
# by this port. Note: A Fibre Channel frame starts with
SOF and
# ends with EOF. FC loop devices should not count frames
passed
# through. This value represents the sum total for all
other Tx
- "4.5.1.5", # connUnitPortStatRxObjects:
# 8
+ "4.5.1.5", # connUnitPortStatCountRxObjects:
# 8
# The number of frames/packets/IOs/etc that have been
received
# by this port. Note: A Fibre Channel frame starts with
SOF and
# ends with EOF. FC loop devices should not count frames
passed
# through. This value represents the sum total for all
other Rx
- "4.5.1.6", # connUnitPortStatTxElements:
# 9
+ "4.5.1.6", # connUnitPortStatCountTxElements:
# 9
# The number of octets or bytes that have been
transmitted
# by this port. One second periodic polling of the port.
This
# value is saved and compared with the next polled value
to
# compute net throughput. Note, for Fibre Channel,
ordered
# sets are not included in the count.
- "4.5.1.7", # connUnitPortStatRxElements:
# 10
+ "4.5.1.7", # connUnitPortStatCountRxElements:
# 10
# The number of octets or bytes that have been received.
# by this port. One second periodic polling of the port.
This
# value is saved and compared with the next polled value
to
diff --git a/pnp-templates/check_mk-fc_port.php b/pnp-templates/check_mk-fc_port.php
index 662699e..99bfc93 100644
--- a/pnp-templates/check_mk-fc_port.php
+++ b/pnp-templates/check_mk-fc_port.php
@@ -89,6 +89,19 @@ if($bandwidth > $base * $base * $base) {
$bwuom = 'k';
}
+# The number of data source various due to different
+# settings (such as averaging). We rather work with names
+# than with numbers.
+$RRD = array();
+foreach ($NAME as $i => $n) {
+ $RRD[$n] = "$RRDFILE[$i]:$DS[$i]:MAX";
+ $RRDAVG[$n] = "$RRDFILE[$i]:$DS[$i]:AVERAGE";
+ $WARN[$n] = $WARN[$i];
+ $CRIT[$n] = $CRIT[$i];
+ $MIN[$n] = $MIN[$i];
+ $MAX[$n] = $MAX[$i];
+}
+
if ($mBandwidthH < 10)
$range = $mBandwidthH;
else
@@ -114,7 +127,7 @@ $def[1] =
$def[1] .= "".
# incoming
- "DEF:inbytes=$RRDFILE[1]:$DS[1]:MAX ".
+ "DEF:inbytes=$RRD[in] ".
"CDEF:intraffic=inbytes,$unit_multiplier,* ".
"CDEF:inmb=intraffic,1048576,/ ".
"AREA:inmb#00e060:\"in \" ".
@@ -127,7 +140,7 @@ $def[1] =
"GPRINT:inperc:\"%7.1lf %s$unit/s\\n\" ".
# outgoing
- "DEF:outbytes=$RRDFILE[2]:$DS[2]:MAX ".
+ "DEF:outbytes=$RRD[out] ".
"CDEF:outtraffic=outbytes,$unit_multiplier,* ".
"CDEF:minusouttraffic=outtraffic,-1,* ".
"CDEF:outmb=outtraffic,1048576,/ ".
@@ -146,8 +159,8 @@ $def[1] =
# averages
if (isset($DS[9])) {
$def[1] .=
- "DEF:inbytesa=$RRDFILE[9]:$DS[9]:MAX ".
- "DEF:outbytesa=$RRDFILE[10]:$DS[10]:MAX ".
+ "DEF:inbytesa=$RRD[in_avg] ".
+ "DEF:outbytesa=$RRD[out_avg] ".
"CDEF:intraffica=inbytesa,$unit_multiplier,* ".
"CDEF:outtraffica=outbytesa,$unit_multiplier,* ".
"CDEF:inmba=intraffica,1048576,/ ".
@@ -169,7 +182,7 @@ $opt[2] = "--vertical-label \"objects/sec\" --title
\"Objects $hostname / $servi
$def[2] =
# rxobjects
"HRULE:0#c0c0c0 ".
- "DEF:inu=$RRDFILE[3]:$DS[3]:MAX ".
+ "DEF:inu=$RRD[rxobjects] ".
"CDEF:in=inu ".
"AREA:inu#00ffc0:\"rxobjects \" ".
"GPRINT:inu:LAST:\"%9.1lf/s last \" ".
@@ -180,15 +193,16 @@ $def[2] =
"GPRINT:inperc:\"%9.1lf/s\\n\" ".
# txobjects
- "DEF:outu=$RRDFILE[4]:$DS[4]:MAX ".
+ "DEF:outu=$RRD[txobjects] ".
"CDEF:minusoutu=0,outu,- ".
"AREA:minusoutu#00c0ff:\"txobjects \" ".
"GPRINT:outu:LAST:\"%9.1lf/s last \" ".
"GPRINT:outu:AVERAGE:\"%9.1lf/s avg \" ".
"GPRINT:outu:MAX:\"%9.1lf/s max\\n\" ".
- "VDEF:outperc=minusoutu,5,PERCENTNAN ".
- "LINE:outperc#0000cf:\"out 95% percentile\" ".
- "GPRINT:outperc:\"%9.1lf/s\\n\" ".
+ "VDEF:outperc_neg=minusoutu,5,PERCENTNAN ".
+ "VDEF:outperc_pos=outu,5,PERCENTNAN ".
+ "LINE:outperc_neg#0000cf:\"out 95% percentile\" ".
+ "GPRINT:outperc_pos:\"%9.1lf/s\\n\" ".
"";
# Graph 3: errors and discards
@@ -196,8 +210,8 @@ $ds_name[3] = 'Errors and discards';
$opt[3] = "--vertical-label \"errors/sec\" -X0 --title \"Problems
$hostname / $servicedesc\" ";
$def[3] =
"HRULE:0#c0c0c0 ".
- "DEF:crcerr=$RRDFILE[5]:$DS[5]:MAX ".
- "DEF:encout=$RRDFILE[6]:$DS[6]:MAX ".
+ "DEF:crcerr=$RRD[rxcrcs] ".
+ "DEF:encout=$RRD[rxencoutframes] ".
"AREA:crcerr#ff0000:\"crc errors \" ".
"GPRINT:crcerr:LAST:\"%7.2lf/s last \" ".
"GPRINT:crcerr:AVERAGE:\"%7.2lf/s avg \" ".
@@ -206,8 +220,8 @@ $def[3] =
"GPRINT:encout:LAST:\"%7.2lf/s last \" ".
"GPRINT:encout:AVERAGE:\"%7.2lf/s avg \" ".
"GPRINT:encout:MAX:\"%7.2lf/s max\\n\" ".
- "DEF:c3discards=$RRDFILE[7]:$DS[7]:MAX ".
- "DEF:notxcredits=$RRDFILE[8]:$DS[8]:MAX ".
+ "DEF:c3discards=$RRD[c3discards] ".
+ "DEF:notxcredits=$RRD[notxcredits] ".
"CDEF:minusc3=0,c3discards,- ".
"CDEF:minusnotxcredits=0,notxcredits,- ".
"AREA:minusc3#ff0080:\"c3 discards \" ".