Module: check_mk
Branch: master
Commit: f684c2ef6cd676b4c1f2a0268a007ba556e355c8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f684c2ef6cd676…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Oct 1 16:25:56 2013 +0200
state and count of processes: no longer in inventorized checks. new: resident and virtual
memory levels
---
ChangeLog | 7 +++++++
checks/ps | 21 ++++++++++++++++-----
web/plugins/wato/check_parameters.py | 20 ++++++++++++++++++--
3 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 94b32a3..2a08708 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,13 @@
* FIX: ldap attribute plugins: fixed crash when parameters are None
* FIX: avoid duplicate output of log message in log tables
+ WATO:
+ * Rule "State and count of processes": New configuration options:
+ virtual and resident memory levels
+ * FIX: The rule "State and count of processes" is no longer available
+ in "Parameters for inventorized check". This rule was solely
+ intented for "Manual checks" configuration
+
1.2.3i2:
Core:
* New option -B for just generating the configuration
diff --git a/checks/ps b/checks/ps
index 150e935..6d7d705 100644
--- a/checks/ps
+++ b/checks/ps
@@ -101,11 +101,11 @@ def ps_parse_info(info):
pid = int(psinfo["ProcessId"])
if pid not in seen_pids:
seen_pids.add(pid)
- mem = int(psinfo["WorkingSetSize"]) / 1024 # Bytes
-> KB
- page = int(psinfo["PageFileUsage"]) / 1024 # Bytes ->
KB
+ virt = int(psinfo["VirtualSize"]) / 1024 # Bytes ->
KB
+ resi = int(psinfo["WorkingSetSize"]) / 1024 # Bytes
-> KB
userc = int(psinfo["UserModeTime"]) # do not resolve
counter here!
kernelc = int(psinfo["KernelModeTime"]) # do not resolve
counter here!
- line[1:1] = [ "(unknown,%d,%d,@%d/%d/%d)" % (mem, page,
pid, userc, kernelc) ]
+ line[1:1] = [ "(unknown,%d,%d,@%d/%d/%d)" % (virt, resi,
pid, userc, kernelc) ]
info.append(line)
return cpu_cores, info
else:
@@ -361,8 +361,19 @@ def check_procs(item, params, info, with_perfdata):
infotext += " (ok from %d to %d)(!)" % (params["okmin"],
params["okmax"])
if virtual_size:
- infotext += " %.1f MB virtual, %.1f MB resident, %.1f%% CPU" % (
- virtual_size / 1024.0, resident_size / 1024.0, percent_cpu)
+ for size, name in [ (virtual_size, "virtual"), (resident_size,
"resident") ]:
+ infotext += " %.1f MB %s" % ((size / 1024.0), name)
+ if "%s_levels" % name in params:
+ warn_level, crit_level = params["%s_levels" % name]
+ if size * 1024 >= crit_level:
+ state = 2
+ infotext += "(!!)"
+ elif size * 1024 >= warn_level:
+ state = max(state, 1)
+ infotext += "(!)"
+ infotext += ","
+
+ infotext += " %.1f%% CPU" % percent_cpu
if "cpu_average" in params:
timedif, avg_cpu = get_average("ps.%s.cpu" % item, now,
percent_cpu, params["cpu_average"], False)
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 438e24a..54f87be 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3866,9 +3866,25 @@ register_check_parameters(
default_value = 15,
)
),
+ ( "virtual_levels",
+ Tuple(
+ title = _("Virtual memory usage"),
+ elements = [
+ Filesize(title = _("Warning at")),
+ Filesize(title = _("Critical at")),
+ ],
+ )),
+ ( "resident_levels",
+ Tuple(
+ title = _("Physical memory usage"),
+ elements = [
+ Filesize(title = _("Warning at")),
+ Filesize(title = _("Critical at")),
+ ],
+ )),
],
- optional_keys = [ "user", "cpulevels",
"cpu_average" ]),
+ optional_keys = [ "user", "cpulevels",
"cpu_average", "virtual_levels", "resident_levels" ]),
forth = ps_convert_from_tuple,
),
TextAscii(
@@ -3879,5 +3895,5 @@ register_check_parameters(
regex_error = _("Please use only a-z, A-Z, 0-9, space, underscore, "
"dot and hyphon for your service description"),
),
- "first", True
+ "first", False
)