Module: check_mk
Branch: master
Commit: 6942fc6300b4782fa9a87ff1b4bcdbbe7809d2f7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6942fc6300b478…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Feb 25 16:09:08 2013 +0100
check_disk_smb: WATO formalization for active check check_disk_smb
---
ChangeLog | 1 +
checks/check_disk_smb | 54 ++++++++++++++++++++++++++++++
web/plugins/wato/active_checks.py | 65 ++++++++++++++++++++++++++++++++++++-
3 files changed, 119 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5afa85d..d4ee3ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@
* sap.dialog: Monitors SAP dialog statistics like the response time
* sap.value: Simply processes information provided by SAP to Nagios
* openvpn_clients: new check for OpenVPN connections
+ * check_disk_smb: WATO formalization for active check check_disk_smb
BI:
* Integrated availability computing, including nifty time warp feature
diff --git a/checks/check_disk_smb b/checks/check_disk_smb
new file mode 100644
index 0000000..efb5a7c
--- /dev/null
+++ b/checks/check_disk_smb
@@ -0,0 +1,54 @@
+#!/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 check_disk_smb_arguments(params):
+ args = ' -a $HOSTADDRESS$ -s %s' %
quote_shell_string(params["share"])
+ args += ' -w%d%% -c%d%%' % params["levels"]
+
+ if "workgroup" in params:
+ args += ' -W %s' % quote_shell_string(params["workgroup"])
+
+ if "port" in params:
+ args += ' -p %d' % params["port"]
+
+ if "auth" in params:
+ args += ' -u %s -p %s' % tuple(map(quote_shell_string,
params["auth"]))
+
+ if "host" in params:
+ args += ' -H %s' % quote_shell_string(params["host"])
+ else:
+ args += ' -H $HOSTADDRESS$'
+
+ return args
+
+
+active_check_info['disk_smb'] = {
+ "command_line" : '$USER1$/check_disk_smb $ARG1$',
+ "argument_function" : check_disk_smb_arguments,
+ "service_description" : lambda params: "SMB Share " +
params["share"],
+ "has_perfdata" : True,
+}
+
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index ff5778e..e18d2de 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -86,7 +86,6 @@ register_rule(group,
),
match = 'all')
-
register_rule(group,
"active_checks:tcp",
Tuple(
@@ -730,6 +729,70 @@ register_rule(group,
match = 'all'
)
+register_rule(group,
+ "active_checks:disk_smb",
+ Dictionary(
+ title = _("Check access to SMB share"),
+ help = _("This ruleset helps you to configure the classical Nagios "
+ "plugin <tt>check_disk_smb</tt> that checks the access
to "
+ "filesystem shares that are exported via SMB/CIFS."),
+ elements = [
+ ( "share",
+ TextUnicode(
+ title = _("SMB share to check"),
+ size = 32,
+ allow_empty = False,
+ )),
+ ( "workgroup",
+ TextUnicode(
+ title = _("Workgroup"),
+ help = _("Workgroup or domain used (defaults to
<tt>WORKGROUP</tt>)"),
+ size = 32,
+ allow_empty = False,
+ )),
+ ( "host",
+ TextAscii(
+ title = _("NetBIOS name of the server"),
+ help = _("If omitted then the IP address is being used."),
+ size = 32,
+ allow_empty = False,
+ )),
+ ( "port",
+ Integer(
+ title = _("TCP Port"),
+ help = _("TCP port number to connect to. Usually either 139 or
445."),
+ default_value = 445,
+ minvalue = 1,
+ maxvalue = 65535,
+ )),
+ ( "levels",
+ Tuple(
+ title = _("Levels for used disk space"),
+ elements = [
+ Percentage(title = _("Warning at"), default_value = 85,
unit=_("% used space")),
+ Percentage(title = _("Critical at"), default_value = 95,
unit=_("% used space")),
+ ]
+ )),
+ ( "auth",
+ Tuple(
+ title = _("Authorization"),
+ elements = [
+ TextAscii(
+ title = _("Username"),
+ allow_empty = False,
+ size = 24),
+ Password(
+ title = _("Password"),
+ allow_empty = False,
+ size = 12),
+ ],
+ )),
+ ],
+ required_keys = [ "share", "levels" ],
+ ),
+ match = 'all')
+
+
register_rule(group,
"custom_checks",
Dictionary(