Module: check_mk
Branch: master
Commit: 324f15dc3edb248d140b5e7ab69e59544e4710fe
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=324f15dc3edb24…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jan 30 11:36:09 2012 +0100
Minor code cleanup in checks
---
checks/cisco_temp | 2 +-
checks/cisco_temp_perf | 2 +-
checks/cpu | 22 +++++++++++-----------
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/checks/cisco_temp b/checks/cisco_temp
index 072d2ba..3398eaf 100644
--- a/checks/cisco_temp
+++ b/checks/cisco_temp
@@ -54,7 +54,7 @@ def inventory_cisco_temp(checktyp, info):
# Skip sensors with state 5 (not present)
return [ (name, None) for (name, state) in info if state != '5' ]
-def check_cisco_temp(item, params, info):
+def check_cisco_temp(item, _no_params, info):
for name, state in info:
if name == item:
if state == '1':
diff --git a/checks/cisco_temp_perf b/checks/cisco_temp_perf
index 6b0d494..f13f18c 100644
--- a/checks/cisco_temp_perf
+++ b/checks/cisco_temp_perf
@@ -64,7 +64,7 @@ def inventory_cisco_temp_perf(info):
inventory.append((name, None))
return inventory
-def check_cisco_temp_perf(item, params, info):
+def check_cisco_temp_perf(item, _no_params, info):
for line in info:
if line[0] == item or line[4] == item:
temp = saveint(line[1])
diff --git a/checks/cpu b/checks/cpu
index 48d61e8..811b33b 100644
--- a/checks/cpu
+++ b/checks/cpu
@@ -24,25 +24,25 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+# Output is taken from /proc/loadavg plus the number of cores:
+# 0.26 0.47 0.52 2/459 19531 4
+
cpuload_default_levels = (5, 10)
threads_default_levels = (2000.0, 4000.0)
def inventory_cpu_load(info):
if len(info) == 1 and len(info[0]) >= 5:
- return [(None, "", "cpuload_default_levels")]
+ return [(None, "cpuload_default_levels")]
def check_cpu_load(item, params, info):
- try:
- load = []
- for i in [ 0, 1, 2 ]:
- load.append(float(info[0][i]))
- if len(info[0]) >= 6:
- num_cpus = int(info[0][5])
- else:
- num_cpus = 1
- except:
- return (3, "Unknown - invalid or incomplete output from plugin")
+ load = []
+ for i in [ 0, 1, 2 ]:
+ load.append(float(info[0][i]))
+ if len(info[0]) >= 6:
+ num_cpus = int(info[0][5])
+ else:
+ num_cpus = 1
warn, crit = params # apply on 15min average, relative to number of CPUs
warn = warn * num_cpus