Module: check_mk
Branch: master
Commit: a60cf93ae2ee5aca31e00efe6496ac371add1efb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a60cf93ae2ee5a…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Wed Nov 6 19:03:45 2013 +0100
brocade_mlx: got perfdata working for temperature, PNP-Template for CPU graph
---
checks/brocade_mlx | 16 ++++---
pnp-templates/check_mk-brocade_mlx.module_cpu.php | 46 +++++++++++++++++++++
2 files changed, 56 insertions(+), 6 deletions(-)
diff --git a/checks/brocade_mlx b/checks/brocade_mlx
index 600630d..54af612 100644
--- a/checks/brocade_mlx
+++ b/checks/brocade_mlx
@@ -180,10 +180,12 @@ def check_brocade_mlx_module_mem(item, params, info):
check_info["brocade_mlx.module_mem"] = {
"check_function" : check_brocade_mlx_module_mem,
"inventory_function" : inventory_brocade_mlx_module_mem,
- "service_description" : "Line module %s Memory",
+ "service_description" : "Memory Module %s",
"snmp_info" : brocade_mlx_info,
"snmp_scan_function" : brocade_mlx_scan,
"has_perfdata" : True,
+ # needs something like memory_of_modules
+ #"group" : "memory",
}
#############################################################################
@@ -194,7 +196,6 @@ brocade_mlx_cpu_default_levels = (80.0, 90.0)
def inventory_brocade_mlx_module_cpu(info):
inventory = []
- #import pprint; pprint.pprint(info[3])
for module_id, module_descr, module_state, mem_total, mem_avail in info[2]:
# do not inventorize modules reported as empty
# and: monitor cpu only on NI-MLX modules
@@ -238,7 +239,7 @@ def check_brocade_mlx_module_cpu(item, params, info):
status = 2
errorstring = "(!!)"
- return status, "CPU Utilization was %s/%s/%s%s/%s%% for the last
1/5/60/300 sec" % \
+ return status, "CPU utilization was %s/%s/%s%s/%s%% for the last
1/5/60/300 sec" % \
(cpu_util1, cpu_util5, cpu_util60, errorstring, cpu_util300), perfdata
return 3, "Module %s not found" % item
@@ -246,10 +247,12 @@ def check_brocade_mlx_module_cpu(item, params, info):
check_info["brocade_mlx.module_cpu"] = {
"check_function" : check_brocade_mlx_module_cpu,
"inventory_function" : inventory_brocade_mlx_module_cpu,
- "service_description" : "Line module %s CPU",
+ "service_description" : "CPU utilization Module %s",
"snmp_info" : brocade_mlx_info,
"snmp_scan_function" : brocade_mlx_scan,
"has_perfdata" : True,
+ # needs something like cpu_utilization_of_modules
+ #"group" : "cpu_utilization",
}
#############################################################################
@@ -276,7 +279,7 @@ def check_brocade_mlx_temp(item, params, info):
if temp_value > crit:
status = 2
- perfdata = [ ('temperature', str(temp_value) + '°C', warn,
crit, 0, '') ]
+ perfdata = [ ('temperature', str(temp_value) + 'C', warn,
crit, '', '') ]
return status, "Temperature is %s°C" % temp_value, perfdata
@@ -288,6 +291,7 @@ check_info["brocade_mlx.temperature"] = {
"service_description" : "%s",
"snmp_info" : brocade_mlx_info,
"snmp_scan_function" : brocade_mlx_scan,
- "has_perfdata" : False,
+ "has_perfdata" : True,
+ "group" : "hw_temperature",
}
diff --git a/pnp-templates/check_mk-brocade_mlx.module_cpu.php
b/pnp-templates/check_mk-brocade_mlx.module_cpu.php
new file mode 100644
index 0000000..fd953f3
--- /dev/null
+++ b/pnp-templates/check_mk-brocade_mlx.module_cpu.php
@@ -0,0 +1,46 @@
+<?php
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+$opt[1] = "--vertical-label 'CPU utilization %' -l0 -u 100 --title
\"CPU Utilization for $hostname\" ";
+#
+$def[1] = "DEF:util1=$RRDFILE[1]:$DS[1]:AVERAGE " ;
+$def[1] .= "DEF:util5=$RRDFILE[2]:$DS[1]:AVERAGE " ;
+$def[1] .= "DEF:util60=$RRDFILE[3]:$DS[1]:AVERAGE " ;
+$def[1] .= "DEF:util300=$RRDFILE[4]:$DS[1]:AVERAGE " ;
+
+$def[1] .= "AREA:util60#60f020:\"Utilization 60s\" " ;
+$def[1] .= "GPRINT:util60:MIN:\"Min\: %2.1lf%%\" " ;
+$def[1] .= "GPRINT:util60:MAX:\"Max\: %2.1lf%%\" " ;
+$def[1] .= "GPRINT:util60:LAST:\"Last\: %2.1lf%%\\n\" " ;
+
+$def[1] .= "LINE:util1#000000:\"1s \" " ;
+$def[1] .= "GPRINT:util1:LAST:\"Last\: %2.1lf%%\" " ;
+
+$def[1] .= "LINE:util5#0000ff:\"5s \" " ;
+$def[1] .= "GPRINT:util5:LAST:\"Last\: %2.1lf%%\" " ;
+
+$def[1] .= "LINE:util300#ff00ff:\"300s \" " ;
+$def[1] .= "GPRINT:util300:LAST:\"Last\: %2.1lf%%\\n\" " ;
+?>