Module: check_mk
Branch: master
Commit: 7b593377ad8da5a448f6f519703a31cfbeadc344
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7b593377ad8da5…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Jan 15 16:29:04 2014 +0100
f5_big_ip_conns: check now supports predictive monitoring and both connections types are
merged in one check
---
.werks/568 | 8 ++++
ChangeLog | 1 +
checkman/f5_bigip_conns | 21 ++++-----
checks/f5_bigip_conns | 84 ++++++++++++++++++++++------------
web/plugins/wato/check_parameters.py | 20 ++++----
5 files changed, 81 insertions(+), 53 deletions(-)
diff --git a/.werks/568 b/.werks/568
new file mode 100644
index 0000000..164b5d4
--- /dev/null
+++ b/.werks/568
@@ -0,0 +1,8 @@
+Title: f5_big_ip_conns: check now supports predictive monitoring and both connections
types are merged in one check
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1389799642
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index d98f91b..2a51fe1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,7 @@
* 0445 mem.win: Allow time-averaging of values before applying levels...
* 0446 mem.used, solaris_mem: Introduce optional averaging of used memory...
* 0566 services.summary: new check to monitor stopped services of mode autostart in
windows
+ * 0568 f5_big_ip_conns: check now supports predictive monitoring and both connections
types are merged in one check
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/f5_bigip_conns b/checkman/f5_bigip_conns
index 6629dd8..5c866cc 100644
--- a/checkman/f5_bigip_conns
+++ b/checkman/f5_bigip_conns
@@ -5,30 +5,25 @@ license: GPL
distribution: check_mk
description:
The check queries the MIB tables of F5 BIG-IP loadbalancers (local traffic managers)
- for the number of current connections and the number of current ssl connections.
+ for the number of current connections {sysStatClientCurConns} and the number of current
+ ssl connections {sysClientsslStatCurConns}.
+ Warning and critical limits can be given for both types of data.
It supports devices running the 9.0 and above releases of the F5 OS. It's tested
against 9.3
devices.
- Warning and critical limits can be given for both types of data.
-
The check is supported by WATO.
-inventory:
- The check has two items per host, the number of connections, and the number of ssl
connections
-
perfdata:
- The value: the number of current connections
+ At least two values: the number of current connections and ssl connections
[parameters]
-parameters(dict): parameters is a dictionary with two keys
-
- {"conns"}: the number of connections from {sysStatClientCurConns }
-
- {"sslconns"}: the number of ssl connections from {sysClientsslStatCurConns }
+parameters(dict): parameters is a dictionary with two keys {"conns"} and
{"ssl_conns"}.
+The keys may be a tuple of warning and critical levels. However, when using predictive
levels
+via WATO, the keys are dictionaries themselves with several keys and values.
[configuration]
-f5_bigip_conns_default_levels(dict): This variable is preset to {{ "conns": (
25000, 30000 ) }, "sslconns": ( 25000, 30000 )}
+f5_bigip_conns_default_levels(dict): This variable is preset to {{ "conns": (
25000, 30000 ) }, "ssl_conns": ( 25000, 30000 )}
diff --git a/checks/f5_bigip_conns b/checks/f5_bigip_conns
index 09e6eb1..1b4039e 100644
--- a/checks/f5_bigip_conns
+++ b/checks/f5_bigip_conns
@@ -29,41 +29,68 @@
# {iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 3375
bigipTrafficMgmt(2) bigipSystem(1) sysGlobals(1) sysGlobalStats(2)
sysGlobalClientSslStat(9) sysClientsslStatCurConns(2)}
-
-# f5_bigip_conns_default_levels = ( 25000, 30000 )
factory_settings["f5_bigip_conns_default_levels"] = {
"conns": ( 25000, 30000 ),
- "sslconns": ( 25000, 30000 ),
+ "ssl_conns": ( 25000, 30000 ),
}
-
def inventory_f5_bigip_conns(info):
- inventory = []
- if info[0][0]:
- inventory.append( ( "Open Connections", {} ) )
- if info[0][1]:
- inventory.append( ( "Open SSL Connections", {} ) )
-
- return inventory
+ #inventory = []
+ #if info[0][0]:
+ # inventory.append( ( "Open Connections", {} ) )
+ #if info[0][1]:
+ # inventory.append( ( "Open SSL Connections", {} ) )
+ #return inventory
+ if info:
+ return [ ( None, {} ) ]
def check_f5_bigip_conns(item, params, info):
- if item == "Open Connections":
- warn, crit = params.get("conns")
- conns = int(info[0][0])
- elif item == "Open SSL Connections":
- warn, crit = params.get("sslconns")
- conns = int(info[0][1])
- else:
- return 3, "no such item"
+ type_list = { 'conns': ('Connections', 0),
+ 'ssl_conns': ('SSL Connections', 1),
+ }
+ perfdata = []
+ infotext = ""
+ state = 0
- infotext = "Number %d (limits %d/%d)" % (conns, warn, crit)
- perfdata = [ ("conns", conns, warn, crit ) ]
- if conns > crit:
- state = 2
- elif conns > warn:
- state = 1
- else:
- state = 0
+ separator = ""
+ for typ, values in type_list.iteritems():
+ param = params.get(typ)
+ desc = values[0]
+ index = values[1]
+ conns = int(info[0][index])
+ infotext += separator
+ separator = " - "
+ if type(param) == tuple:
+ warn, crit = param
+ perfdata.append( (typ, conns, warn, crit) )
+ if conns >=crit:
+ sstate = 2
+ sym = "(!!)"
+ elif conns >= warn:
+ sstate = 1
+ sym = "(!)"
+ else:
+ sstate = 0
+ sym = ""
+ infotext += "%d %s%s (%d/%d)" % (conns, desc, sym, warn, crit)
+ else:
+ warn, crit = None, None
+ perf = ( (typ, conns, warn, crit) )
+ sstate, text, extraperf = check_levels(conns, typ, param)
+ if sstate == 2:
+ sym == "(!!)"
+ elif sstate == 1:
+ sym = "(!)"
+ else:
+ sym = ""
+ perfdata.append(perf)
+ if len(extraperf) > 0:
+ perfdata.append(extraperf[0])
+ infotext += "%d %s%s" % (conns, desc, sym)
+ if text:
+ infotext += ", " + text
+ if state < sstate:
+ state = sstate
return (state, infotext, perfdata)
@@ -72,7 +99,8 @@ check_info["f5_bigip_conns"] = {
'inventory_function' : inventory_f5_bigip_conns,
'service_description' : 'Open Connections',
'has_perfdata' : True,
- 'default_levels_variable' : "f5_bigip_conns_default_levels",
+ 'group' : 'f5_connections',
+ 'default_levels_variable' : 'f5_bigip_conns_default_levels',
'snmp_info' : ( '.1.3.6.1.4.1.3375.2.1.1.2', [
'1.8', # sysStatServerCurConns
'9.2', # sysClientsslStatCurConns
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 5729bfd..b62ee2b 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2736,21 +2736,17 @@ register_check_parameters(
Dictionary(
elements = [
( "conns",
- Tuple(
- title = _("Max. number of connections"),
- elements = [
- Integer(title = _("Warning if above"), default_value =
25000 ),
- Integer(title = _("Critical if above"), default_value =
30000 ) ,
- ]
+ Levels(
+ title = _("Max. number of connections"),
+ default_value = None,
+ default_levels = (25000, 30000)
)
),
( "ssl_conns",
- Tuple(
- title = _("Max. number of ssl connections"),
- elements = [
- Integer(title = _("Warning if above"), default_value =
25000 ),
- Integer(title = _("Critical if above"), default_value =
30000 ),
- ]
+ Levels(
+ title = _("Max. number of connections"),
+ default_value = None,
+ default_levels = (25000, 30000)
)
),
]),