Module: check_mk
Branch: master
Commit: fb1f9c8337a0896ccd997bddf31f313a53fd1031
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fb1f9c8337a089…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Sep 27 14:55:40 2018 +0200
genua_carp: Do not fetch unused OIDs anymore
Change-Id: If753f0fba0a327ec4981185e0a99363bb2a07eba
---
checks/genua_carp | 12 ++----------
.../checks/generictests/datasets/genua_carp_1.py | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/checks/genua_carp b/checks/genua_carp
index d193afa..35fd1d8 100644
--- a/checks/genua_carp
+++ b/checks/genua_carp
@@ -27,12 +27,8 @@
# Example Agent Output:
# GENUA-MIB:
-#.1.3.6.1.4.1.3137.2.1.2.1.1.9 = INTEGER: 9
-#.1.3.6.1.4.1.3137.2.1.2.1.1.10 = INTEGER: 10
#.1.3.6.1.4.1.3137.2.1.2.1.2.9 = STRING: "carp0"
#.1.3.6.1.4.1.3137.2.1.2.1.2.10 = STRING: "carp1"
-#.1.3.6.1.4.1.3137.2.1.2.1.3.9 = INTEGER: 5
-#.1.3.6.1.4.1.3137.2.1.2.1.3.10 = INTEGER: 5
#.1.3.6.1.4.1.3137.2.1.2.1.4.9 = INTEGER: 2
#.1.3.6.1.4.1.3137.2.1.2.1.4.10 = INTEGER: 2
#.1.3.6.1.4.1.3137.2.1.2.1.7.9 = INTEGER: 2
@@ -46,7 +42,7 @@ def inventory_genua_carp(info):
info = filter(None, info)
if info[0]:
- for _ifIndex, ifName, _ifType, _ifLinkState, ifCarpState in info[0]:
+ for ifName, _ifLinkState, ifCarpState in info[0]:
if ifCarpState in [ "0", "1", "2" ]:
inventory.append( (ifName, None) )
return inventory
@@ -90,7 +86,7 @@ def check_genua_carp(item, _no_params, info):
# Loop over all nodes, just one line if not a cluster
for line in info:
# Loop over interfaces on node
- for _ifIndex, ifName, _ifType, ifLinkState, ifCarpState in line:
+ for ifName, ifLinkState, ifCarpState in line:
ifLinkStateStr = genua_linkstate(str(ifLinkState))
ifCarpStateStr = genua_carpstate(str(ifCarpState))
# is inventorized interface in state carp master ?
@@ -138,16 +134,12 @@ check_info['genua_carp'] = {
"check_function" : check_genua_carp,
"service_description": "Carp Interface %s",
"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"
]),
( ".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"
]),
diff --git a/tests/unit/checks/generictests/datasets/genua_carp_1.py
b/tests/unit/checks/generictests/datasets/genua_carp_1.py
new file mode 100644
index 0000000..58ec93c
--- /dev/null
+++ b/tests/unit/checks/generictests/datasets/genua_carp_1.py
@@ -0,0 +1,20 @@
+
+
+checkname = 'genua_carp'
+
+
+info = [[[u'carp0', u'2', u'2'], [u'carp1', u'2',
u'2'], [u'carp2', u'1', u'0']], []]
+
+
+discovery = {'': [(u'carp0', None), (u'carp1', None),
(u'carp2', None)]}
+
+
+checks = {'': [(u'carp0',
+ 'default',
+ [(0, 'Node test: node in carp state master with IfLinkState up',
[])]),
+ (u'carp1',
+ 'default',
+ [(0, 'Node test: node in carp state master with IfLinkState up',
[])]),
+ (u'carp2',
+ 'default',
+ [(1, 'Node test: node in carp state init with IfLinkState down',
[])])]}
\ No newline at end of file