Module: check_mk
Branch: master
Commit: 4f64d861e3f5cd43ecfe300c0d62cf0d190621c3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4f64d861e3f5cd…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Mar 6 14:43:57 2017 +0100
some refactoring of hr und ucd checks
Change-Id: I2eead811c3e0daf3f406228217b8af73e2607f42
---
checks/hr_cpu | 19 ++++++++++---------
checks/hr_fs | 34 +++++++++++++++++-----------------
checks/ucd_cpu_load | 22 +++++++++++-----------
3 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/checks/hr_cpu b/checks/hr_cpu
index 3f3e7b8..ca03596 100644
--- a/checks/hr_cpu
+++ b/checks/hr_cpu
@@ -52,15 +52,16 @@ def check_hr_cpu(_no_item, params, info):
return check_cpu_util(util, params, cores=cores)
-# HOST-RESOURCES-MIB::hrSystemUptime.0
check_info["hr_cpu"] = {
- 'check_function': check_hr_cpu,
- 'inventory_function': inventory_hr_cpu,
- 'service_description': 'CPU utilization',
- 'has_perfdata': True,
- 'snmp_info': ('.1.3.6.1.2.1.25.3.3.1', [2]),
- 'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.25.1.1.0'),
- 'group': 'cpu_utilization_os',
- 'includes': [ 'cpu_util.include' ],
+ 'inventory_function' : inventory_hr_cpu,
+ 'check_function' : check_hr_cpu,
+ 'service_description' : 'CPU utilization',
+ 'has_perfdata' : True,
+ 'snmp_info' : ('.1.3.6.1.2.1.25.3.3.1', [2]),
+ 'snmp_scan_function' : lambda oid: \
+ not not oid('.1.3.6.1.2.1.25.1.1.0'),
+ # HOST-RESOURCES-MIB::hrSystemUptime.0
+ 'group' : 'cpu_utilization_os',
+ 'includes' : [ 'cpu_util.include' ],
}
diff --git a/checks/hr_fs b/checks/hr_fs
index 6af8c21..fdbd0be 100644
--- a/checks/hr_fs
+++ b/checks/hr_fs
@@ -88,21 +88,21 @@ def check_hr_fs(item, params, info):
check_info["hr_fs"] = {
- 'check_function': check_hr_fs,
- 'inventory_function': inventory_hr_fs,
- 'service_description': 'Filesystem %s',
- 'has_perfdata': True,
- 'snmp_info': ('.1.3.6.1.2.1.25.2.3.1', [
- 2, # hrStorageType
- 3, # hrStorageDescr
- 4, # hrStorageAllocationUnits
- 5, # hrStorageSize
- 6, # hrStorageUsed
- ]),
- # HOST-RESOURCES-MIB::hrSystemUptime.0
- 'snmp_scan_function': lambda oid: \
- not not oid('.1.3.6.1.2.1.25.1.1.0'),
- 'group': 'filesystem',
- 'default_levels_variable': 'filesystem_default_levels',
- 'includes': [ "df.include" ],
+ 'inventory_function' : inventory_hr_fs,
+ 'check_function' : check_hr_fs,
+ 'service_description' : 'Filesystem %s',
+ 'has_perfdata' : True,
+ 'snmp_info' : ('.1.3.6.1.2.1.25.2.3.1', [
+ 2, # hrStorageType
+ 3, # hrStorageDescr
+ 4, # hrStorageAllocationUnits
+ 5, # hrStorageSize
+ 6, # hrStorageUsed
+ ]),
+ 'snmp_scan_function' : lambda oid: \
+ not not oid('.1.3.6.1.2.1.25.1.1.0'),
+ # HOST-RESOURCES-MIB::hrSystemUptime.0
+ 'group' : 'filesystem',
+ 'default_levels_variable' : 'filesystem_default_levels',
+ 'includes' : [ "df.include" ],
}
diff --git a/checks/ucd_cpu_load b/checks/ucd_cpu_load
index c5f303f..1dc4726 100644
--- a/checks/ucd_cpu_load
+++ b/checks/ucd_cpu_load
@@ -57,17 +57,17 @@ def check_ucd_cpu_load(item, params, info):
check_info["ucd_cpu_load"] = {
- 'check_function': check_ucd_cpu_load,
- 'inventory_function': inventory_ucd_cpu_load,
- 'service_description': 'CPU load',
- 'has_perfdata': True,
- 'snmp_info': ('.1.3.6.1.4.1.2021.10.1', [
- "5", # UCD-SNMP-MIB::laLoadInt Int
table
- "6", # UCD-SNMP-MIB::laLoadFloat
Float table
- ]),
+ 'inventory_function' : inventory_ucd_cpu_load,
+ 'check_function' : check_ucd_cpu_load,
+ 'service_description' : 'CPU load',
+ 'has_perfdata' : True,
+ 'snmp_info' : ('.1.3.6.1.4.1.2021.10.1', [
+ "5", # UCD-SNMP-MIB::laLoadInt
Int table
+ "6", # UCD-SNMP-MIB::laLoadFloat
Float table
+ ]),
# 'CPU load' is not available in the HR-MIB
# thus we cannot use 'prefer_hr_scan_function'
- 'snmp_scan_function': ucd_scan_function,
- 'group': 'cpu_load',
- "includes": ["cpu_load.include",
"ucd.include"],
+ 'snmp_scan_function' : ucd_scan_function,
+ 'group' : 'cpu_load',
+ "includes" : ["cpu_load.include",
"ucd.include"],
}