kemp_loadmaster_services: fixed discovery if data is wrong or incomplete
Message-ID: <573dc464.Su4UsWCaaK3jWyQZ%si(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 8ab0a8cea19bb9caad54697b76111cac2c097f47
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8ab0a8cea19bb9…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu May 19 15:48:57 2016 +0200
3605 FIX kemp_loadmaster_ha, kemp_loadmaster_realserver, kemp_loadmaster_services: fixed
discovery if data is wrong or incomplete
---
.werks/3605 | 10 ++++
ChangeLog | 1 +
checks/kemp_loadmaster_ha | 31 +++++++----
checks/kemp_loadmaster_realserver | 21 ++++----
checks/kemp_loadmaster_services | 107 ++++++++++++++++++++++++++-----------
5 files changed, 117 insertions(+), 53 deletions(-)
diff --git a/.werks/3605 b/.werks/3605
new file mode 100644
index 0000000..39bf2b9
--- /dev/null
+++ b/.werks/3605
@@ -0,0 +1,10 @@
+Title: kemp_loadmaster_ha, kemp_loadmaster_realserver, kemp_loadmaster_services: fixed
discovery if data is wrong or incomplete
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1463665694
+
+
diff --git a/ChangeLog b/ChangeLog
index 8f3dde3..f1f45ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -224,6 +224,7 @@
* 3535 FIX: docsis_cm_status: fixed missing performance data
* 3536 FIX: alcatel_timetra_chassis: fixed exception when check is not OK
* 3604 FIX: ups_capacity.include: fixed displaying wrong levels and cleanup
+ * 3605 FIX: kemp_loadmaster_ha, kemp_loadmaster_realserver, kemp_loadmaster_services:
fixed discovery if data is wrong or incomplete
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/kemp_loadmaster_ha b/checks/kemp_loadmaster_ha
index b560591..6f9cd27 100644
--- a/checks/kemp_loadmaster_ha
+++ b/checks/kemp_loadmaster_ha
@@ -25,14 +25,24 @@
# Boston, MA 02110-1301 USA.
+# .1.3.6.1.4.1.12196.13.0.9.0 1
+# .1.3.6.1.4.1.12196.13.0.10.0 7.1-20b.20140926-1505
+
+
def inventory_kemp_loadmaster_ha(info):
- return [ ( None, None ) ]
+ if info and info[0][0] != "0":
+ return [ ( None, None ) ]
+
def check_kemp_loadmaster_ha(_no_item, _no_params, info):
- states = ( 'none', 'Master', 'Standby', 'Passive' )
- state = states[saveint(info[0][0])]
- firmware = info[0][1]
- return 0, "Device is: %s (Firmware: %s)" % ( state, firmware )
+ map_states = {
+ "0" : "none",
+ "1" : "master",
+ "2" : "standby",
+ "3" : "passive",
+ }
+
+ return 0, "Device is: %s (Firmware: %s)" % ( map_states[info[0][0]],
info[0][1] )
check_info["kemp_loadmaster_ha"] = {
@@ -40,8 +50,11 @@ check_info["kemp_loadmaster_ha"] = {
"inventory_function" : inventory_kemp_loadmaster_ha,
"service_description" : "HA State",
"has_perfdata" : False,
- "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
in [".1.3.6.1.4.1.12196.250.10", ".1.3.6.1.4.1.2021.250.10" ] \
- and
oid(".1.3.6.1.4.1.12196.13.0.9.*"),
- "snmp_info" : ( ".1.3.6.1.4.1.12196.13.0", [ 9, 10 ]
),
+ "snmp_info" : ( ".1.3.6.1.4.1.12196.13.0", [
+ "9", # B100-MIB::hAstate
+ "10", # B100-MIB::patchVersion
+ ]),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
in \
+ [".1.3.6.1.4.1.12196.250.10",
".1.3.6.1.4.1.2021.250.10" ] and \
+ oid(".1.3.6.1.4.1.12196.13.0.9.*"),
}
-
diff --git a/checks/kemp_loadmaster_realserver b/checks/kemp_loadmaster_realserver
index 7679456..1265d41 100644
--- a/checks/kemp_loadmaster_realserver
+++ b/checks/kemp_loadmaster_realserver
@@ -36,12 +36,11 @@
def inventory_kemp_loadmaster_realserver(info):
for line in info:
- if line[2] != '4': # Skip disabled servers
+ if line[2] not in [ '4', '' ]: # Skip disabled servers
yield line[0], None
def check_kemp_loadmaster_realserver(item, _no_params, info):
- # states as they are defined in corresponding MIB: B100-MIB::rSstate
states = {
'1' : (0, 'in service', ),
'2' : (2, 'out of service', ),
@@ -56,17 +55,15 @@ def check_kemp_loadmaster_realserver(item, _no_params, info):
check_info["kemp_loadmaster_realserver"] = {
- "check_function" : check_kemp_loadmaster_realserver,
"inventory_function" : inventory_kemp_loadmaster_realserver,
+ "check_function" : check_kemp_loadmaster_realserver,
"service_description" : "Real Server %s",
- "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
in [
- ".1.3.6.1.4.1.12196.250.10",
- ".1.3.6.1.4.1.2021.250.10"
- ],
"snmp_info" : ( ".1.3.6.1.4.1.12196.13.2.1", [
- 2, # IP address: B100-MIB::rSip
- 5, # ID: B100-MIB::rSidx
- 8, # state: B100-MIB::rSstate
- ] ),
+ 2, # IP address: B100-MIB::rSip
+ 5, # ID: B100-MIB::rSidx
+ 8, # state: B100-MIB::rSstate
+ ]),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
in \
+ [ ".1.3.6.1.4.1.12196.250.10",
+ ".1.3.6.1.4.1.2021.250.10"],
}
-
diff --git a/checks/kemp_loadmaster_services b/checks/kemp_loadmaster_services
index d9c81d1..243f39b 100644
--- a/checks/kemp_loadmaster_services
+++ b/checks/kemp_loadmaster_services
@@ -25,44 +25,87 @@
# Boston, MA 02110-1301 USA.
+# .1.3.6.1.4.1.12196.13.1.1.13.1 Exchange HTTPS
+# .1.3.6.1.4.1.12196.13.1.1.13.3 Exchange MAPI
+# .1.3.6.1.4.1.12196.13.1.1.13.4 Exchange SMTP
+# .1.3.6.1.4.1.12196.13.1.1.13.5 Lync Internal WebSvc HTTP
+# .1.3.6.1.4.1.12196.13.1.1.13.6 Lync Internal WebSvc HTTPS
+# .1.3.6.1.4.1.12196.13.1.1.14.1 1
+# .1.3.6.1.4.1.12196.13.1.1.14.3 1
+# .1.3.6.1.4.1.12196.13.1.1.14.4 1
+# .1.3.6.1.4.1.12196.13.1.1.14.5 1
+# .1.3.6.1.4.1.12196.13.1.1.14.6 1
+# .1.3.6.1.4.1.12196.13.1.1.21.1 882
+# .1.3.6.1.4.1.12196.13.1.1.21.3 6386
+# .1.3.6.1.4.1.12196.13.1.1.21.4 3
+# .1.3.6.1.4.1.12196.13.1.1.21.5 1
+# .1.3.6.1.4.1.12196.13.1.1.21.6 1
+
+# Some devices provide strange, wrong or incomplete data
+# and it's not possible to exclude them via std. OIDs
+# .1.3.6.1.4.1.12196.13.1.1.13.1 lbwebinterface --> B100-MIB::vSname.1
+# .1.3.6.1.4.1.12196.13.1.1.13.2 --> B100-MIB::vSname.2
+# .1.3.6.1.4.1.12196.13.1.1.13.3 --> B100-MIB::vSname.3
+# .1.3.6.1.4.1.12196.13.1.1.14.1 LB_WI --> B100-MIB::vSstate.1
+# .1.3.6.1.4.1.12196.13.1.1.14.2 --> B100-MIB::vSstate.2
+# .1.3.6.1.4.1.12196.13.1.1.14.3 CAG_LB --> B100-MIB::vSstate.3
+
+
kemp_loadmaster_service_default_levels = ( 1500, 2000 )
-def inventory_kemp_loadmaster_services(info):
- return [ ( x[0], kemp_loadmaster_service_default_levels ) for x in info ]
-
-def check_kemp_loadmaster_services(item, _no_params, info):
- service_states = ( 'in Service',
- 'out of Service',
- 'failed',
- 'disabled',
- 'sorry',
- 'redirect',
- 'errormsg')
- for line in info:
- if line[0] == item:
- service_state, conns = map(saveint, line[1:])
- message = "State: %s" % (service_states[service_state-1])
- perfdata = [ ('conns', conns) ]
- state = 3
- if service_state in [ 1, 6 ]:
- message += ", Active Connections: %s" % conns
- state = 0
- if service_state == 5:
- state = 1
- if service_state in [ 2, 3, 7 ]:
- state = 2
- return (state, message, perfdata)
- return 3, "Service not found"
+
+def parse_kemp_loadmaster_services(info):
+ map_states = {
+ "1" : (0, 'in service'),
+ "2" : (2, 'out of service'),
+ "3" : (2, 'failed'),
+ "4" : (3, 'disabled'),
+ "5" : (1, 'sorry'),
+ "6" : (0, 'redirect'),
+ "7" : (2, 'error message'),
+ }
+
+ parsed = {}
+ for name, status, conns in info:
+ if not (name == "" or len(status) > 1):
+ parsed.setdefault(name, {"state" : map_states[status]})
+ if conns.isdigit():
+ parsed[name].update({"conns" : int(conns)})
+
+ return parsed
+
+
+def inventory_kemp_loadmaster_services(parsed):
+ for item, iteminfo in parsed.items():
+ if iteminfo["state"] not in ["4", ""]:
+ yield item, kemp_loadmaster_service_default_levels
+
+
+def check_kemp_loadmaster_services(item, _no_params, parsed):
+ if item in parsed:
+ data = parsed[item]
+ state, state_readable = data["state"]
+ infotext = "State: %s" % state_readable
+
+ perfdata = []
+ if data.get("conns"):
+ infotext += ", Active connections: %s" % data["conns"]
+ perfdata.append( ('conns', data["conns"]) )
+
+ return state, infotext, perfdata
+
check_info["kemp_loadmaster_services"] = {
- "check_function" : check_kemp_loadmaster_services,
+ "parse_function" : parse_kemp_loadmaster_services,
"inventory_function" : inventory_kemp_loadmaster_services,
+ "check_function" : check_kemp_loadmaster_services,
"service_description" : "Service %s",
"has_perfdata" : True,
- "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.12196.250.10" or oid(".1.3.6.1.2.1.1.2.0") ==
".1.3.6.1.4.1.2021.250.10",
"snmp_info" : ( ".1.3.6.1.4.1.12196.13.1.1", [
- 13, # name
- 14, # state
- 21, # conns
- ] ),
+ "13", # B100-MIB::vSname
+ "14", # B100-MIB::vSstate
+ "21", # B100-MIB::conns
+ ]),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.12196.250.10" or \
+ oid(".1.3.6.1.2.1.1.2.0") ==
".1.3.6.1.4.1.2021.250.10",
}