Module: check_mk
Branch: master
Commit: 7c76d9e826cd5faedb62d894343e00392f0a592d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7c76d9e826cd5f…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Oct 17 17:11:21 2013 +0200
Check_ftp: can now be configured via Wato
---
ChangeLog | 1 +
checks/check_ftp | 66 +++++++++++++++++++++++++++++++++
web/plugins/wato/active_checks.py | 73 +++++++++++++++++++++++++++++++++++++
3 files changed, 140 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index caa13f6..ae14b54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,7 @@
* New option for full SNMP scan in bulk inventory
* FIX: correct display of number of hosts in bulk inventory
* FIX: nailed down ".siteid" exception when added new site
+ * Check_ftp: can now be configured via Wato
1.2.3i4:
Core:
diff --git a/checks/check_ftp b/checks/check_ftp
new file mode 100644
index 0000000..7200786
--- /dev/null
+++ b/checks/check_ftp
@@ -0,0 +1,66 @@
+#!/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_ftp_arguments(params):
+ host, settings = params
+ args = ' -H %s' % quote_shell_string(host)
+
+ if "response_time" in settings:
+ args += ' -w %f -c %f' % (
+ settings["response_time"][0]/1000.0,
+ settings["response_time"][1]/1000.0)
+
+ if "timeout" in settings:
+ args += ' -t %d' % settings["timeout"]
+
+ if "refuse_state" in settings:
+ args += ' -r %s' % settings["refuse_state"]
+
+ if settings.get("escape_send_string"):
+ args += ' --escape'
+
+ if "send_string" in settings:
+ args += ' -s %s' % quote_shell_string(settings["send_string"])
+
+ if "expect" in settings:
+ for s in settings["expect"]:
+ args += ' -e %s' % quote_shell_string(s)
+
+ if settings.get("ssl"):
+ args += ' --ssl'
+
+ if "cert_days" in settings:
+ args += ' -D %d' % settings["cert_days"]
+
+ return args
+
+active_check_info['ftp'] = {
+ "command_line" : '$USER1$/check_ftp $ARG1$',
+ "argument_function" : check_ftp_arguments,
+ "service_description" : lambda args: "FTP %s" % args[0],
+ "has_perfdata" : True,
+}
+
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 52d46d2..8e1971e 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -92,6 +92,79 @@ register_rule(group,
)
)
+register_rule(group,
+ "active_checks:ftp",
+ Tuple(
+ title = _("Check FTP Services"),
+ elements = [
+ TextAscii ( title = _("Hostname"), allow_empty = False,
+ help = _("The hostname of the FTP server you want to
check"
+ "It is possible to use $HOSTNAME$ or $HOSTADDRESS$
")
+ ),
+ Dictionary(
+ elements = [
+ ( "response_time",
+ Tuple(
+ title = _("Expected response time"),
+ elements = [
+ Float(
+ title = _("Warning if above"),
+ unit = "ms",
+ default_value = 100.0),
+ Float(
+ title = _("Critical if above"),
+ unit = "ms",
+ default_value = 200.0),
+ ])
+ ),
+ ( "timeout",
+ Integer(
+ title = _("Seconds before connection times out"),
+ unit = _("sec"),
+ default_value = 10,
+ )
+ ),
+ ( "refuse_state",
+ DropdownChoice(
+ title = _("State for connection refusal"),
+ choices = [ ('crit', _("CRITICAL")),
+ ('warn', _("WARNING")),
+ ('ok', _("OK")),
+ ])
+ ),
+
+ ( "send_string",
+ TextAscii(
+ title = _("String to send"),
+ size = 30)
+ ),
+ ( "expect",
+ ListOfStrings(
+ title = _("Strings to expect in response"),
+ orientation = "horizontal",
+ valuespec = TextAscii(size = 30),
+ )
+ ),
+
+ ( "ssl",
+ FixedValue(
+ value = True,
+ totext = _("use SSL"),
+ title = _("Use SSL for the connection."))
+
+ ),
+ ( "cert_days",
+ Integer(
+ title = _("SSL certificate validation"),
+ help = _("Minimum number of days a certificate has to be
valid"),
+ unit = _("days"),
+ default_value = 30)
+ ),
+ ]),
+ ]
+ )
+)
+
register_rule(group,
"active_checks:dns",