Module: check_mk
Branch: master
Commit: e880eb02fcf2461fe04311ffc6abf46442bf8bfb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e880eb02fcf246…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Tue Oct 22 17:16:40 2013 +0200
Allow another enterprise ids introduced as a bug some genuscreen versions
---
checkman/genua_carp | 4 +++-
checks/genua_carp | 37 ++++++++++++++++++++-----------------
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/checkman/genua_carp b/checkman/genua_carp
index 38f418f..3407638 100644
--- a/checkman/genua_carp
+++ b/checkman/genua_carp
@@ -14,7 +14,9 @@ description:
For a cluster the check determines the number of carp interfaces on the cluster with
the state master. If it is either {0} or {>1} the check is critical.
- The check is known to run with genuscreen version 3.0, others may also work.
+ The check is known to run with genuscreen version 3.0 and supports genuas regular
+ enterprise id 3717 as well as the id 3137 which was introduced in a bug in some
+ versions of genuscreen.
perfdata:
None
diff --git a/checks/genua_carp b/checks/genua_carp
index f84faa4..800da49 100644
--- a/checks/genua_carp
+++ b/checks/genua_carp
@@ -42,6 +42,9 @@
def inventory_genua_carp(info):
inventory = []
+ # remove empty elements due to two alternative enterprise ids in snmp_info
+ info = filter(None, info)
+
if info[0]:
for ifIndex, ifName, ifType, ifLinkState, ifCarpState in info[0]:
if ifCarpState in [ "0", "1", "2" ]:
@@ -84,11 +87,15 @@ def genua_carpstate(st):
def check_genua_carp(item, _no_params, info):
+ # remove empty elements due to two alternative enterprise ids in snmp_info
+ info = filter(None, info)
+
if not info[0]:
return(3, "Invalid Output from Agent")
state = 0
nodes = len(info)
masters = 0
+ output = ""
if nodes > 1:
prefix = "Cluster test: "
else:
@@ -102,13 +109,14 @@ def check_genua_carp(item, _no_params, info):
ifLinkStateStr = genua_linkstate(str(ifLinkState))
ifCarpStateStr = genua_carpstate(str(ifCarpState))
# is inventorized interface in state carp master ?
- if ifName == item:
- output = "node in carp state %s with IfLinkState %s" \
- % (ifCarpStateStr,ifLinkStateStr)
if ifName == item and ifCarpState == "2":
# is master
masters += 1
if masters == 1:
+ if nodes > 1:
+ output = "one "
+ output += "node in carp state %s with IfLinkState %s" \
+ % (ifCarpStateStr,ifLinkStateStr)
# first master
if ifLinkState == "2":
state = 0
@@ -120,10 +128,12 @@ def check_genua_carp(item, _no_params, info):
state = 3
else:
state = 2
- output = "%d masters found on cluster with %d nodes" \
- % (masters,nodes)
+ output = "%d nodes in carp state %s on cluster with %d
nodes" \
+ % (masters,ifCarpStateStr,nodes)
# look for non-masters, only interesting if no cluster
elif ifName == item and nodes == 1:
+ output = "node in carp state %s with IfLinkState %s" \
+ % (ifCarpStateStr,ifLinkStateStr)
# carp backup
if ifCarpState == "1" and ifLinkState == "1":
state = 0
@@ -143,27 +153,20 @@ check_info['genua_carp'] = {
"check_function" : check_genua_carp,
"service_description": "Carp Interface %s",
"has_perfdata" : False,
- "snmp_info" : [( ".1.3.6.1.4.1.3717.2.1.2",[
+ "snmp_info" : [( ".1.3.6.1.4.1.3137.2.1.2",[
"1.1", # "ifIndex"
"1.2", # "ifName"
"1.3", # "ifType"
"1.4", # "ifLinkState"
"1.7", # "ifCarpState"
- ])],
- "snmp_scan_function" : lambda oid: "genuscreen" in
oid(".1.3.6.1.2.1.1.1.0").lower()
-}
-
-check_info['genua_carp_bad_eoid'] = {
- "inventory_function" : inventory_genua_carp,
- "check_function" : check_genua_carp,
- "service_description": "Carp Interface %s",
- "has_perfdata" : False,
- "snmp_info" : [( ".1.3.6.1.4.1.3137.2.1.2",[
+ ]),
+ ( ".1.3.6.1.4.1.3717.2.1.2",[
"1.1", # "ifIndex"
"1.2", # "ifName"
"1.3", # "ifType"
"1.4", # "ifLinkState"
"1.7", # "ifCarpState"
- ])],
+ ]),
+ ],
"snmp_scan_function" : lambda oid: "genuscreen" in
oid(".1.3.6.1.2.1.1.1.0").lower()
}