Module: check_mk
Branch: master
Commit: 194f9f1d7a16b848e70abac590076f8785430cd1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=194f9f1d7a16b8…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Oct 23 13:49:23 2013 +0200
check now works with any number of carp interfaces greater than 1
---
checkman/genua_state_correlation | 18 ++++++++++--------
checks/genua_state_correlation | 20 ++++++++++----------
2 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/checkman/genua_state_correlation b/checkman/genua_state_correlation
index c459cf1..0005332 100644
--- a/checkman/genua_state_correlation
+++ b/checkman/genua_state_correlation
@@ -4,17 +4,19 @@ catalog: hw/network/genua
license: GPL
distribution: check_mk
description:
- This check monitors if the two carp interfaces found on genuscreen devices
- have the same carp state. If not, the check is critical.
+ This check monitors if the two or more carp interfaces found on genuscreen
+ devices have the same carp state. If not, the check is critical.
- 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.
+ The check is known to run with genuscreen version 3.0 and 4.1, 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
inventory:
- The inventory process checks if the device has a system description OIDs
(.1.3.6.1.2.1.1.2.0)
- and if the name of this OID contains "genuscreen" (case insensitive).
- If this is true the system is inventorized.
+ The inventory process checks if the device has a system description OID
+ of .1.3.6.1.2.1.1.2.0 and if the name of this OID contains "genuscreen"
+ (case insensitive).
+ If this is true and at least two carp interfaces are found, then the system
+ is inventorized.
diff --git a/checks/genua_state_correlation b/checks/genua_state_correlation
index 482db93..54432cd 100644
--- a/checks/genua_state_correlation
+++ b/checks/genua_state_correlation
@@ -68,23 +68,23 @@ def check_genua_state(item, _no_params, info):
return(3, "Invalid Output from Agent")
state = 0
- output = "Node test:"
carp_info = []
for ifIndex, ifName, ifType, ifLinkState, ifCarpState in info[0]:
if ifType == "6":
carp_info.append((ifIndex, ifName, ifType, ifLinkState, ifCarpState))
- if len(carp_info) != 2:
- return(3, "Number of carp interfaces is %d, needs to be 2" %
len(carp_info))
+ # critical if the carp interfaces dont have the same state
+ carp_states = [ 0, 0, 0 ]
+ for i in range (0, len(carp_info)):
+ carp_states[int(carp_info[i][4])] += 1
+ if carp_info[0][4] != carp_info[i][4]:
+ state = 2
- # Output formatieren
- output += " %s:%s %s:%s" % (carp_info[0][1],
genua_state_str(carp_info[0][4])\
- , carp_info[1][1], genua_state_str(carp_info[1][4]))
-
- # critical if the two carp interfaces dont have the same state
- if carp_info[0][4] != carp_info[1][4]:
- state = 2
+ output = "Number of carp IFs in states "
+ for i in ('0', '1', '2'):
+ output += genua_state_str(i)
+ output += ":%d " % carp_states[int(i)]
return(state, output)