Module: check_mk
Branch: master
Commit: afc64683852ce94b0e9113fe92d8262d0caf63f8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=afc64683852ce9…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Jan 13 14:04:09 2014 +0100
hitachi_hnas_cifs: new check for the number of users using a CIFS share
---
.werks/324 | 8 +++++
ChangeLog | 1 +
checkman/hitachi_hnas_cifs | 18 ++++++++++
checks/hitachi_hnas_cifs | 49 ++++++++++++++++++++++++++
pnp-templates/check_mk-hitachi_hnas_cifs.php | 34 ++++++++++++++++++
web/plugins/perfometer/check_mk.py | 9 +++++
6 files changed, 119 insertions(+)
diff --git a/.werks/324 b/.werks/324
new file mode 100644
index 0000000..8605f75
--- /dev/null
+++ b/.werks/324
@@ -0,0 +1,8 @@
+Title: hitachi_hnas_cifs: new check for the number of users using a CIFS share
+Level: 2
+Component: checks
+Version: 1.2.5i1
+Date: 1389618206
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index be23603..ac175ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@
NOTE: Please refer to the migration notes!
* 0078 job: check now monitors the time since last start of the job, limits can be
configured in WATO
* 0079 f5_bigip_conns: new check to monitor number of current connections
+ * 0324 hitachi_hnas_cifs: new check for the number of users using a CIFS share
* 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/hitachi_hnas_cifs b/checkman/hitachi_hnas_cifs
new file mode 100644
index 0000000..467f866
--- /dev/null
+++ b/checkman/hitachi_hnas_cifs
@@ -0,0 +1,18 @@
+title: Hitachi HNAS: Number of Users using CIFS shares
+agents: snmp
+catalog: hw/storagehw/hitachi
+license: GPL
+distribution: check_mk
+description:
+ Reports the number of users currently using a CIFS share on an Hitachi HNAS
+ storage system. The check always returns {OK}.
+
+item:
+ The ID of the EVS plus the name of the CIFS share, separated by a space.
+ E. g. 6 home
+
+perfdata:
+ One value: The number of current users.
+
+inventory:
+ Finds one item per CIFS share.
diff --git a/checks/hitachi_hnas_cifs b/checks/hitachi_hnas_cifs
new file mode 100644
index 0000000..d4cfbed
--- /dev/null
+++ b/checks/hitachi_hnas_cifs
@@ -0,0 +1,49 @@
+#!/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.
+
+def inventory_hitachi_hnas_cifs(info):
+ # import pprint; pprint.pprint(info)
+ inventory = []
+ for evs_id, share_name, users in info:
+ inventory.append( (evs_id + " " + share_name, None) )
+ return inventory
+
+def check_hitachi_hnas_cifs(item, _no_params, info):
+ for evs_id, share_name, users in info:
+ if evs_id + " " + share_name == item:
+ perfdata = [ ('users', users, '', '', 0) ]
+ return 0, "%s users" % users, perfdata
+ return 3, "Share not found"
+
+check_info["hitachi_hnas_cifs"] = {
+ "check_function" : check_hitachi_hnas_cifs,
+ "inventory_function" : inventory_hitachi_hnas_cifs,
+ "service_description" : "CIFS Share EVS %s",
+ "has_perfdata" : True,
+ "snmp_info" : (".1.3.6.1.4.1.11096.6.1.1.3.2.1.3.1",
[1, 2, 5]),
+ # cifsShareEvsId, cifsShareName, cifsShareUsers
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.11096.6"),
+}
diff --git a/pnp-templates/check_mk-hitachi_hnas_cifs.php
b/pnp-templates/check_mk-hitachi_hnas_cifs.php
new file mode 100644
index 0000000..e9078c5
--- /dev/null
+++ b/pnp-templates/check_mk-hitachi_hnas_cifs.php
@@ -0,0 +1,34 @@
+<?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 \"Number of Users\" --title \"$hostname /
$servicedesc\" ";
+
+$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
+$def[1] .= "AREA:var1#2080ff:\"Users Current\:\" ";
+$def[1] .= "GPRINT:var1:LAST:\"%2.0lf\" ";
+$def[1] .= "LINE1:var1#000080:\"\" ";
+$def[1] .= "GPRINT:var1:MAX:\"(Max\: %2.0lf,\" ";
+$def[1] .= "GPRINT:var1:AVERAGE:\"Avg\: %2.0lf)\" ";
+?>
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index a638528..06a5895 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -297,6 +297,15 @@ def perfometer_temperature_multi(row, check_command, perf_data):
perfometers["check_mk-brocade_mlx_temp"] = perfometer_temperature_multi
+def perfometer_users(row, check_command, perf_data):
+ state = row["service_state"]
+ color = "#39f"
+ value = float(perf_data[0][1])
+ crit = savefloat(perf_data[0][4])
+ return u"%d users" % int(value), perfometer_logarithmic(value, 50, 2,
color)
+
+perfometers["check_mk-hitachi_hnas_cifs"] = perfometer_users
+
def perfometer_blower(row, check_command, perf_data):
rpm = saveint(perf_data[0][1])
perc = rpm / 10000.0 * 100.0