2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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_mail_arguments(params
):
31 fetch_proto
, fetch_params
= params
['fetch']
32 args
+= ['--protocol=%s' % fetch_proto
]
34 if 'server' in fetch_params
:
35 args
+= ['--server=%s' % fetch_params
['server']]
37 args
+= ['--server=$HOSTADDRESS$']
39 fetch_use_ssl
, fetch_port
= fetch_params
['ssl']
42 if fetch_port
is not None:
43 args
+= ['--port=%d' % fetch_port
]
45 args
+= ['--username=%s' % fetch_params
['auth'][0]]
46 args
+= [passwordstore_get_cmdline("--password=%s", fetch_params
['auth'][1])]
48 if 'connect_timeout' in params
:
49 args
+= ['--connect-timeout=%d' % params
['connect_timeout']]
51 if 'forward' in params
:
52 forward
= params
['forward']
53 args
+= ['--forward-ec']
54 if 'method' in forward
:
55 args
+= ['--forward-method=%s' % forward
['method']]
57 if 'match_subject' in forward
:
58 args
+= ['--match-subject=%s' % forward
['match_subject']]
60 if 'facility' in forward
:
61 args
+= ['--forward-facility=%d' % forward
['facility']]
64 args
+= ['--forward-host=%s' % forward
['host']]
66 if forward
.get('application'):
67 args
+= ['--forward-app=%s' % forward
['application']]
69 if 'body_limit' in forward
:
70 args
+= ['--body-limit=%d' % forward
['body_limit']]
72 if 'cleanup' in forward
:
73 if forward
['cleanup'] is True:
74 args
+= ['--cleanup=delete']
76 args
+= ['--cleanup=%s' % forward
['cleanup']]
81 active_check_info
['mail'] = {
82 "command_line": '$USER1$/check_mail $ARG1$',
83 "argument_function": check_mail_arguments
,
84 "service_description": lambda params
: params
['service_description'],