Module: check_mk
Branch: master
Commit: 60ca3fdb9c287ebef205747c79bd6d20bdd6cdca
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=60ca3fdb9c287e…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Feb 16 10:47:20 2016 +0100
#3185 FIX ucd_cpu_load: this service will be discovered although we prefer HOST-RESOURCES
MIB
---
.werks/3185 | 9 +++++++++
ChangeLog | 2 ++
checks/hr_cpu | 8 ++++++++
checks/hr_fs | 13 +++++++++++++
checks/ucd.include | 28 +++++++++++++++++-----------
checks/ucd_cpu_load | 2 ++
checks/ucd_cpu_util | 2 +-
checks/ucd_disk | 2 +-
checks/ucd_mem | 2 +-
checks/ucd_processes | 2 +-
10 files changed, 55 insertions(+), 15 deletions(-)
diff --git a/.werks/3185 b/.werks/3185
new file mode 100644
index 0000000..41ce879
--- /dev/null
+++ b/.werks/3185
@@ -0,0 +1,9 @@
+Title: ucd_cpu_load: this service will be discovered although we prefer HOST-RESOURCES
MIB
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.9i1
+Date: 1455615905
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index affb459..6829cfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,8 @@
* 3211 FIX: logwatch: Fixed broken error messages in case of failed filesystem
operations
* 3212 FIX: cmciii.phase: Fixed totally broken check
* 3213 FIX: ibm_svc_disks netapp_api_disk: Fixed exception when disks are failed
+ * 3185 FIX: ucd_cpu_load: this service will be discovered although we prefer
HOST-RESOURCES MIB
+ NOTE: Please refer to the migration notes!
Multisite:
* 3059 FIX: Fixed highlighting of availability timeline time slices
diff --git a/checks/hr_cpu b/checks/hr_cpu
index b1d8a4c..3f3e7b8 100644
--- a/checks/hr_cpu
+++ b/checks/hr_cpu
@@ -24,11 +24,19 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
+# .1.3.6.1.2.1.25.3.3.1.2.768 1 --> HOST-RESOURCES-MIB::hrProcessorLoad.768
+# .1.3.6.1.2.1.25.3.3.1.2.769 1 --> HOST-RESOURCES-MIB::hrProcessorLoad.769
+
+
hr_cpu_default_levels = (80.0, 90.0)
+
+
def inventory_hr_cpu(info):
if len(info) >= 1:
return [(None, "hr_cpu_default_levels")]
+
def check_hr_cpu(_no_item, params, info):
num_cpus = 0
util = 0
diff --git a/checks/hr_fs b/checks/hr_fs
index 8c9a591..6af8c21 100644
--- a/checks/hr_fs
+++ b/checks/hr_fs
@@ -24,6 +24,19 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
+# .1.3.6.1.2.1.25.2.3.1.2.1 .1.3.6.1.2.1.25.2.1.2 -->
HOST-RESOURCES-MIB::hrStorageType.1
+# .1.3.6.1.2.1.25.2.3.1.2.3 .1.3.6.1.2.1.25.2.1.3 -->
HOST-RESOURCES-MIB::hrStorageType.3
+# .1.3.6.1.2.1.25.2.3.1.3.1 Physical memory --> HOST-RESOURCES-MIB::hrStorageDescr.1
+# .1.3.6.1.2.1.25.2.3.1.3.3 Virtual memory --> HOST-RESOURCES-MIB::hrStorageDescr.3
+# .1.3.6.1.2.1.25.2.3.1.4.1 1024 --> HOST-RESOURCES-MIB::hrStorageAllocationUnits.1
+# .1.3.6.1.2.1.25.2.3.1.4.3 1024 --> HOST-RESOURCES-MIB::hrStorageAllocationUnits.3
+# .1.3.6.1.2.1.25.2.3.1.5.1 8122520 --> HOST-RESOURCES-MIB::hrStorageSize.1
+# .1.3.6.1.2.1.25.2.3.1.5.3 21230740 --> HOST-RESOURCES-MIB::hrStorageSize.3
+# .1.3.6.1.2.1.25.2.3.1.6.1 7749124 --> HOST-RESOURCES-MIB::hrStorageUsed.1
+# .1.3.6.1.2.1.25.2.3.1.6.3 7749124 --> HOST-RESOURCES-MIB::hrStorageUsed.3
+
+
# Juniper devices put information about the device into the
# field where we expect the mount point. Ugly. Remove that crap.
def fix_hr_fs_mountpoint(mp):
diff --git a/checks/ucd.include b/checks/ucd.include
index 82d2fe6..e337cd0 100644
--- a/checks/ucd.include
+++ b/checks/ucd.include
@@ -32,14 +32,20 @@
def ucd_scan_function(oid):
- return (("linux" in oid(".1.3.6.1.2.1.1.1.0").lower() or \
- "CMC-TC" in oid(".1.3.6.1.2.1.1.1.0") or \
- "HP Onboard Administrator" in oid(".1.3.6.1.2.1.1.1.0")
or \
- # for barracuda spam firewall appliance
- "barracuda" in oid(".1.3.6.1.2.1.1.1.0").lower() or \
- # for artec email archiv appliance
- ( oid('.1.3.6.1.2.1.1.2.0') == '.1.3.6.1.4.1.8072.3.2.10'
and \
- "version" in oid('.1.3.6.1.2.1.1.1.0').lower() and \
- "serial" in oid('.1.3.6.1.2.1.1.1.0').lower() )) and \
- # we prefer HOST-RESOURCES-MIB implementation
- not oid(".1.3.6.1.2.1.25.1.1.0"))
+ return ("linux" in oid(".1.3.6.1.2.1.1.1.0").lower() or \
+ "CMC-TC" in oid(".1.3.6.1.2.1.1.1.0") or \
+ "HP Onboard Administrator" in oid(".1.3.6.1.2.1.1.1.0")
or \
+ # for barracuda spam firewall appliance
+ "barracuda" in oid(".1.3.6.1.2.1.1.1.0").lower() or \
+ # for artec email archiv appliance
+ ( oid('.1.3.6.1.2.1.1.2.0') == '.1.3.6.1.4.1.8072.3.2.10' and
\
+ "version" in oid('.1.3.6.1.2.1.1.1.0').lower() and \
+ "serial" in oid('.1.3.6.1.2.1.1.1.0').lower() ))
+
+
+def prefer_hr_scan_function(oid):
+ # We prefer HOST-RESOURCES-MIB implementation but not in case
+ # of check 'ucd_cpu_load' because the HR-MIB has not data
+ # about cpu load
+ return ucd_scan_function(oid) and \
+ not oid(".1.3.6.1.2.1.25.1.1.0")
diff --git a/checks/ucd_cpu_load b/checks/ucd_cpu_load
index a8c72d0..04bfae0 100644
--- a/checks/ucd_cpu_load
+++ b/checks/ucd_cpu_load
@@ -44,6 +44,8 @@ check_info["ucd_cpu_load"] = {
'service_description': 'CPU load',
'has_perfdata': True,
'snmp_info': ('.1.3.6.1.4.1.2021.10.1', [6]),
+ # '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"],
diff --git a/checks/ucd_cpu_util b/checks/ucd_cpu_util
index 72287d2..bd17d85 100644
--- a/checks/ucd_cpu_util
+++ b/checks/ucd_cpu_util
@@ -88,7 +88,7 @@ check_info["ucd_cpu_util"] = {
'service_description': 'CPU utilization',
'has_perfdata': True,
'snmp_info': ('.1.3.6.1.4.1.2021.11', [50, 51, 52, 53,
54, 55, 56]),
- 'snmp_scan_function': ucd_scan_function,
+ 'snmp_scan_function': prefer_hr_scan_function,
'includes': [ "ucd.include" ],
'group': 'cpu_iowait',
}
diff --git a/checks/ucd_disk b/checks/ucd_disk
index c101254..b97ed6d 100644
--- a/checks/ucd_disk
+++ b/checks/ucd_disk
@@ -51,7 +51,7 @@ check_info['ucd_disk'] = {
"6", # dskTotal -> in kBytes
"7", # dskAvail -> in kBytes
]),
- 'snmp_scan_function' : ucd_scan_function,
+ 'snmp_scan_function' : prefer_hr_scan_function,
"group" : "filesystem",
'default_levels_variable' : "filesystem_default_levels",
'includes' : [ "ucd.include",
"df.include" ],
diff --git a/checks/ucd_mem b/checks/ucd_mem
index 24bb8b7..54d9f94 100644
--- a/checks/ucd_mem
+++ b/checks/ucd_mem
@@ -58,7 +58,7 @@ check_info['ucd_mem'] = {
"5", # memTotal -> kB
"6", # memAvailable -> kB
]),
- 'snmp_scan_function' : ucd_scan_function,
+ 'snmp_scan_function' : prefer_hr_scan_function,
'default_levels_variable' : 'ucd_mem_default_levels',
'group' : 'memory_simple',
'includes' : [ "ucd.include",
"memory.include" ],
diff --git a/checks/ucd_processes b/checks/ucd_processes
index f70996e..63ca9e8 100644
--- a/checks/ucd_processes
+++ b/checks/ucd_processes
@@ -83,6 +83,6 @@ check_info['ucd_processes'] = {
"100", # prErrFlag
"101", # prErrMessage
]),
- 'snmp_scan_function' : ucd_scan_function,
+ 'snmp_scan_function' : prefer_hr_scan_function,
'includes' : [ "ucd.include" ],
}