Module: check_mk
Branch: master
Commit: 49469bfbb0370d300aebfab199f11b1962d69575
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=49469bfbb0370d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jul 21 15:15:29 2015 +0200
cpu.loads: output load per core in check output
---
checks/cpu | 43 ++++++++++++++++++++++++++++++++++---------
checks/cpu_load.include | 2 +-
2 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/checks/cpu b/checks/cpu
index 3fdd7c0..8523fff 100644
--- a/checks/cpu
+++ b/checks/cpu
@@ -28,13 +28,24 @@
# 0.26 0.47 0.52 2/459 19531 4
+# .--Load----------------------------------------------------------------.
+# | _ _ |
+# | | | ___ __ _ __| | |
+# | | | / _ \ / _` |/ _` | |
+# | | |__| (_) | (_| | (_| | |
+# | |_____\___/ \__,_|\__,_| |
+# | |
+# '----------------------------------------------------------------------'
+
+
cpuload_default_levels = (5, 10)
-threads_default_levels = (2000, 4000)
+
def inventory_cpu_load(info):
if len(info) == 1 and len(info[0]) >= 5:
return [(None, "cpuload_default_levels")]
+
def check_cpu_load(item, params, info):
if len(info[0]) >= 6:
num_cpus = int(info[0][5])
@@ -45,6 +56,28 @@ def check_cpu_load(item, params, info):
return check_cpu_load_generic(params, load, num_cpus)
+check_info["cpu.loads"] = {
+ "check_function" : check_cpu_load,
+ "inventory_function" : inventory_cpu_load,
+ "service_description" : "CPU load",
+ "has_perfdata" : True,
+ "group" : "cpu_load",
+ "includes" : ["cpu_load.include"],
+}
+
+
+#.
+# .--Threads-------------------------------------------------------------.
+# | _____ _ _ |
+# | |_ _| |__ _ __ ___ __ _ __| |___ |
+# | | | | '_ \| '__/ _ \/ _` |/ _` / __| |
+# | | | | | | | | | __/ (_| | (_| \__ \ |
+# | |_| |_| |_|_| \___|\__,_|\__,_|___/ |
+# | |
+# '----------------------------------------------------------------------'
+
+threads_default_levels = (2000, 4000)
+
def inventory_cpu_threads(info):
if len(info) == 1 and len(info[0]) >= 5:
return [(None, "", "threads_default_levels")]
@@ -63,14 +96,6 @@ def check_cpu_threads(item, params, info):
else:
return (0, "%d threads" % (nthreads,), perfdata)
-check_info["cpu.loads"] = {
- "check_function" : check_cpu_load,
- "inventory_function" : inventory_cpu_load,
- "service_description" : "CPU load",
- "has_perfdata" : True,
- "group" : "cpu_load",
- "includes" : ["cpu_load.include"],
-}
check_info["cpu.threads"] = {
"check_function" : check_cpu_threads,
diff --git a/checks/cpu_load.include b/checks/cpu_load.include
index ac92a9f..9401a31 100644
--- a/checks/cpu_load.include
+++ b/checks/cpu_load.include
@@ -46,7 +46,7 @@ def check_cpu_load_generic(params, load, num_cpus=1):
perfdata += perf
infotext = "15min load %.2f" % load[2]
if num_cpus > 1:
- infotext += " at %d CPUs" % num_cpus
+ infotext += " at %d Cores (%.2f per Core)" % (num_cpus,
load[2]/num_cpus)
if text:
infotext += ", " + text
return state, infotext, perfdata