Module: check_mk
Branch: master
Commit: c0ae5c580d96c45cd57a74f78c9a51aaa588f32a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c0ae5c580d96c4…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Wed Oct 14 10:54:34 2015 +0200
oracle_diva_csm: no longer crashes on missing fields and now uses user supplied actor
names instead of internal id
It appears that under unknown circumstances, potentially due to an outdated firmware, the
device
didn't (reliably?) provide some oids. Therefore it makes sense to gracefully handle
that
case.
---
checks/oracle_diva_csm | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/checks/oracle_diva_csm b/checks/oracle_diva_csm
index a9a791f..c7ee3e4 100644
--- a/checks/oracle_diva_csm
+++ b/checks/oracle_diva_csm
@@ -92,7 +92,7 @@ check_info['oracle_diva_csm'] = {
"service_description" : "DIVA Status %s",
"snmp_info" : [ ( ".1.3.6.1.4.1.110901.1.2.1.1.1", [
'1', '2' ] ), # lib status
( ".1.3.6.1.4.1.110901.1.2.2.1.1", [
'3.1', '8.1' ] ), # drive status
- ( ".1.3.6.1.4.1.110901.1.3.1.1", [ '1',
'4' ] ), # actor status
+ ( ".1.3.6.1.4.1.110901.1.3.1.1", [ '2',
'4' ] ), # actor status
( ".1.3.6.1.4.1.110901.1.4", [ '1'
] ), # archive status
( ".1.3.6.1.4.1.110901.1.4", [ '2',
# object count
'4', #
remaining size
@@ -146,13 +146,14 @@ def inventory_oracle_diva_csm_objects(info):
def check_oracle_diva_csm_objects(item, params, info):
GB = 1024 * 1024 * 1024
- object_count, remaining_size, total_size = map(int, info[4][0])
+ if len(info) > 4 and len(info[4]) > 0:
+ object_count, remaining_size, total_size = map(int, info[4][0])
- infotext = "managed objects: %s, remaining size: %s GB of %s GB" %
(object_count, remaining_size, total_size)
+ infotext = "managed objects: %s, remaining size: %s GB of %s GB" %
(object_count, remaining_size, total_size)
- return 0, infotext, [("managed_object_count", object_count),
- ("storage_used", (total_size - remaining_size) * GB,
- None, None, 0, total_size * GB)]
+ return 0, infotext, [("managed_object_count", object_count),
+ ("storage_used", (total_size - remaining_size) *
GB,
+ None, None, 0, total_size * GB)]
check_info['oracle_diva_csm.objects'] = {
@@ -182,17 +183,18 @@ def inventory_oracle_diva_csm_tapes(info):
def check_oracle_diva_csm_tapes(item, params, info):
- blank_tapes = int(info[5][0][0])
- warn, crit = params
- state = blank_tapes <= crit and 2 \
- or blank_tapes <= warn and 1 \
- or 0
-
- infotext = "blank tapes %d" % blank_tapes
- if state > 0:
- infotext += " (warn/crit at %d/%d)" % (warn, crit)
-
- return state, infotext, [("tapes_free", blank_tapes)]
+ if len(info) > 5 and len(info[5]) > 0 and len(info[5][0]) > 0:
+ blank_tapes = int(info[5][0][0])
+ warn, crit = params
+ state = blank_tapes <= crit and 2 \
+ or blank_tapes <= warn and 1 \
+ or 0
+
+ infotext = "blank tapes %d" % blank_tapes
+ if state > 0:
+ infotext += " (warn/crit at %d/%d)" % (warn, crit)
+
+ return state, infotext, [("tapes_free", blank_tapes)]
check_info['oracle_diva_csm.tapes'] = {