Module: check_mk
Branch: master
Commit: a49a04c2a55301b47e5c2f5c29b2feee5b67de5f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a49a04c2a55301…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Mar 20 17:29:10 2014 +0100
enterasys_cpu_util enterasys_powersupply: New Checks for CPU Utilization and Power
Supplies on enterasys switches
---
.werks/144 | 8 +++
ChangeLog | 1 +
checkman/enterasys_cpu_util | 20 ++++++++
checkman/enterasys_powersupply | 16 ++++++
checks/enterasys_cpu_util | 51 +++++++++++++++++++
checks/enterasys_powersupply | 67 +++++++++++++++++++++++++
pnp-templates/check_mk-enterasys_cpu_util.php | 1 +
7 files changed, 164 insertions(+)
diff --git a/.werks/144 b/.werks/144
new file mode 100644
index 0000000..29ff606
--- /dev/null
+++ b/.werks/144
@@ -0,0 +1,8 @@
+Title: enterasys_cpu_util enterasys_powersupply: New Checks for CPU Utilization and Power
Supplies on enterasys switches
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1395332854
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index cf117b4..940f932 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -111,6 +111,7 @@
* 0141 ups_socomec_capacity: Battery Capacity Check for Socomec UPS Devices.
* 0705 arcserve_backup: improved documentation (check manpage and comments in the
agent plugin)
* 0143 ups_socomec_in_voltage, ups_socomec_out_voltage: Socomec UPS Devices, Input
and Output Voltages...
+ * 0144 enterasys_cpu_util enterasys_powersupply: New Checks for CPU Utilization and
Power Supplies on enterasys switches
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/enterasys_cpu_util b/checkman/enterasys_cpu_util
new file mode 100644
index 0000000..184d140
--- /dev/null
+++ b/checkman/enterasys_cpu_util
@@ -0,0 +1,20 @@
+title: Enterasys Switch: CPU utilization
+agents: snmp
+catalog: hw/network/enterasys
+license: GPL
+distribution: check_mk
+description:
+ This check shows the current cpu utilization of a casa module
+
+
+inventory:
+ One check will be created
+
+perfdata:
+ The actual utilization, together with it's warn and crit levels
+
+[parameters]
+warning (int): The percentage of CPU usage that triggers
+ a WARNING state
+critical (int): The percentage of CPU usage that triggers
+ a CRITICAL state
diff --git a/checkman/enterasys_powersupply b/checkman/enterasys_powersupply
new file mode 100644
index 0000000..9fece26
--- /dev/null
+++ b/checkman/enterasys_powersupply
@@ -0,0 +1,16 @@
+title: Enterasys: Power Supplies
+agents: snmp
+catalog: hw/network/enterasys
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the health of power supplies. If the operating
+ state change or the supplie is not longer redundant then the check
+ returns {CRIT}.
+
+item:
+ The id of the power supply as output from the SNMP agent.
+
+inventory:
+ One check is created for each power supply.
+
diff --git a/checks/enterasys_cpu_util b/checks/enterasys_cpu_util
new file mode 100644
index 0000000..2f99fce
--- /dev/null
+++ b/checks/enterasys_cpu_util
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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-
+# ails. 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.
+enerasys_cpu_default_levels = (90, 95)
+
+def inventory_enterasys_cpu_util(info):
+ return [ ( None, "enerasys_cpu_default_levels" )]
+
+def check_enterasys_cpu_util(_no_item, params, info):
+ util = 0
+ for core_util in info:
+ util += saveint(core_util[0]) / 60
+ num_cpus = len(info)
+ usage = util / num_cpus
+ return check_cpu_util(usage, params)
+
+
+check_info["enterasys_cpu_util"] = {
+ "check_function" : check_enterasys_cpu_util,
+ "inventory_function" : inventory_enterasys_cpu_util,
+ "service_description" : "CPU utilization",
+ "snmp_info" : ( ".1.3.6.1.4.1.5624.1.2.49.1.1.1.1", [
3 ]), #util in last 1min
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.5624.2.1.169",
+ "has_perfdata" : True,
+ "group" : "cpu_utilization",
+ "includes" : [ "cpu_util.include" ],
+
+}
+
diff --git a/checks/enterasys_powersupply b/checks/enterasys_powersupply
new file mode 100644
index 0000000..81267fe
--- /dev/null
+++ b/checks/enterasys_powersupply
@@ -0,0 +1,67 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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-
+# ails. 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.
+# 1.3.6.1.4.1.52.4.3.1.2.1.1.1 ctChasPowerSupplyNum
+# 1.3.6.1.4.1.52.4.3.1.2.1.1.2 ctChasPowerSupplyState
+# 1.3.6.1.4.1.52.4.3.1.2.1.1.3 ctChasPowerSupplyType
+# 1.3.6.1.4.1.52.4.3.1.2.1.1.4 ctChasPowerSupplyRedundancy
+
+def inventory_enterasys_powersupply(info):
+ inventory = []
+ for num, state, typ, redun in info:
+ if state == '3':
+ inventory.append(( num, None ))
+ return inventory
+
+def check_enterasys_powersupply(item, _no_params, info):
+ supply_types = {
+ '1' : 'ac-dc',
+ '2' : 'dc-dc',
+ '3' : 'notSupported',
+ '4' : 'highOutput',
+ }
+ redundancy_types = {
+ '1' : 'redundant',
+ '2' : 'notRedundant',
+ '3' : 'notSupported',
+ }
+
+ for num, state, typ, redun in info:
+ if num == item:
+ if state == '4':
+ return 2, 'PSU installed and not operating'
+ if redun != '1':
+ return 1, 'PSU %s' % redundancy_types[redyn]
+ return 0, 'PSU working and redundant (%s)' % supply_types[typ]
+
+
+check_info["enterasys_powersupply"] = {
+ "check_function" : check_enterasys_powersupply,
+ "inventory_function" : inventory_enterasys_powersupply,
+ "service_description" : "PSU %s",
+ "snmp_info" : ( ".1.3.6.1.4.1.52.4.3.1.2.1.1", [
OID_END, 2, 3, 4 ]),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.5624.2.1.169",
+}
+
diff --git a/pnp-templates/check_mk-enterasys_cpu_util.php
b/pnp-templates/check_mk-enterasys_cpu_util.php
new file mode 120000
index 0000000..a7d9073
--- /dev/null
+++ b/pnp-templates/check_mk-enterasys_cpu_util.php
@@ -0,0 +1 @@
+check_mk-esx_vsphere_hostsystem.cpu_usage.php
\ No newline at end of file