Module: check_mk
Branch: master
Commit: d789c21f867acb6183553ca5b8a674afa18373b3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d789c21f867acb…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Jul 11 14:45:22 2012 +0200
Added blade_bx_load check
---
checks/blade_bx_blades | 6 ++--
checks/blade_bx_load | 56 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/checks/blade_bx_blades b/checks/blade_bx_blades
index d6a3a91..b8ed7c4 100644
--- a/checks/blade_bx_blades
+++ b/checks/blade_bx_blades
@@ -7,7 +7,7 @@
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
-# | Copyright Mathias Kettner 2010 mk(a)mathias-kettner.de |
+# | Copyright Mathias Kettner 2012 mk(a)mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
@@ -24,7 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-def check_bx_blades(item, no_params, info):
+def check_blade_bx_blades(item, no_params, info):
blade_status_codes = { 1 : "Unknown", 2 : "OK", 3 :
"not-present", 4 : "Error", 5 : "Critical", 6 :
"Standby" }
for blade_id, blade_status, blade_serial, blade_name in info:
state = 0
@@ -38,7 +38,7 @@ def check_bx_blades(item, no_params, info):
return (3, "UNKNOWN - no data for '%s' in SNMP info" % item)
check_info['blade_bx_blades'] = {
- "check_function" : check_bx_blades,
+ "check_function" : check_blade_bx_blades,
"inventory_function" : lambda info: [ (line[0], None) for line in info if
int(line[1]) != 3] ,
"service_description" : "Blade %s",
"has_perfdata" : False,
diff --git a/checks/blade_bx_load b/checks/blade_bx_load
new file mode 100644
index 0000000..fef32b5
--- /dev/null
+++ b/checks/blade_bx_load
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 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.
+
+blade_bx_cpuload_default_levels = ( 5, 20 )
+
+def check_blade_bx_load(item, params, info):
+ try:
+ load = []
+ for i in [ 0, 1, 2 ]:
+ load.append(float(info[i][2]))
+ except:
+ return (3, "Unknown - invalid or incomplete output from plugin %s - %s - %s
" % (float(info[0][2]), float(info[1][2]), float(info[2][2]) ) )
+
+ warn, crit = params
+
+ perfdata = [ ('load' + str(z), l, warn, crit, 0 ) for (z,l) in [ (1,load[0]),
(5,load[1]), (15, load[2]) ] ]
+
+ if load[2] >= crit:
+ return (2, "CRIT - 15min Load %.2f (critical at %.2f)" % (load[2],
crit), perfdata)
+ elif load[2] >= warn:
+ return (1, "WARN - 15min Load %.2f (warning at %.2f)" % (load[2],
warn), perfdata)
+ else:
+ return (0, "OK - 15min Load %.2f " % (load[2]), perfdata)
+
+check_info['blade_bx_load'] = {
+ "check_function" : check_blade_bx_load,
+ "inventory_function" : lambda info: [ (None,
"blade_bx_cpuload_default_levels")] ,
+ "service_description" : "Load",
+ "has_perfdata" : True,
+ "snmp_info" : (".1.3.6.1.4.1.2021.10.1", [ 1, 2, 6 ]),
+ "snmp_scan_function" : lambda oid: "BX600" in
oid(".1.3.6.1.2.1.1.1.0"),
+ "group" : "cpu_utilization",
+}