Module: check_mk
Branch: master
Commit: 047b2175bd34df90f8404ae9332a053a5a8b155b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=047b2175bd34df…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 9 09:44:12 2014 +0100
#1727 FIX cisco_secure: Fixed inventory exception when port security is not enabled
---
.werks/1727 | 9 +++++++++
ChangeLog | 1 +
checks/cisco_secure | 4 +++-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/.werks/1727 b/.werks/1727
new file mode 100644
index 0000000..cab7e98
--- /dev/null
+++ b/.werks/1727
@@ -0,0 +1,9 @@
+Title: cisco_secure: Fixed inventory exception when port security is not enabled
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1418114616
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index f770d56..be00b28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -137,6 +137,7 @@
* 1695 FIX: brocade_vdx_status: Is now not bein inventorized anymore for devices not supporting the check
* 1722 FIX: lnx_thermal: fix invalid zero temperature if mode file is missing
* 1696 FIX: cisco_temp_sensor: Value reported of check was not always correct (precision was wrong)...
+ * 1727 FIX: cisco_secure: Fixed inventory exception when port security is not enabled
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/cisco_secure b/checks/cisco_secure
index 898082d..04317c6 100644
--- a/checks/cisco_secure
+++ b/checks/cisco_secure
@@ -31,7 +31,9 @@ def parse_cisco_secure(info):
names = dict([ (l[0], ( l[1], l[2] )) for l in info[0]] )
for num, enabled, status, violationCount, lastmac in info[1]:
mac = ":".join(["%02s" % hex(ord(m))[2:] for m in lastmac]).replace(' ', '0')
- parsed.append(( names[num][0], int(names[num][1]), int(enabled), int(status), int(violationCount), mac ))
+ # violationCount is initialized with 0 when security is enabled. When not, the
+ # value is reported as empty string. saveint() makes life easier here.
+ parsed.append((names[num][0], int(names[num][1]), int(enabled), int(status), saveint(violationCount), mac))
return parsed
Module: check_mk
Branch: master
Commit: 53d5359286d6e89055b800b905c5c1f289bdd6e5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=53d5359286d6e8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 9 09:33:55 2014 +0100
#1723 New check API function get_average() as more intelligent replacement for get_counter()
The function <tt>get_counter()</tt> is now deprecated in the programming of
checks. There is a new function called <tt>get_rate()</tt> that should be
used as a replacement.
F+:
def get_rate(countername, this_time, this_val, allow_negative=False, onwrap=SKIP):
...
return rate
F-:
The call syntax is almostthe same - just with the new optional parameter
<tt>onwrap</tt>. Important however: now just the rate (counter steps
per second) is being returned. The formerly additional return value
<tt>timedif</tt> has been dropped since it is of no real use. So the return
type has changed from tuple to float.
The most imporant change - however - is in the handling of counter wraps. A
<i>counter wrap</i> happens in three situations:
<ul>
<li>When the counter is seen for the first time (initialization)</li>
<li>When the previous value of the counter is larger than the new one</li>
<li>When the time difference since the last counter update was less than one second</li>
</ul>
Wraps usually happen when a device reboots or when the valid range of the
counter is exceeded and it wraps through again to zero.
The old function <tt>get_counter()</tt> used to raise an exception of type
<tt>MKCounterWrapped</tt>. This exception was handeld by the main core of
Check_MK, which skipped that check for one cycle. The problem were checks
with more than one counter: at the point of initialization the code of the
check wasaborted after the first of these counters had been initialized.
If you had 10 counters, you would need 10 check cycles until the first time
a check result would be returned. So in order to avoid that the check had
to catch the <tt>MKCounterWrapped</tt> itself and handle this situation -
very ugly.
The new function <tt>get_rate</tt> implements a different approach.
Per default no exception is raised in case of a counter wrap, but simply the
value <tt>0.00</tt> is being returned. But Check_MK keeps record of this wrap
event. After the check function has completed (and all counters are handled),
Check_MK creates <i>one final</i> <tt>MKCounterWrapped</tt> exception, so
that the (invalid) check result is being skipped as it should be. This way
the check programmers' burden is a reduced a bit because now even if the
check has several counters he does not need to catch counter wraps.
In order to give the check more flexibility there are two other behaviours,
that can be selected by the optional argument <tt>onwrap</tt>:
<table>
<tr><th>onwrap</th><th>behaviour</th></tr>
<tr><td class=tt>SKIP</td><td>Skip result of check, after all counters are handled (default)</td></tr>
<tr><td class=tt>RAISE</td><td>Immediately raise a <tt>MKCounterWrapped</tt> exception (legacy behaviour)</td></tr>
<tr><td class=tt>ZERO</td><td>Ignore the wrap and return a rate of 0.0 (be careful!)</td></tr>
</table>
Note: Using <tt>ZERO</tt> is generally <i>not</i> a good idea. This can
make a service jump from CRIT to OK from now and then and generate bogus
notifications.
H2:get_average()
The function <tt>get_average()</tt> has also been converted, but this time without
renaming it. So this change is incompatible. This should not harm too much since the
function is rarely used.
<tt>get_average()</tt> now also just returns one value - the average - and also
has the new parameter <tt>onwrap</tt> with the same three options.
---
.werks/1723 | 68 ++++++++++++++++++++++++++++++++++++++++++++++
ChangeLog | 1 +
checks/diskstat.include | 12 ++++----
modules/automation.py | 3 ++
modules/check_mk_base.py | 67 +++++++++++++++++++++++++++++++--------------
5 files changed, 125 insertions(+), 26 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=53d5359286…
Module: check_mk
Branch: master
Commit: 28aaa9de8426490f3e8add2b591354113db23a34
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=28aaa9de842649…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 9 09:15:58 2014 +0100
#1695 FIX brocade_vdx_status: Is now not bein inventorized anymore for devices not supporting the check
---
.werks/1695 | 9 +++++++++
ChangeLog | 1 +
checks/brocade_vdx_status | 8 ++++++--
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/.werks/1695 b/.werks/1695
new file mode 100644
index 0000000..f5e2b42
--- /dev/null
+++ b/.werks/1695
@@ -0,0 +1,9 @@
+Title: brocade_vdx_status: Is now not bein inventorized anymore for devices not supporting the check
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1418112916
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 5cf17a7..de3b50c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -133,6 +133,7 @@
* 1713 FIX: check_fstab_mounts: now correctly ignores swap space...
* 1716 FIX: windows_tasks: consider state SCHED_S_TASK_QUEUED (0x00041325) as OK now
* 1721 FIX: dell_om_mem: Handle formerly unhandled situations with multiple errors...
+ * 1695 FIX: brocade_vdx_status: Is now not bein inventorized anymore for devices not supporting the check
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/brocade_vdx_status b/checks/brocade_vdx_status
index b6eecda..1f9d6a4 100644
--- a/checks/brocade_vdx_status
+++ b/checks/brocade_vdx_status
@@ -53,8 +53,12 @@ check_info["brocade_vdx_status"] = {
"check_function" : check_brocade_vdx_status,
"inventory_function" : inventory_brocade_vdx_status,
"service_description" : "Status",
- "snmp_scan_function" : lambda oid: oid('.1.3.6.1.2.1.1.2.0').startswith( ".1.3.6.1.4.1.1588") and
- not oid('.1.3.6.1.2.1.1.2.0').startswith( ".1.3.6.1.4.1.1588.2.1.1.1"),
+ # It does not seem to work to exclude several OIDs here, there seem
+ # to be too many devices which do not have the needed OIDs. We try
+ # another approach: check for existance of the first needed OID
+ #not oid('.1.3.6.1.2.1.1.2.0').startswith( ".1.3.6.1.4.1.1588.2.1.1.1"),
+ "snmp_scan_function" : lambda oid: oid('.1.3.6.1.2.1.1.2.0').startswith( ".1.3.6.1.4.1.1588") \
+ and oid(".1.3.6.1.4.1.1588.2.1.1.1.1.6") != None,
"snmp_info" : ( ".1.3.6.1.4.1.1588.2.1.1.1.1", [
6, # Firmware
7 # Status
Module: check_mk
Branch: master
Commit: 4986baf89db74091f5566811a07e6eb6af2b8892
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4986baf89db740…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 9 09:33:03 2014 +0100
#1696 FIX cisco_temp_sensor: Cleaned up value scaling (precision) code in check, should be more robust now
---
.werks/1696 | 9 +++++++++
ChangeLog | 1 +
checks/cisco_temp_sensor | 27 ++++++++++-----------------
3 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/.werks/1696 b/.werks/1696
new file mode 100644
index 0000000..ff0705d
--- /dev/null
+++ b/.werks/1696
@@ -0,0 +1,9 @@
+Title: cisco_temp_sensor: Cleaned up value scaling (precision) code in check, should be more robust now
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1418113954
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index de3b50c..133ca5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -134,6 +134,7 @@
* 1716 FIX: windows_tasks: consider state SCHED_S_TASK_QUEUED (0x00041325) as OK now
* 1721 FIX: dell_om_mem: Handle formerly unhandled situations with multiple errors...
* 1695 FIX: brocade_vdx_status: Is now not bein inventorized anymore for devices not supporting the check
+ * 1696 FIX: cisco_temp_sensor: Cleaned up value scaling (precision) code in check, should be more robust now
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/cisco_temp_sensor b/checks/cisco_temp_sensor
index cb49d6c..8a61ccc 100644
--- a/checks/cisco_temp_sensor
+++ b/checks/cisco_temp_sensor
@@ -116,27 +116,19 @@ def parse_cisco_temp_sensor(info):
# Create dict with thresholds
thresholds = {}
- for id, sensortype, value, sensorstate in state_info:
- thresholds.setdefault(id, [])
+ for id, sensortype, precision, value, sensorstate in state_info:
+ thresholds.setdefault(id, [])
- for endoid, levels in levels_info:
- # endoid is e.g. 21549.9 or 21459.10
- level = saveint(levels)
- if level > 150:
- level = level / 10
- id, subid = endoid.split('.')
- thresholds.setdefault(id, []).append(level)
+ for endoid, level in levels_info:
+ level = int(level)*(10**int(precision))
+ # endoid is e.g. 21549.9 or 21459.10
+ id, subid = endoid.split('.')
+ thresholds.setdefault(id, []).append(level)
# Create main dictionary (only of temperature sensors)
sensors = []
- for id, sensortype, value, sensorstate in state_info:
- # Poor try to find temperature values, which are given in tenths of degrees.
- # Seems that some new firmware shows this behaviour.
- # A normal temperature sensor has only a range up to
- # 60 degree, so we've chosen 150.
- value = saveint(value)
- if value > 150:
- value = value / 10
+ for id, sensortype, precision, value, sensorstate in state_info:
+ value = int(value)*(10**int(precision))
sensors.append( ( id, descriptions.get(id), sensortype,
value, sensorstate, thresholds[id] ) )
return sensors
@@ -187,6 +179,7 @@ check_info['cisco_temp_sensor'] = {
( ".1.3.6.1.4.1.9.9.91.1.1.1.1", [
OID_END,
1, # Type (see above), 8 = Celsius, 12 = truth value
+ 3, # Precision
4, # Most recent measurement
5, # Status of the sensor 1 == ok, 2 == cannot report, 3 == broken
]),
Module: check_mk
Branch: master
Commit: 930c06ec8e7170995d476a0da8cbd32371eba657
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=930c06ec8e7170…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 9 09:34:45 2014 +0100
Updated werk texts
---
.werks/1696 | 6 ++++--
ChangeLog | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/.werks/1696 b/.werks/1696
index ff0705d..f06e774 100644
--- a/.werks/1696
+++ b/.werks/1696
@@ -1,4 +1,4 @@
-Title: cisco_temp_sensor: Cleaned up value scaling (precision) code in check, should be more robust now
+Title: cisco_temp_sensor: Value reported of check was not always correct (precision was wrong)
Level: 1
Component: checks
Compatible: compat
@@ -6,4 +6,6 @@ Version: 1.2.5i7
Date: 1418113954
Class: fix
-
+We already had a workaround to get the correct precision of the value reported by the device,
+but this code was kind of a hack. No we retrieve the precision value from the target device
+and then scale the value according to it.
diff --git a/ChangeLog b/ChangeLog
index 133ca5c..c7f0ef4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -134,7 +134,7 @@
* 1716 FIX: windows_tasks: consider state SCHED_S_TASK_QUEUED (0x00041325) as OK now
* 1721 FIX: dell_om_mem: Handle formerly unhandled situations with multiple errors...
* 1695 FIX: brocade_vdx_status: Is now not bein inventorized anymore for devices not supporting the check
- * 1696 FIX: cisco_temp_sensor: Cleaned up value scaling (precision) code in check, should be more robust now
+ * 1696 FIX: cisco_temp_sensor: Value reported of check was not always correct (precision was wrong)...
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...