Module: check_mk
Branch: master
Commit: 3f8fc8fdd836433b1602dd4e31ff88f968381226
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3f8fc8fdd83643…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Dec 10 16:43:17 2014 +0100
Added check_ssh in WATO
---
checkman/check_ssh | 16 +++++++++++++
checks/check_ssh | 48 +++++++++++++++++++++++++++++++++++++
web/plugins/wato/active_checks.py | 30 +++++++++++++++++++++++
3 files changed, 94 insertions(+)
diff --git a/checkman/check_ssh b/checkman/check_ssh
new file mode 100644
index 0000000..7b0460b
--- /dev/null
+++ b/checkman/check_ssh
@@ -0,0 +1,16 @@
+title: SSH Service (Ping)
+agents: active
+catalog: agentless
+license: GPL
+distribution: check_mk
+description:
+ This performs an active check to connect to a ssh service.
+
+ It optional can check the protocol version or the program version.
+
+ Returns {CRIT} if the connection isn't possible.
+
+ This check can be configured by Wato.
+
+perfdata:
+ One value: The connection time.
diff --git a/checks/check_ssh b/checks/check_ssh
new file mode 100644
index 0000000..d96b9b3
--- /dev/null
+++ b/checks/check_ssh
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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_ssh_arguments(params):
+ args = []
+ if 'timeout' in params:
+ args.append("-t " + str(params['timeout']))
+ if 'port' in params:
+ args.append("-p " + str(params['port']))
+ if 'remote_version' in params:
+ args.append("-r " + quote_shell_string(params['remote_version']))
+ if 'remote_protocol' in params:
+ args.append("-P " + quote_shell_string(params['remote_protocol']))
+
+ args.append("$HOSTADDRESS$")
+
+ return " ".join(args)
+
+active_check_info['ssh'] = {
+ "command_line" : '$USER1$/check_ssh $ARG1$',
+ "argument_function" : check_ssh_arguments,
+ "service_description" : lambda args: "SSH",
+ "has_perfdata" : True,
+}
+
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 31083e7..a513b92 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -70,6 +70,36 @@ check_icmp_params = [
)),
]
+register_rule(group,
+ "active_checks:ssh",
+ Dictionary(
+ title = _("Check SSH service"),
+ help = _("This rulset allow you to configure a SSH check for a host"),
+ elements = [
+ ("port",
+ Integer(
+ title = _("Port number to be used"),
+ default_value = 22),
+ ),
+ ("timeout",
+ Integer(
+ title = _("Connection timeout"),
+ help = _("Seconds before connection times out"),
+ default_value = 10),
+ ),
+ ("remote_version",
+ TextAscii(
+ title = _("Remote Version"),
+ help = _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)"),
+ )),
+ ("remote_protocol",
+ TextAscii(
+ title = _("Remote Protocol"),
+ help = _("Warn if protocol doesn't match expected protocol version (ex: 2.0)"),
+ )),
+ ]
+ ),
+ match="all")
register_rule(group,
"active_checks:icmp",