Module: check_mk
Branch: master
Commit: 97fa1db3d0370483b0ede9b6b06c04aaacceb970
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=97fa1db3d03704…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Dec 18 10:12:28 2018 +0100
6992 FIX check_bi_aggr: Fixed usage of the password store
Change-Id: I2f8d54d04feb6df57e193dc3c051c30ab70a513c
---
.werks/6992 | 13 +++++++++++++
checks/check_bi_aggr | 23 +++++++++++++++--------
cmk/gui/plugins/views/icons/builtin.py | 6 ++++--
3 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/.werks/6992 b/.werks/6992
new file mode 100644
index 0000000..2c57300
--- /dev/null
+++ b/.werks/6992
@@ -0,0 +1,13 @@
+Title: check_bi_aggr: Fixed usage of the password store
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1545054871
+
+If a password from the password store was used in the active check plugin
+{{check_bi_aggr}} the following syntax error was shown in the output of the
+check plugin: {{sh: 1: Syntax error: "(" unexpected}} and the state was CRIT.
diff --git a/checks/check_bi_aggr b/checks/check_bi_aggr
index 759335b..b0a4492 100644
--- a/checks/check_bi_aggr
+++ b/checks/check_bi_aggr
@@ -27,24 +27,31 @@
def check_bi_aggr_arguments(params):
base_url, aggr_name, username, secret, opt_params = params
- args = ' -b %s -a %s -u %s %s' % (quote_shell_string(base_url),
quote_shell_string(aggr_name),
- quote_shell_string(username),
- passwordstore_get_cmdline(" -s %s",
secret))
+ args = [
+ '-b',
+ base_url,
+ '-a',
+ aggr_name,
+ '-u',
+ username,
+ '-s',
+ passwordstore_get_cmdline("%s", secret),
+ ]
if "auth_mode" in opt_params:
- args += ' -m %s' % quote_shell_string(opt_params['auth_mode'])
+ args += ['-m', opt_params['auth_mode']]
if "timeout" in opt_params:
- args += ' -t %d' % opt_params['timeout']
+ args += ['-t', opt_params['timeout']]
if opt_params.get("in_downtime"):
- args += ' --in-downtime %s' % opt_params['in_downtime']
+ args += ['--in-downtime', opt_params['in_downtime']]
if opt_params.get("acknowledged"):
- args += ' --acknowledged %s' % opt_params['acknowledged']
+ args += ['--acknowledged', opt_params['acknowledged']]
if opt_params.get("track_downtimes"):
- args += ' -r -n $HOSTNAME$'
+ args += ['-r', '-n', 'HOSTNAME$']
return args
diff --git a/cmk/gui/plugins/views/icons/builtin.py
b/cmk/gui/plugins/views/icons/builtin.py
index 1b3e58d..6f52f18 100644
--- a/cmk/gui/plugins/views/icons/builtin.py
+++ b/cmk/gui/plugins/views/icons/builtin.py
@@ -858,16 +858,18 @@ multisite_icons_and_actions['stars'] = {
def paint_icon_check_bi_aggr(what, row, tags, host_custom_vars):
+ # service_check_command looks like:
+ # u"check_mk_active-bi_aggr!... '-b'
'http://localhost/$HOSTNAME$' ... '-a' 'Host foobar' ..."
if what == "service" and row.get("service_check_command",
"").startswith("check_mk_active-bi_aggr!"):
args = row['service_check_command']
- start = args.find('-b \'') + 4
+ start = args.find('-b\' \'') + 5
end = args.find('\' ', start)
base_url = args[start:end].rstrip('/')
base_url = base_url.replace('$HOSTADDRESS$',
row['host_address'])
base_url = base_url.replace('$HOSTNAME$', row['host_name'])
- start = args.find('-a \'') + 4
+ start = args.find('-a\' \'') + 5
end = args.find('\' ', start)
aggr_name = args[start:end]