Module: check_mk
Branch: master
Commit: e2bdcaf4445dc501ca349593a0c6cb7b5d32ded1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e2bdcaf4445dc5…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Aug 29 11:35:12 2016 +0200
3795 cisco_cpu_multiitem: monitors the cpu utilization of each cpu
---
.werks/3795 | 9 +++++
ChangeLog | 1 +
checkman/cisco_cpu_multiitem | 14 +++++++
checks/cisco_cpu_multiitem | 91 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 115 insertions(+)
diff --git a/.werks/3795 b/.werks/3795
new file mode 100644
index 0000000..a8b683b
--- /dev/null
+++ b/.werks/3795
@@ -0,0 +1,9 @@
+Title: cisco_cpu_multiitem: monitors the cpu utilization of each cpu
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i1
+Date: 1472463239
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 69eae53..bb371e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -144,6 +144,7 @@
* 3863 didactum_sensors_analog, didactum_sensors_analog.voltage,
didactum_sensors_discrete: new checks which monitor the temperature, voltage and discrete
sensors of Didactum devices which support the DIDACTUM-SYSTEM-MIB
* 3793 f5_bigip_vserver: traffic and packet levels are now configurable
* 3794 f5_bigip_snat: now able to configure levels
+ * 3795 cisco_cpu_multiitem: monitors the cpu utilization of each cpu
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/checkman/cisco_cpu_multiitem b/checkman/cisco_cpu_multiitem
new file mode 100644
index 0000000..893a5f3
--- /dev/null
+++ b/checkman/cisco_cpu_multiitem
@@ -0,0 +1,14 @@
+title: CPU utilization of the last 5 minutes
+agents: snmp
+catalog: hw/network/cisco
+license: GPL
+distribution: check_mk
+description:
+ Check CPU utilization of the last 5 minutes in percent on Cisco devices.
+
+perfdata:
+ One value: The CPU utilization of the last 5 minutes in percent.
+
+inventory:
+ One service per CPU
+
diff --git a/checks/cisco_cpu_multiitem b/checks/cisco_cpu_multiitem
new file mode 100644
index 0000000..bb01674
--- /dev/null
+++ b/checks/cisco_cpu_multiitem
@@ -0,0 +1,91 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# tails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+factory_settings['cisco_cpu_multiitem_default_levels'] = {
+ 'levels' : ( 80.0, 90.0 ),
+}
+
+def parse_cisco_cpu_multiitem(info):
+ ph_idx_to_desc = {}
+ cpus = {}
+ for idx, desc in info[1]:
+ if desc.lower().startswith("cpu "):
+ desc = desc[4:]
+ ph_idx_to_desc[idx] = desc
+
+ for idx, util in info[0]:
+ if idx in ph_idx_to_desc:
+ name = ph_idx_to_desc[idx]
+ else:
+ name = idx
+ cpus[name] = {
+ 'util': float(util),
+ }
+ return cpus
+
+def inventory_cisco_cpu_multiitem(parsed):
+ for name in parsed:
+ yield name, {}
+
+def check_cisco_cpu_multiitem(item, params, parsed):
+ warn, crit = params['levels']
+ if item in parsed:
+ util = parsed[item]['util']
+
+ state = 0
+ if util >= crit:
+ state = 2
+ elif util >= warn:
+ state = 1
+
+ infotext = "%s%% utilization in the last 5 minutes" % util
+ if state > 0:
+ infotext += " (warn/crit at %s%%/%s%%)" % (warn, crit)
+
+ yield state, infotext, [("util", util, warn, crit, 0, 100)]
+
+ else:
+ yield 3, "No information about the CPU utilization available"
+
+check_info["cisco_cpu_multiitem"] = {
+ 'parse_function' : parse_cisco_cpu_multiitem,
+ 'check_function' : check_cisco_cpu_multiitem,
+ 'inventory_function' : inventory_cisco_cpu_multiitem,
+ "group" : "cpu_utilization_multiitem",
+ "default_levels_variable" :
"cisco_cpu_multiitem_default_levels",
+ 'service_description' : 'CPU utilization %s',
+ 'has_perfdata' : True,
+ 'snmp_info' : [('.1.3.6.1.4.1.9.9.109.1.1.1', [
+ '1.2', # cpmCPUTotalPhysicalIndex
+ '1.8', # cpmCPUTotal5minRev
+ ]),
+ ('.1.3.6.1.2.1.47.1.1.1', [
+ OID_END, #OID index
+ '1.7', # entPhysicalName
+ ])],
+ 'snmp_scan_function' : lambda oid: 'cisco' in
oid('.1.3.6.1.2.1.1.1.0').lower() and \
+ oid('.1.3.6.1.4.1.9.9.109.1.1.1.*') !=
None,
+}