Module: check_mk
Branch: master
Commit: 9251fa680ebc827068d70092f9a0b595e1ea5ef2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9251fa680ebc82…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Jul 1 11:10:11 2016 +0200
3690 apache_status: upper levels for busy workers are now configurable
---
.werks/3690 | 9 ++++++++
ChangeLog | 1 +
checkman/apache_status | 3 ++-
checks/apache_status | 40 ++++++++++++++++++++++++----------
web/plugins/wato/check_parameters.py | 28 ++++++++++++++++--------
5 files changed, 60 insertions(+), 21 deletions(-)
diff --git a/.werks/3690 b/.werks/3690
new file mode 100644
index 0000000..9f4dac3
--- /dev/null
+++ b/.werks/3690
@@ -0,0 +1,9 @@
+Title: apache_status: upper levels for busy workers are now configurable
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i1
+Date: 1467364167
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 25b0939..9c2453f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -108,6 +108,7 @@
* 3684 infoblox_systeminfo: new inventory plugin for Infoblox devices which support
the IB-PLATFORMONE MIB
* 3688 perle_chassis, perle_chassis.temp, perle_chassis_slots, perle_modules_cm1000,
perle_modules_cm1110, perle_modules_mgt, perle_psmu, perle_psmu.fan: new checks for Perle
Mediaconverter devices which support the PERLE-MCR-MGT MIB
* 3689 brocade_fcport: now monitors BBcredit zero stats and the number of encoding
error or disparity error inside frames received
+ * 3690 apache_status: upper levels for busy workers are now configurable
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/checkman/apache_status b/checkman/apache_status
index 32ebb3c..3be7552 100644
--- a/checkman/apache_status
+++ b/checkman/apache_status
@@ -49,7 +49,8 @@ perfdata:
[parameters]
parameters(dict): a dictionary with the optional key
- {"OpenSlots"} : (int, int) - warn/crit levels for the number of remaining
open slots
+ {"OpenSlots"} : (int, int) - lower warn/crit levels for the number of
remaining open slots
+ {"BusyWorkers"} : (int, int) - upper warn/crit levels for the number busy
workers
diff --git a/checks/apache_status b/checks/apache_status
index 8b73e30..03c661f 100644
--- a/checks/apache_status
+++ b/checks/apache_status
@@ -25,22 +25,38 @@
# Boston, MA 02110-1301 USA.
-def apache_status_open_slots(value, params):
+def apache_status_check_params(value, params, op_txt):
+ def apply_operator(val, param, op_txt):
+ if op_txt == "at":
+ return val >= param
+ elif op_txt == "below":
+ return val < param
+
warn, crit = params
extra_perf = [ warn, crit ]
- if value <= crit:
- return 2, "(!!)", extra_perf
- elif value <= warn:
- return 1, "(!)", extra_perf
- else:
- return 0, "", extra_perf
+ levelstxt = ""
+ state = 0
+
+ if apply_operator(value, crit, op_txt):
+ state = 2
+ symbol = "(!!)"
+ elif apply_operator(value, warn, op_txt):
+ state = 1
+ symbol = "(!)"
+
+ if state:
+ levelstxt += " (warn/crit %s %s/%s)%s" % \
+ (op_txt, warn, crit, symbol)
+
+ return state, levelstxt, extra_perf
+
_apache_status_fields = {
# key sort convert-func param_function
'Uptime': (0, int),
'IdleWorkers': (5, int),
- 'BusyWorkers': (6, int),
- 'OpenSlots': (7, int, apache_status_open_slots),
+ 'BusyWorkers': (6, int, apache_status_check_params,
"at"),
+ 'OpenSlots': (7, int, apache_status_check_params,
"below"),
'TotalSlots': (8, int),
'Total Accesses': (9, int),
'CPULoad': (10, float),
@@ -171,8 +187,10 @@ def check_apache_status(item, params, info):
extra_info = ""
extra_perf = []
- if params.get(key) and len(_apache_status_fields[key]) > 2:
- key_state, extra_info, extra_perf = _apache_status_fields[key][2](value,
params.get(key))
+ apache_status_key = _apache_status_fields[key]
+ if params.get(key) and len(apache_status_key) > 3:
+ key_state, extra_info, extra_perf = \
+ apache_status_key[2](value, params.get(key), apache_status_key[3])
worst_state = max(key_state, worst_state)
output.append('%s: %s%s' % (key, display_value, extra_info))
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 8b144ff..ccd62d2 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3603,15 +3603,25 @@ register_check_parameters(
Dictionary(
elements = [
( "OpenSlots",
- Tuple(
- title = _("Remaining Open Slots"),
- help = _("Here you can set the number of remaining open
slots"),
- elements = [
- Integer(title = _("Warning at"), label =
_("slots")),
- Integer(title = _("Critical at"), label =
_("slots"))
- ]
- )
- )
+ Tuple(
+ title = _("Remaining Open Slots"),
+ help = _("Here you can set the number of remaining open
slots"),
+ elements = [
+ Integer(title = _("Warning below"), label =
_("slots")),
+ Integer(title = _("Critical below"), label =
_("slots"))
+ ]
+ )
+ ),
+ ( "BusyWorkers",
+ Tuple(
+ title = _("Busy workers"),
+ help = _("Here you can set upper levels of busy
workers"),
+ elements = [
+ Integer(title = _("Warning at"), label = _("busy
workers")),
+ Integer(title = _("Critical at"), label = _("busy
workers"))
+ ]
+ )
+ ),
]
),
TextAscii(