Cleanup config.nodes_of
[check_mk.git] / checks / check_form_submit
blob3e5a37eb1d9c9a51a2af99afa294544b95141263
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
28 def check_form_submit_arguments(params):
29 _description, settings = params
30 args = ''
32 if "virthost" in settings:
33 args += ' -H %s' % quote_shell_string(settings["virthost"])
35 if "port" in settings:
36 args += ' -p %d' % settings["port"]
38 if "uri" in settings:
39 args += ' -u %s' % quote_shell_string(settings["uri"])
41 if settings.get("ssl"):
42 args += ' -s'
44 if "timeout" in settings:
45 args += ' -t %d' % settings["timeout"]
47 if "expect_regex" in settings:
48 args += ' -e %s' % quote_shell_string(settings["expect_regex"])
50 if "form_name" in settings:
51 args += ' -f %s' % quote_shell_string(settings["form_name"])
53 if "query" in settings:
54 args += ' -q %s' % quote_shell_string(settings["query"])
56 if "num_succeeded" in settings:
57 args += ' -n %s' % ','.join(map(str, settings["num_succeeded"]))
59 if not settings.get('hosts'):
60 args += " -I $HOSTADDRESS$"
61 else:
62 for address in settings['hosts']:
63 args += " -I %s" % quote_shell_string(address)
65 return args
68 active_check_info['form_submit'] = {
69 "command_line": '$USER1$/check_form_submit $ARG1$',
70 "argument_function": check_form_submit_arguments,
71 "service_description": lambda params: "FORM %s" % params[0],