lists.checkmk.com
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
List overview
Download
Checkmk git commits
March 2019
----- 2024 -----
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
checkmk-commits@lists.checkmk.com
17 participants
451 discussions
Start a n
N
ew thread
Replace individual rule matching with generic code
by Lars Michelsen
Module: check_mk Branch: master Commit: f7186656eff6f56ed36eb68c8c654c2fba600ca9 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f7186656eff6f5…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Tue Mar 26 17:16:44 2019 +0100 Replace individual rule matching with generic code Change-Id: I4f1bdc87096498192806b47215ff4beec9844aab --- cmk_base/automations/check_mk.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py index 7ab20a4..424ff35 100644 --- a/cmk_base/automations/check_mk.py +++ b/cmk_base/automations/check_mk.py @@ -697,24 +697,7 @@ class AutomationAnalyseServices(Automation): def static_check_rules_of(self, checkgroup_name, hostname): config_cache = config.get_config_cache() - - rules = [] - for entry in config.static_checks.get(checkgroup_name, []): - entry, rule_options = config.get_rule_options(entry) - if rule_options.get("disabled"): - continue - - if len(entry) == 3: - taglist, hostlist = entry[1:3] - else: - hostlist = entry[1] - taglist = [] - - if config.hosttags_match_taglist(config_cache.tags_of_host(hostname), taglist) and \ - config.in_extraconf_hostlist(hostlist, hostname): - rules.append(entry[0]) - - return rules + return config_cache.host_extra_conf(hostname, config.static_checks.get(checkgroup_name, [])) automations.register(AutomationAnalyseServices())
5 years, 3 months
1
0
0
0
Cleanup some ruleset processing
by Lars Michelsen
Module: check_mk Branch: master Commit: f157de5ee31779e83d6ad3b41d37f6bd86584895 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f157de5ee31779…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Tue Mar 26 17:11:42 2019 +0100 Cleanup some ruleset processing The analyse services automation call uses some hand crafted ruleset processing code which can be cleaned up to use generic code This commit separates ruleset logic from value handling and adds a test for the extracted functionality. The next step will be to switch this ruleset matching to generic code. Change-Id: Icae3912f0dbd2c6bb8391f802abcc2d86bb7ba25 --- cmk_base/automations/check_mk.py | 63 +++++++++++++++++++-------------- tests/unit/cmk_base/test_automations.py | 30 ++++++++++++++++ 2 files changed, 66 insertions(+), 27 deletions(-) diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py index ae5a316..7ab20a4 100644 --- a/cmk_base/automations/check_mk.py +++ b/cmk_base/automations/check_mk.py @@ -591,36 +591,24 @@ class AutomationAnalyseServices(Automation): table = check_table.get_check_table(hostname, remove_duplicates=True) # 1. Manual checks - for nr, (checkgroup, entries) in enumerate(config.static_checks.items()): - for entry in entries: - entry, rule_options = config.get_rule_options(entry) - if rule_options.get("disabled"): - continue - + for checkgroup_name in config.static_checks: + for value in self.static_check_rules_of(checkgroup_name, hostname): # Parameters are optional - if len(entry[0]) == 2: - checktype, item = entry[0] + if len(value) == 2: + checktype, item = value params = None else: - checktype, item, params = entry[0] - if len(entry) == 3: - taglist, hostlist = entry[1:3] - else: - hostlist = entry[1] - taglist = [] - - if config.hosttags_match_taglist(config_cache.tags_of_host(hostname), taglist) and \ - config.in_extraconf_hostlist(hostlist, hostname): - descr = config.service_description(hostname, checktype, item) - if descr == servicedesc: - return { - "origin": "static", - "checkgroup": checkgroup, - "checktype": checktype, - "item": item, - "rule_nr": nr, - "parameters": params, - } + checktype, item, params = value + + descr = config.service_description(hostname, checktype, item) + if descr == servicedesc: + return { + "origin": "static", + "checkgroup": checkgroup_name, + "checktype": checktype, + "item": item, + "parameters": params, + } # TODO: There is a lot of duplicated logic with discovery.py/check_table.py. Clean this # whole function up. @@ -707,6 +695,27 @@ class AutomationAnalyseServices(Automation): return {} # not found + def static_check_rules_of(self, checkgroup_name, hostname): + config_cache = config.get_config_cache() + + rules = [] + for entry in config.static_checks.get(checkgroup_name, []): + entry, rule_options = config.get_rule_options(entry) + if rule_options.get("disabled"): + continue + + if len(entry) == 3: + taglist, hostlist = entry[1:3] + else: + hostlist = entry[1] + taglist = [] + + if config.hosttags_match_taglist(config_cache.tags_of_host(hostname), taglist) and \ + config.in_extraconf_hostlist(hostlist, hostname): + rules.append(entry[0]) + + return rules + automations.register(AutomationAnalyseServices()) diff --git a/tests/unit/cmk_base/test_automations.py b/tests/unit/cmk_base/test_automations.py new file mode 100644 index 0000000..1a6ca0f --- /dev/null +++ b/tests/unit/cmk_base/test_automations.py @@ -0,0 +1,30 @@ +import cmk_base.automations.check_mk as automations +import cmk_base.config as config + + +def test_static_check_rules_of_host(monkeypatch): + as_automation = automations.AutomationAnalyseServices() + assert as_automation.static_check_rules_of("checkgroup_ding", "test-host") == [] + + monkeypatch.setattr(config, "all_hosts", ["test-host"]) + monkeypatch.setattr(config, "host_paths", {"test-host": "/"}) + monkeypatch.setattr( + config, "static_checks", { + "checkgroup_ding": [ + (("ding-check", "item"), [], config.ALL_HOSTS, {}), + (("ding-check", "item2"), [], config.ALL_HOSTS, { + "disabled": True + }), + (("dong-check", "item2", { + "param1": 1 + }), [], config.ALL_HOSTS, {}), + ], + }) + config.get_config_cache().initialize() + + assert as_automation.static_check_rules_of("checkgroup_ding", "test-host") == [ + ('ding-check', 'item'), + ('dong-check', 'item2', { + 'param1': 1 + }), + ]
5 years, 3 months
1
0
0
0
Cleaned up check_table.service_deps function
by Lars Michelsen
Module: check_mk Branch: master Commit: b31309d8a2cbba26cba266a89e9692e0f1f93f17 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b31309d8a2cbba…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Tue Mar 26 14:58:34 2019 +0100 Cleaned up check_table.service_deps function * Moved service_dependencies ruleset processing to config module * Renamed function to service_depends_on to be more specific * Added some basic unit tests for this function Change-Id: I805b0e1981e61743e4882a9d29156e722cdf83d4 --- cmk_base/check_table.py | 36 +----------------------------------- cmk_base/config.py | 36 ++++++++++++++++++++++++++++++++++++ cmk_base/core_nagios.py | 2 +- tests/unit/cmk_base/test_config.py | 22 +++++++++++++++++++++- 4 files changed, 59 insertions(+), 37 deletions(-) diff --git a/cmk_base/check_table.py b/cmk_base/check_table.py index 04c6af5..0e2a5f2 100644 --- a/cmk_base/check_table.py +++ b/cmk_base/check_table.py @@ -25,7 +25,6 @@ # Boston, MA 02110-1301 USA. """Code for computing the table of checks of hosts.""" -from cmk.utils.regex import regex from cmk.utils.exceptions import MKGeneralException import cmk_base @@ -157,7 +156,7 @@ def get_check_table(hostname, elif filter_mode == "only_clustered" and svc_is_mine: return - deps = service_deps(hostname, descr) + deps = config.service_depends_on(hostname, descr) check_table[(checkname, item)] = (params, descr, deps) # Now process all entries that are specific to the host @@ -234,39 +233,6 @@ def get_precompiled_check_parameters(hostname, item, params, check_plugin_name): return params -# Return a list of services this services depends upon -# TODO: Make this use the generic "rulesets" functions -# TODO: Is this needed here? Investigate for what this is used for -def service_deps(hostname, servicedesc): - deps = [] - config_cache = config.get_config_cache() - for entry in config.service_dependencies: - entry, rule_options = config.get_rule_options(entry) - if rule_options.get("disabled"): - continue - - if len(entry) == 3: - depname, hostlist, patternlist = entry - tags = [] - elif len(entry) == 4: - depname, tags, hostlist, patternlist = entry - else: - raise MKGeneralException("Invalid entry '%r' in service dependencies: " - "must have 3 or 4 entries" % entry) - - if config.hosttags_match_taglist(config_cache.tags_of_host(hostname), tags) and \ - config.in_extraconf_hostlist(hostlist, hostname): - for pattern in patternlist: - matchobject = regex(pattern).search(servicedesc) - if matchobject: - try: - item = matchobject.groups()[-1] - deps.append(depname % item) - except: - deps.append(depname) - return deps - - def remove_duplicate_checks(check_table): have_with_tcp = {} have_with_snmp = {} diff --git a/cmk_base/config.py b/cmk_base/config.py index 232131c..9aea948 100644 --- a/cmk_base/config.py +++ b/cmk_base/config.py @@ -1419,6 +1419,42 @@ def _checktype_ignored_for_host(host, checktype): return False +# TODO: Make this use the generic "rulesets" functions +# a) This function has never been configurable via WATO (see
https://mathias-kettner.de/checkmk_service_dependencies.html
) +# b) It only affects the Nagios core - CMC does not implement service dependencies +# c) This function implements some specific regex replacing match+replace which makes it incompatible to +# regular service rulesets. Therefore service_extra_conf() can not easily be used :-/ +def service_depends_on(hostname, servicedesc): + """Return a list of services this services depends upon""" + deps = [] + config_cache = get_config_cache() + for entry in service_dependencies: + entry, rule_options = get_rule_options(entry) + if rule_options.get("disabled"): + continue + + if len(entry) == 3: + depname, hostlist, patternlist = entry + tags = [] + elif len(entry) == 4: + depname, tags, hostlist, patternlist = entry + else: + raise MKGeneralException("Invalid entry '%r' in service dependencies: " + "must have 3 or 4 entries" % entry) + + if hosttags_match_taglist(config_cache.tags_of_host(hostname), tags) and \ + in_extraconf_hostlist(hostlist, hostname): + for pattern in patternlist: + matchobject = regex(pattern).search(servicedesc) + if matchobject: + try: + item = matchobject.groups()[-1] + deps.append(depname % item) + except: + deps.append(depname) + return deps + + #. # .--Misc Helpers--------------------------------------------------------. # | __ __ _ _ _ _ | diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py index 3a21e55..b5a080e 100644 --- a/cmk_base/core_nagios.py +++ b/cmk_base/core_nagios.py @@ -272,7 +272,7 @@ def _create_nagios_servicedefs(cfg, hostname, host_attrs): def get_dependencies(hostname, servicedesc): result = "" - for dep in check_table.service_deps(hostname, servicedesc): + for dep in config.service_depends_on(hostname, servicedesc): result += _format_nagios_object( "servicedependency", { "use": config.service_dependency_template, diff --git a/tests/unit/cmk_base/test_config.py b/tests/unit/cmk_base/test_config.py index 6a05865..9a07119 100644 --- a/tests/unit/cmk_base/test_config.py +++ b/tests/unit/cmk_base/test_config.py @@ -1,6 +1,6 @@ # encoding: utf-8 -import pytest +import pytest # type: ignore import cmk_base.config as config @@ -205,3 +205,23 @@ def test_http_proxy(http_proxy, result, monkeypatch): def _setup_host(monkeypatch, hostname, tags): monkeypatch.setattr(config, "all_hosts", ["%s|%s" % (hostname, "|".join(tags))]) monkeypatch.setattr(config, "host_paths", {hostname: "/"}) + + +def test_service_depends_on(monkeypatch): + assert config.service_depends_on("test-host", "svc") == [] + + monkeypatch.setattr(config, "all_hosts", ["test-host"]) + monkeypatch.setattr(config, "host_paths", {"test-host": "/"}) + monkeypatch.setattr(config, "service_dependencies", [ + ("dep1", [], config.ALL_HOSTS, ["svc1"], {}), + ("dep2-%s", [], config.ALL_HOSTS, ["svc1-(.*)"], {}), + ("dep-disabled", [], config.ALL_HOSTS, ["svc1"], { + "disabled": True + }), + ]) + + config.get_config_cache().initialize() + + assert config.service_depends_on("test-host", "svc2") == [] + assert config.service_depends_on("test-host", "svc1") == ["dep1"] + assert config.service_depends_on("test-host", "svc1-abc") == ["dep1", "dep2-abc"]
5 years, 3 months
1
0
0
0
GUI CSS: Moved specific snapin styles from py modules and _main.sscss to new _snapins.scss (CMK-1171)
by Kenneth Okoh
Module: check_mk Branch: master Commit: 492f86e223226e98cfe541a08849a4850e2e02e7 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=492f86e223226e…
Author: Kenneth Okoh <ko(a)mathias-kettner.de> Date: Tue Mar 26 14:30:23 2019 +0100 GUI CSS: Moved specific snapin styles from py modules and _main.sscss to new _snapins.scss (CMK-1171) Change-Id: I157d39c3bf327bcf2909a02acafc5eaa0f4cc809 --- web/htdocs/themes/facelift/scss/_main.scss | 98 +---- web/htdocs/themes/facelift/scss/_snapins.scss | 506 ++++++++++++++++++++++++ web/htdocs/themes/facelift/scss/_variables.scss | 2 + web/htdocs/themes/facelift/theme.scss | 1 + 4 files changed, 511 insertions(+), 96 deletions(-) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=492f86e223…
5 years, 3 months
1
0
0
0
checkman: moved HAproxy from HW to applications
by Martin Hirschvogel
Module: check_mk Branch: master Commit: 7c784a8b81c2014e0817a464545f9e835222e366 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7c784a8b81c201…
Author: Martin Hirschvogel <mh(a)mathias-kettner.de> Date: Wed Mar 27 09:56:53 2019 +0100 checkman: moved HAproxy from HW to applications CMK-1836 Change-Id: I615fd3390f60a73f5060ea5c5cbbbf4542abc1b6 --- checkman/haproxy.frontend | 3 +-- checkman/haproxy.server | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/checkman/haproxy.frontend b/checkman/haproxy.frontend index 170de44..122393b 100644 --- a/checkman/haproxy.frontend +++ b/checkman/haproxy.frontend @@ -1,6 +1,6 @@ title: HAProxy: Status of the Frontends agents: freebsd linux -catalog: hw/app/haproxy +catalog: app/haproxy license: GPL distribution: check_mk description: @@ -18,4 +18,3 @@ item: inventory: One service for each frontend is created. - diff --git a/checkman/haproxy.server b/checkman/haproxy.server index 1d4ecd0..c4bf706 100644 --- a/checkman/haproxy.server +++ b/checkman/haproxy.server @@ -1,6 +1,6 @@ title: HAProxy: Server Status agents: freebsd linux -catalog: hw/app/haproxy +catalog: app/haproxy license: GPL distribution: check_mk description:
5 years, 3 months
1
0
0
0
check_http: remove 'vhost' compatibility
by Moritz Kiemer
Module: check_mk Branch: master Commit: 7fb891c8d5e86b07fc9488e3ded1dc71bef66c9e URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7fb891c8d5e86b…
Author: Moritz Kiemer <mo(a)mathias-kettner.de> Date: Wed Mar 27 09:05:03 2019 +0100 check_http: remove 'vhost' compatibility This key was only defined in May 2012, and never part of a stable release. Change-Id: I81e0ceacea022883154d977314a2265ba04f44bd --- checks/check_http | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/checks/check_http b/checks/check_http index f5d26a8..19cbacc 100644 --- a/checks/check_http +++ b/checks/check_http @@ -116,8 +116,7 @@ def _certificate_args(address_family, address, proxy, settings): def _url_args(address_family, address, proxy, settings): # get virthost settings: - # TODO: when did 'vhost' dissapear from WATO? - vhost, omit_ip = settings.get("virthost", (settings.get("vhost"), False)) + vhost, omit_ip = settings.get("virthost", (None, False)) args = []
5 years, 3 months
1
0
0
0
7384 check_http: Improve WATO rule
by Moritz Kiemer
Module: check_mk Branch: master Commit: c40a74053b54934630078c86189ba78da4e80e14 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c40a74053b5493…
Author: Moritz Kiemer <mo(a)mathias-kettner.de> Date: Tue Mar 26 13:53:54 2019 +0100 7384 check_http: Improve WATO rule The WATO rule to configure the active check 'check_http' now provides a more user friendly way to configure proxy settings. Change-Id: I43b4c50759e786db96059eb8ba343dce5fbee91a --- .werks/7384 | 11 ++++++ checks/check_http | 28 ++++++++------ cmk/gui/plugins/wato/active_checks.py | 70 +++++++++++++++-------------------- 3 files changed, 58 insertions(+), 51 deletions(-) diff --git a/.werks/7384 b/.werks/7384 new file mode 100644 index 0000000..6f76afd --- /dev/null +++ b/.werks/7384 @@ -0,0 +1,11 @@ +Title: check_http: Improve WATO rule +Level: 1 +Component: checks +Compatible: compat +Edition: cre +Version: 1.6.0i1 +Date: 1553667609 +Class: feature + +The WATO rule to configure the active check 'check_http' now provides a more +user friendly way to configure proxy settings. diff --git a/checks/check_http b/checks/check_http index 933deb3..f5d26a8 100644 --- a/checks/check_http +++ b/checks/check_http @@ -30,7 +30,19 @@ def _transform_check_http(params): return params name, mode = params mode_name = 'cert' if "cert_days" in mode else 'url' - return {"name": name, "mode": (mode_name, mode)} + + transformed = {"name": name, "mode": (mode_name, mode)} + # The proxy option has ben isolated in version 1.6.0i1 + proxy_address = mode.get("proxy") + if proxy_address: + proxy = transformed.setdefault("proxy", {"address": proxy_address}) + # ':' outside a IPv6 address indicates port + if ':' in proxy_address.split(']')[-1]: + proxy["address"], proxy["port"] = proxy_address.rsplit(':', 1) + if "proxy_auth" in mode: + proxy["auth"] = mode["proxy_auth"] + + return transformed def _get_family_and_address(settings): @@ -53,18 +65,12 @@ def _get_proxy(params): if not proxy: return None - # ':' outside a IPv6 address indicates port - if ':' in proxy.split(']')[-1]: - address, port = proxy.rsplit(':', 1) - else: - address, port = proxy, None - - auth = params.get("proxy_auth") + auth = proxy.get("auth") if auth: auth = passwordstore_get_cmdline("%s:%%s" % auth[0], auth[1]) - proset = collections.namedtuple("ProxySettings", ("address", "port", "auth")) - return proset(address, port, auth) + ProxySettings = collections.namedtuple("ProxySettings", ("address", "port", "auth")) + return ProxySettings(proxy.get("address"), proxy.get("port"), auth) def _certificate_args(address_family, address, proxy, settings): @@ -222,7 +228,7 @@ def check_http_arguments(params): mode_name, settings = params["mode"] address_family, address = _get_family_and_address(settings) - proxy = _get_proxy(settings) + proxy = _get_proxy(params) if mode_name == 'cert': return _certificate_args(address_family, address, proxy, settings) diff --git a/cmk/gui/plugins/wato/active_checks.py b/cmk/gui/plugins/wato/active_checks.py index 48d5c22..d664b4b 100644 --- a/cmk/gui/plugins/wato/active_checks.py +++ b/cmk/gui/plugins/wato/active_checks.py @@ -966,6 +966,22 @@ class RulespecActiveChecksHttp(HostRulespec): def _portspec(self, default): return Integer(title=_("TCP Port"), minvalue=1, maxvalue=65535, default_value=default) + def _proxyspec(self): + return Dictionary( + title=_("Use proxy"), + elements=[ + ("address", TextAscii(title=_("Proxy server address"))), + ("port", self._portspec(80)), + ("auth", + Tuple( + title=_("Proxy basic authorization"), + elements=[ + TextAscii(title=_("Username"), size=12, allow_empty=False), + IndividualOrStoredPassword(title=_("Password"),), + ])), + ], + required_keys=["address"]) + @property def valuespec(self): return Transform( @@ -986,6 +1002,7 @@ class RulespecActiveChecksHttp(HostRulespec): "a caret (<tt>^</tt>), the service description will not be prefixed with either " "<tt>HTTP</tt> or <tt>HTTPS</tt>."), allow_empty=False)), + ("proxy", self._proxyspec()), ("mode", CascadingDropdown( title=_("Mode of the Check"), @@ -1096,27 +1113,6 @@ class RulespecActiveChecksHttp(HostRulespec): IndividualOrStoredPassword(title=_("Password"),) ])), ( - "proxy", - TextAscii( - title=_("Proxy host"), - help=_( - "To use a proxy you have to use the Port of the proxy, " - "specify the virtual host and the URL to fetch, " - "use the HTTP Method CONNECT, and use SSL/HTTPS " - "for the connection")), - ), - ("proxy_auth", - Tuple( - title=_("Proxy-Authorization"), - help=_( - "Credentials for HTTP Proxy with basic authentication" - ), - elements=[ - TextAscii( - title=_("Username"), size=12, allow_empty=False), - IndividualOrStoredPassword(title=_("Password"),), - ])), - ( "onredirect", DropdownChoice( title=_("How to handle redirect"), @@ -1296,25 +1292,6 @@ class RulespecActiveChecksHttp(HostRulespec): ), ), ), - ( - "proxy", - TextAscii( - title=_("Proxy host"), - help= - _("To use a proxy you have to specify the Port of the proxy. " - )), - ), - ("proxy_auth", - Tuple( - title=_("Proxy-Authorization"), - help=_( - "Credentials for HTTP Proxy with basic authentication" - ), - elements=[ - TextAscii( - title=_("Username"), size=12, allow_empty=False), - IndividualOrStoredPassword(title=_("Password"),), - ])), ], required_keys=["cert_days"], )), @@ -1336,6 +1313,19 @@ class RulespecActiveChecksHttp(HostRulespec): mode_name = 'cert' if "cert_days" in mode else 'url' + transformed = {"name": params[0], "mode": (mode_name, mode)} + + # The proxy option has been isolated in version 1.6.0i1 + proxy_address = mode.pop("proxy", None) + if proxy_address: + proxy = transformed.setdefault("proxy", {"address": proxy_address}) + # ':' outside a IPv6 address indicates port + if ':' in proxy_address.split(']')[-1]: + proxy["address"], proxy["port"] = proxy_address.rsplit(':', 1) + auth = mode.pop("proxy_auth", None) + if auth: + proxy["auth"] = auth + return {"name": name, "mode": (mode_name, mode)}
5 years, 3 months
1
0
0
0
fix cma package pattern
by Alex Zurhake
Module: check_mk Branch: master Commit: e13b1526b0ee408a55089593469bc2354bab00a3 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e13b1526b0ee40…
Author: Alex Zurhake <az(a)mathias-kettner.de> Date: Wed Mar 27 11:16:32 2019 +0100 fix cma package pattern Change-Id: I14830efe17c5711fd387fc1e951e640f2aee5959 --- buildscripts/scripts/nightly-build.jenkins | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildscripts/scripts/nightly-build.jenkins b/buildscripts/scripts/nightly-build.jenkins index 55f0445..3e43969 100644 --- a/buildscripts/scripts/nightly-build.jenkins +++ b/buildscripts/scripts/nightly-build.jenkins @@ -217,7 +217,7 @@ node { cd /bauwelt/download/${CMK_VERS} cp ${DAILY_DATA}/*-dest/check-mk-enterprise-*_amd64.deb . || true cp ${DAILY_DATA}/*-dest/check-mk-enterprise-*.x86_64.rpm . || true - cp ${DAILY_DATA}/*-dest/check-mk-enterprise-*.x86_64.cma . || true + cp ${DAILY_DATA}/*-dest/check-mk-enterprise-*x86_64.cma . || true cp ${DAILY_DATA}/git/check-mk-enterprise-${CMK_VERS}.cee.tar.gz . || true """ withCredentials([usernamePassword(credentialsId: '9d7aca31-0043-4cd0-abeb-26a249d68261', passwordVariable: 'GPG_PASSPHRASE', usernameVariable: 'GPG_USERNAME')]) { @@ -233,7 +233,7 @@ node { dir("${DAILY_DATA}/download") { sh "cp ${DAILY_DATA}/*-dest/check-mk-enterprise-*_amd64.deb . || true" sh "cp ${DAILY_DATA}/*-dest/check-mk-enterprise-*.x86_64.rpm . || true" - sh "cp ${DAILY_DATA}/*-dest/check-mk-enterprise-*.x86_64.cma . || true" + sh "cp ${DAILY_DATA}/*-dest/check-mk-enterprise-*x86_64.cma . || true" sh "cp ${DAILY_DATA}/git/check-mk-enterprise-${CMK_VERS}.cee.tar.gz . || true" withCredentials([usernamePassword(credentialsId: '9d7aca31-0043-4cd0-abeb-26a249d68261', passwordVariable: 'GPG_PASSPHRASE', usernameVariable: 'GPG_USERNAME')]) { sh "${DAILY_DATA}/git/buildscripts/scripts/sign-packages.sh ${CMK_VERS}"
5 years, 3 months
1
0
0
0
[CMK-1791] - refactoring and small fixes
by Sergey Kipnis
Module: check_mk Branch: master Commit: 67f5979803ed404a70bc50adc85a23c8ca20048a URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=67f5979803ed40…
Author: Sergey Kipnis <sk(a)mathias-kettner.de> Date: Tue Mar 26 13:27:20 2019 +0100 [CMK-1791] - refactoring and small fixes - asio.h is ANSI - support for string_view - debug logs Change-Id: I115b9292cb0067b509ccef2c2a96120da0761a4b --- agents/wnx/include/tools/_misc.h | 12 ++++++++++++ agents/wnx/src/common/cfg_info.h | 1 + agents/wnx/src/common/cmdline_info.h | 2 +- agents/wnx/src/engine/asio.h | 2 +- agents/wnx/src/engine/carrier.h | 7 +++++-- agents/wnx/src/engine/provider_api.h | 7 +++++-- agents/wnx/wnxtest/wnxtest.vcxproj | 20 ++++++++++++++++++++ 7 files changed, 45 insertions(+), 6 deletions(-) diff --git a/agents/wnx/include/tools/_misc.h b/agents/wnx/include/tools/_misc.h index 551ab9a..fa7c762 100644 --- a/agents/wnx/include/tools/_misc.h +++ b/agents/wnx/include/tools/_misc.h @@ -179,6 +179,18 @@ auto ParseKeyValue(const std::basic_string<T> Arg, T Splitter) { } template <typename T> +auto ParseKeyValue(const std::basic_string_view<T> Arg, T Splitter) { + auto end = Arg.find_first_of(Splitter); + if (end == std::basic_string<T>::npos) { + return std::make_tuple(std::basic_string<T>(), std::basic_string<T>()); + } + auto key = Arg.substr(0, end); + auto value = Arg.substr(end + 1); + return std::make_tuple(std::basic_string<T>(key), + std::basic_string<T>(value)); +} + +template <typename T> auto ParseKeyValue(const T* Arg, T Splitter) { return ParseKeyValue(std::basic_string<T>(Arg), Splitter); } diff --git a/agents/wnx/src/common/cfg_info.h b/agents/wnx/src/common/cfg_info.h index cdcd7d1..de0828b 100644 --- a/agents/wnx/src/common/cfg_info.h +++ b/agents/wnx/src/common/cfg_info.h @@ -65,6 +65,7 @@ constexpr int kDefaultAgentMaxWait = 15; // max time agent waits for a sections constexpr int kDefaultAgentMinWait = 1; // max time agent waits for a sections const char* const kDefaultLogFileName = "check_mk.log"; +const char* const kDefaultAppFileName = "check_mk_agent.exe"; constexpr wchar_t kAppDataCompanyName[] = L"CheckMK"; constexpr char kDefaultEventLogName[] = "CheckMK"; // name for windows event log diff --git a/agents/wnx/src/common/cmdline_info.h b/agents/wnx/src/common/cmdline_info.h index 6213d39..209dea0 100644 --- a/agents/wnx/src/common/cmdline_info.h +++ b/agents/wnx/src/common/cmdline_info.h @@ -25,7 +25,7 @@ constexpr const wchar_t* kTimeout = L"timeout"; constexpr wchar_t kSplitter = L':'; -auto ParseExeCommandLine(int argc, wchar_t const* argv[]) { +inline auto ParseExeCommandLine(int argc, wchar_t const* argv[]) { using namespace std; auto make_error_answer = [](int ErrorCode) -> auto { return make_tuple(ErrorCode, std::wstring(), std::wstring(), diff --git a/agents/wnx/src/engine/asio.h b/agents/wnx/src/engine/asio.h index ed4b499..e74f9f1 100644 --- a/agents/wnx/src/engine/asio.h +++ b/agents/wnx/src/engine/asio.h @@ -1,4 +1,4 @@ - + // Wrapping asio.hpp to hook socket creation with // internal control of the options and mode // diff --git a/agents/wnx/src/engine/carrier.h b/agents/wnx/src/engine/carrier.h index 7a79d07..a7e8921 100644 --- a/agents/wnx/src/engine/carrier.h +++ b/agents/wnx/src/engine/carrier.h @@ -1,5 +1,5 @@ -// provides basic api to start and stop service +// API "Internal transport" #pragma once #include <chrono> // timestamps @@ -11,6 +11,8 @@ #include "tools/_misc.h" #include "tools/_xlog.h" +#include "logger.h" + namespace cma::carrier { enum DataType { kLog = 0, @@ -180,7 +182,8 @@ public: cc.shutdownCommunication(); return ret; } else { - xlog::l("Failed convert %ls", Id.c_str()).print(); + XLOG::l("Failed to convert id value '{}'", + wtools::ConvertToUTF8(Id)); return false; } } diff --git a/agents/wnx/src/engine/provider_api.h b/agents/wnx/src/engine/provider_api.h index 1f1e8ad..d7bb59e 100644 --- a/agents/wnx/src/engine/provider_api.h +++ b/agents/wnx/src/engine/provider_api.h @@ -12,8 +12,9 @@ namespace cma::provider { constexpr const wchar_t* kProviderName = - L"Provider"; // unique name of the plugin player + L"Provider"; // unique name of the provider +// FUNCTIONS BELOW ARE IMPLEMENTED IN THE PROVIDER void ProgramUsage(const std::wstring& Comment); // test [parameters] @@ -22,12 +23,14 @@ int MainTest(int argc, wchar_t const* argv[]); // run [parameters] int MainRun(int argc, wchar_t const* argv[]); -// runonce [parameters] +// run something [parameters] int MainRunOnce(int argc, wchar_t const* argv[]); // main int MainFunction(int argc, wchar_t const* argv[]); +// ******************************************************** + // sub form main inline int MainFunctionCore(int argc, wchar_t const* argv[]) { using namespace cma::exe::cmdline; diff --git a/agents/wnx/wnxtest/wnxtest.vcxproj b/agents/wnx/wnxtest/wnxtest.vcxproj index 3cb5f78..41024af 100644 --- a/agents/wnx/wnxtest/wnxtest.vcxproj +++ b/agents/wnx/wnxtest/wnxtest.vcxproj @@ -32,6 +32,26 @@ <ImportGroup Label="Shared" /> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>../build/$(ProjectName)\$(Platform)\$(Configuration)\</OutDir> + <IntDir>../build/$(ProjectName)\$(Platform)\$(Configuration)\obj\</IntDir> + <TargetName>$(ProjectName)$(PlatformArchitecture)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>../build/$(ProjectName)\$(Platform)\$(Configuration)\</OutDir> + <IntDir>../build/$(ProjectName)\$(Platform)\$(Configuration)\obj\</IntDir> + <TargetName>$(ProjectName)$(PlatformArchitecture)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>../build/$(ProjectName)\$(Platform)\$(Configuration)\</OutDir> + <IntDir>../build/$(ProjectName)\$(Platform)\$(Configuration)\obj\</IntDir> + <TargetName>$(ProjectName)$(PlatformArchitecture)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>../build/$(ProjectName)\$(Platform)\$(Configuration)\</OutDir> + <IntDir>../build/$(ProjectName)\$(Platform)\$(Configuration)\obj\</IntDir> + <TargetName>$(ProjectName)$(PlatformArchitecture)</TargetName> + </PropertyGroup> <ItemGroup> <ClInclude Include="pch.h" /> </ItemGroup>
5 years, 3 months
1
0
0
0
Fixed broken nagios config precompile (when using logwatch.ec)
by Lars Michelsen
Module: check_mk Branch: master Commit: a03d11ce1cc081239c959dd5abdb8e1a852f873d URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a03d11ce1cc081…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Wed Mar 27 10:49:27 2019 +0100 Fixed broken nagios config precompile (when using logwatch.ec) Change-Id: I931c0d70f36942142e42dae433c4d17b4330e222 --- cmk_base/core_nagios.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py index d9e7677..3a21e55 100644 --- a/cmk_base/core_nagios.py +++ b/cmk_base/core_nagios.py @@ -1005,6 +1005,8 @@ def _precompile_hostcheck(hostname): console.verbose("%s%s%-16s%s:", tty.bold, tty.blue, hostname, tty.normal, stream=sys.stderr) + check_api_utils.set_hostname(hostname) + compiled_filename = cmk.utils.paths.precompiled_hostchecks_dir + "/" + hostname source_filename = compiled_filename + ".py" for fname in [compiled_filename, source_filename]:
5 years, 3 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
46
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Results per page:
10
25
50
100
200