Module: check_mk
Branch: master
Commit: e0c6e19e7946dbc25c37b385b4c2efae2e541938
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e0c6e19e7946db…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 9 10:09:20 2014 +0100
drbd: fix exception in inventory in certain situations
---
checks/drbd | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/checks/drbd b/checks/drbd
index 2b4dfe1..962a1c9 100644
--- a/checks/drbd
+++ b/checks/drbd
@@ -191,9 +191,12 @@ def inventory_drbd(info, checktype):
continue
if checktype == 'drbd':
- levels = { "roles_inventory": parsed['ro'],
- "diskstates_inventory": parsed['ds']
- }
+ if 'ro' not in parsed or 'ds' not in parsed:
+ continue
+ levels = {
+ "roles_inventory": parsed['ro'],
+ "diskstates_inventory": parsed['ds'],
+ }
elif checktype == 'drbd.net':
levels = "drbd_net_default_levels"
elif checktype == 'drbd.disk':
@@ -416,7 +419,7 @@ def check_drbd_stats(item, params, info):
if key in parsed:
output += '%s: %s, ' % (label, parsed[key])
else:
- parsed[key] = 0 # perfdata must always have same number of entries
+ parsed[key] = '0' # perfdata must always have same number of
entries
if parsed[key].isdigit():
perfdata.append(('%s' % label.replace(" ",
"_"), parsed[key]))
return (0, output.rstrip(', '), perfdata)