Module: check_mk
Branch: master
Commit: 244f577c32591f07640568cfdac4882e63698cce
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=244f577c32591f…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Fri Oct 2 10:24:34 2015 +0200
updates to the per-process details in ps checks
the option to produce long output is now available in "State and count of processes" as well.
Also: fixed a bug accessing uninitialised variable "pid".
---
checks/ps.include | 14 ++++++--------
web/plugins/wato/check_parameters.py | 32 ++++++++++++++++----------------
2 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/checks/ps.include b/checks/ps.include
index e457e53..89d180c 100644
--- a/checks/ps.include
+++ b/checks/ps.include
@@ -61,7 +61,7 @@ def inventory_ps_common(invdata, invrules, info):
inv_entry += ([],)
default_levels = inv_entry[3:7]
- entries.append(inv_entry[:3] + [None] + ({ "levels" : default_levels },) + ["disable"])
+ entries.append(inv_entry[:3] + [None] + ({ "levels" : default_levels },))
# Handle new WATO style inventory rules
for rule in invrules:
@@ -78,9 +78,9 @@ def inventory_ps_common(invdata, invrules, info):
v = rule[0]
- entries.append((v['descr'], v.get('match'), v.get('user'), v.get('icon'), v.get('default_params', v), v.get('process_info', 'disable')))
+ entries.append((v['descr'], v.get('match'), v.get('user'), v.get('icon'), v.get('default_params', v)))
- for servicedesc, pattern, userspec, icon, default_params, process_info in entries:
+ for servicedesc, pattern, userspec, icon, default_params in entries:
num_perc_s = servicedesc.count("%s")
for line in info:
# First entry in line is the node name or None for non-clusters
@@ -122,8 +122,6 @@ def inventory_ps_common(invdata, invrules, info):
if icon:
inv_params["icon"] = icon
- inv_params["process_info"] = process_info
-
# default_params is either a clean dict with optional parameters to set as default
# or - from version 1.2.4 - the dict from the rule itself. In the later case
# we need o remove the keys that do not specify default parameters
@@ -369,6 +367,7 @@ def check_ps_common(item, params, info, cpu_cores = 1, info_name = "processes",
handle_count += handle_c
process.append(("cpu usage (user space)", (user_perc, "%")))
process.append(("cpu_usage (kernel space)", (kernel_perc, "%")))
+ process.append(("pid", (pid, "")))
else:
# addinfo[3] contains the used CPU time and possibly, separated by /, also
# the total elapsed time since the birth of the process.
@@ -392,13 +391,12 @@ def check_ps_common(item, params, info, cpu_cores = 1, info_name = "processes",
cputime = 0
pcpu = cputime * 100
+ process.append(("pid", (pid, "")))
else:
pcpu = savefloat(addinfo[3])
percent_cpu += pcpu
process.append(("cpu usage", (pcpu, "%")))
- process.append(("pid", (pid, "")))
-
extended_perfdata = True
elif len(line) > 1:
# otherwise we have only two fields, one of which is the node. if the remaining
@@ -522,7 +520,7 @@ def check_ps_common(item, params, info, cpu_cores = 1, info_name = "processes",
state = max(state, 1)
infotext += "(!)"
- if "process_info" in params and params["process_info"] != "disable":
+ if params.get("process_info", None) is not None:
infotext += "\r\n" + format_process_list(processes, params["process_info"] == "html")
return state, infotext, perfdata
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 2c8ef22..0262b3f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1164,6 +1164,22 @@ process_level_elements = [
),
],
)),
+ ('process_info', DropdownChoice(
+ title = _("Enable per-process details in long-output"),
+ label = _("Enable per-process details"),
+ help = _("If active, the long output of this service will contain a list of "
+ "all the matching processes and their details (i.e. pid, cpu usage, memory usage. "
+ "Please note that HTML output will only work if \"Escape HTML codes in plugin output\" is "
+ "disabled in global settings. This might expose you to Cross-Site-Scripting (everyone "
+ "with write-access to checks could get scripts executed on the monitoring site in the context "
+ "of the user of the monitoring site) so please do this if you understand the consequences."),
+ choices = [
+ (None, _("Disable")),
+ ("text", _("Text output")),
+ ("html", _("HTML output"))
+ ],
+ default_value = "disable",
+ )),
]
# In version 1.2.4 the check parameters for the resulting ps check
@@ -1265,22 +1281,6 @@ register_rule(group + '/' + subgroup_inventory,
title = _("Add custom icon or action"),
help = _("You can assign icons or actions to the found services in the status GUI."),
)),
- ('process_info', DropdownChoice(
- title = _("Enable per-process details in long-output"),
- label = _("Enable per-process details"),
- help = _("If active, the long output of this service will contain a list of "
- "all the matching processes and their details (i.e. pid, cpu usage, memory usage. "
- "Please note that HTML output will only work if \"Escape HTML codes in plugin output\" is "
- "disabled in global settings. This might expose you to Cross-Site-Scripting (everyone "
- "with write-access to checks could get scripts executed on the monitoring site in the context "
- "of the user of the monitoring site) so please do this if you understand the consequences."),
- choices = [
- ("disable", _("Disable")),
- ("text", _("Text output")),
- ("html", _("HTML output"))
- ],
- default_value = "disable",
- )),
('default_params',
Dictionary(
title = _("Default parameters for detected services"),
Module: check_mk
Branch: master
Commit: 3b482b596352836bf6beda48db1f12922755ffae
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3b482b59635283…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Oct 2 07:52:12 2015 +0200
new gitbug
---
.bugs/2369 | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/.bugs/2369 b/.bugs/2369
new file mode 100644
index 0000000..00dbeca
--- /dev/null
+++ b/.bugs/2369
@@ -0,0 +1,10 @@
+Title: SNMP scan functions: improvement
+Component: checks
+State: open
+Date: 2015-10-02 07:42:54
+Targetversion: future
+Class: todo
+
+There are too many OIDs which are checked so we have to improve the SNMP scan functions in the checks.
+But there are some exceptions e.g. interfaces.
+This should be done before version 1.2.8
\ No newline at end of file