Module: check_mk
Branch: master
Commit: a7139715c7b7f66148e3885119454edce7359c40
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a7139715c7b7f6…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Sep 24 16:09:30 2015 +0200
#2631 FIX janitza_umg_freq: fixed crash when no frequency measurements were reported by
the device
---
.werks/2631 | 9 +++++++++
ChangeLog | 1 +
checks/janitza_umg_freq | 30 +++++++++++++++---------------
3 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/.werks/2631 b/.werks/2631
new file mode 100644
index 0000000..57a1e0e
--- /dev/null
+++ b/.werks/2631
@@ -0,0 +1,9 @@
+Title: janitza_umg_freq: fixed crash when no frequency measurements were reported by the
device
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1443103718
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 4ccbb70..0c97f99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -199,6 +199,7 @@
* 2608 FIX: kemp_loadmaster_ha: Fixed wrong discovery on snmp monitored linux
systems
* 2609 FIX: mysql_capacity: Can now handle sizes reported being NULL...
* 2627 FIX: knuerr_sensors: no longer creates a service for unnamed sensor...
+ * 2631 FIX: janitza_umg_freq: fixed crash when no frequency measurements were
reported by the device
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce
unhandled exceptions...
diff --git a/checks/janitza_umg_freq b/checks/janitza_umg_freq
index 5eca352..08c1ea4 100644
--- a/checks/janitza_umg_freq
+++ b/checks/janitza_umg_freq
@@ -29,25 +29,27 @@ janitza_umg_freq_default_levels = {}
def inventory_janitza_umg_freq(info):
- # info[0][0] is frequency, info[0][1] is first freqerature reading, info[0][2] is
second.
- yield "1", {}
+ # info[0] is frequency, info[1] is first temperature reading, info[2] is second.
+ if len(info) > 0:
+ yield "1", {}
def check_janitza_umg_freq(item, params, info):
warn, crit = params.get("levels", (0, 0))
- reading = float(info[0][0][0]) / 100.0
- perfdata = [ ( "in_freq", reading, warn, crit ) ]
+ if len(info) > 0:
+ reading = float(info[0][0]) / 100.0
+ perfdata = [ ( "in_freq", reading, warn, crit ) ]
- infotext = "Frequency: %.1f Hz" % reading
- levelstext = "(warn/crit at %d/%d Hz)" % (warn, crit)
+ infotext = "Frequency: %.1f Hz" % reading
+ levelstext = "(warn/crit at %d/%d Hz)" % (warn, crit)
- if reading <= crit:
- return 2, infotext + " " + levelstext, perfdata
- elif reading <= warn:
- return 1, infotext + " " + levelstext, perfdata
- else:
- return 0, infotext, perfdata
+ if reading <= crit:
+ return 2, infotext + " " + levelstext, perfdata
+ elif reading <= warn:
+ return 1, infotext + " " + levelstext, perfdata
+ else:
+ return 0, infotext, perfdata
check_info['janitza_umg_freq'] = {
@@ -57,9 +59,7 @@ check_info['janitza_umg_freq'] = {
'has_perfdata' : True,
'default_levels_variable' : 'janitza_umg_freq_default_levels',
'group' : 'efreq',
- 'snmp_info' : [
- (".1.3.6.1.4.1.34278", [ "6" ]),
# misc
- ],
+ 'snmp_info' : (".1.3.6.1.4.1.34278", [ 6 ]), # misc
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
in [".1.3.6.1.4.1.34278.8.6",
".1.3.6.1.4.1.34278.10.1"]
}