Module: check_mk
Branch: master
Commit: 60cf6434b93c0cad50955161c94af47afc5b05ae
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=60cf6434b93c0c…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Aug 24 13:08:33 2012 +0200
Added check for netapp fcport throughput
---
checks/netapp_fcpio | 74 ++++++++++++++++++++++++++
pnp-templates/check_mk-netapp_fcpio.php | 88 +++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 32 +++++++++++
3 files changed, 194 insertions(+), 0 deletions(-)
diff --git a/checks/netapp_fcpio b/checks/netapp_fcpio
new file mode 100644
index 0000000..bbb39eb
--- /dev/null
+++ b/checks/netapp_fcpio
@@ -0,0 +1,74 @@
+#!/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.
+
+netapp_fcpio_default_levels = { "read" : (None, None), "write" :
(None, None)}
+
+def check_netapp_fcpio(item, params, info):
+ read, write = map(int, info[0])
+ this_time = int(time.time())
+ timedif, avg_read = get_counter("netapp_fcpio.read", this_time, read)
+ timedif, avg_write = get_counter("netapp_fcpio.write", this_time, write)
+
+ read_warn, read_crit = params['read']
+ write_warn, write_crit = params['write']
+
+ perfdata = [("write", avg_write, write_warn, write_crit ),
+ ("read", avg_read, read_warn, read_crit ),
+ ]
+ state = 0
+ read_msg = ''
+ write_msg = ''
+ if read_warn != None and read_warn >= read:
+ state = 1
+ read_msg = ' (!)'
+ if read_crit != None and read_crit >= read:
+ state = 2
+ read_msg = ' (!!)'
+
+ if write_warn != None and write_warn >= write:
+ state = max(state, 1)
+ write_msg = ' (!)'
+ if write_crit != None and write_crit >= write:
+ state = 2
+ write_msg = ' (!!)'
+
+
+ infotext = " - %s read%s, %s write%s in last %d sec" %
(get_filesize_human_readable(avg_read), \
+ read_msg, get_filesize_human_readable(avg_write), write_msg, timedif)
+
+ return(state, nagios_state_names[state] + infotext, perfdata)
+
+
+check_info["netapp_fcpio"] = {
+ "check_function" : check_netapp_fcpio,
+ "inventory_function" : lambda info: [(None,
"netapp_fcpio_default_levels")],
+ "service_description" : "FCP I/O",
+ "has_perfdata" : True,
+ "group" : "netapp_fcportio",
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.4.1.789.1.17.20.0"),
+ "snmp_info" : ( ".1.3.6.1.4.1.789.1.17", [ 20, 21 ]),
+}
+
diff --git a/pnp-templates/check_mk-netapp_fcpio.php
b/pnp-templates/check_mk-netapp_fcpio.php
new file mode 100644
index 0000000..452f3a8
--- /dev/null
+++ b/pnp-templates/check_mk-netapp_fcpio.php
@@ -0,0 +1,88 @@
+<?php
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+// new version of diskstat
+if (isset($DS[2])) {
+
+ $RRD = array();
+ foreach ($NAME as $i => $n) {
+ $RRD[$n] = "$RRDFILE[$i]:$DS[$i]:MAX";
+ $WARN[$n] = $WARN[$i];
+ $CRIT[$n] = $CRIT[$i];
+ $MIN[$n] = $MIN[$i];
+ $MAX[$n] = $MAX[$i];
+ }
+
+ $parts = explode("_", $servicedesc);
+
+ $opt[1] = "--vertical-label 'Throughput (MB/s)' -X0 --title \"FC
Port throughput on $hostname\" ";
+
+ $def[1] =
+ "HRULE:0#a0a0a0 ".
+ # read
+ "DEF:read=$RRD[read] ".
+ "CDEF:read_mb=read,1048576,/ ".
+ "AREA:read_mb#40c080:\"Read \" ".
+ "GPRINT:read_mb:LAST:\"%8.1lf MB/s last\" ".
+ "GPRINT:read_mb:AVERAGE:\"%6.1lf MB/s avg\" ".
+ "GPRINT:read_mb:MAX:\"%6.1lf MB/s max\\n\" ";
+
+ # read average as line in the same graph
+ if (isset($RRD["read.avg"])) {
+ $def[1] .=
+ "DEF:read_avg=${RRD['read.avg']} ".
+ "CDEF:read_avg_mb=read_avg,1048576,/ ".
+ "LINE:read_avg_mb#202020 ";
+ }
+
+ # write
+ $def[1] .=
+ "DEF:write=$RRD[write] ".
+ "CDEF:write_mb=write,1048576,/ ".
+ "CDEF:write_mb_neg=write_mb,-1,* ".
+ "AREA:write_mb_neg#4080c0:\"Write \" ".
+ "GPRINT:write_mb:LAST:\"%6.1lf MB/s last\" ".
+ "GPRINT:write_mb:AVERAGE:\"%6.1lf MB/s avg\" ".
+ "GPRINT:write_mb:MAX:\"%6.1lf MB/s max\\n\" ".
+ "";
+
+ # show levels for read
+ if ($WARN['read']) {
+ $def[1] .= "HRULE:$WARN[read]#ffd000:\"Warning for read at " .
sprintf("%6.1f", $WARN[1]) . " MB/s \" ";
+ $def[1] .= "HRULE:$CRIT[read]#ff0000:\"Critical for read at " .
sprintf("%6.1f", $CRIT[1]) . " MB/s\\n\" ";
+ }
+
+ # show levels for write
+ if ($WARN['write']) {
+ $def[1] .= "HRULE:-$WARN[write]#ffd000:\"Warning for write at " .
sprintf("%6.1f", $WARN[2]) . " MB/s \" ";
+ $def[1] .= "HRULE:-$CRIT[write]#ff0000:\"Critical for write at " .
sprintf("%6.1f", $CRIT[2]) . " MB/s\\n\" ";
+ }
+
+
+
+}
+
+?>
+
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 4c48053..812fca0 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -533,6 +533,38 @@ checkgroups.append((
))
checkgroups.append((
+ subgroup_storage,
+ "netapp_fcprtio",
+ _("Netapp FC Port throughput"),
+ Dictionary(
+ elements = [
+ ("read",
+ Tuple(
+ title = _("Read"),
+ elements = [
+ Filesize(title = _("Warning lower as")),
+ Filesize(title = _("Critical lower as")),
+ ]
+ )
+ ),
+ ("write",
+ Tuple(
+ title = _("Write"),
+ elements = [
+ Filesize(title = _("Warning higher as")),
+ Filesize(title = _("Critical higher as")),
+ ]
+ )
+ )
+
+ ]
+ ),
+ TextAscii(
+ title = _("File name"),
+ allow_empty = True),
+ "first"
+))
+checkgroups.append((
subgroup_os,
"memory_pagefile_win",
_("Memory and pagefile levels for Windows"),