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
October
September
August
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 -----
October 2024
September 2024
August 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
Add missing containerization entry in check manual pages
by Tom Baerwinkel
Module: check_mk Branch: master Commit: 204352795f7dc75604fa85a5c68faf211fde4f77 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=204352795f7dc7…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de> Date: Wed Mar 27 17:06:28 2019 +0100 Add missing containerization entry in check manual pages Change-Id: Iece0a3ffa6338567a1d2e6b00dd49d9ee3ab7aff --- cmk/gui/wato/pages/check_catalog.py | 2 ++ .../classic/images/icon_plugins_containerization.png | Bin 0 -> 1676 bytes .../facelift/images/icon_plugins_containerization.png | Bin 0 -> 1676 bytes 3 files changed, 2 insertions(+) diff --git a/cmk/gui/wato/pages/check_catalog.py b/cmk/gui/wato/pages/check_catalog.py index 41cfaeb..cc4c13d 100644 --- a/cmk/gui/wato/pages/check_catalog.py +++ b/cmk/gui/wato/pages/check_catalog.py @@ -319,6 +319,8 @@ class ModeCheckPlugins(WatoMode): "processes, services or databases")), ("cloud", False, _("Cloud Based Environments"), _("Monitoring of cloud environments like Microsoft Azure")), + ("containerization", False, _("Containerization"), + _("Monitoring of container and container orchestration software")), ("agentless", False, _("Networking checks without agent"), _("Plugins that directly check networking " "protocols like HTTP or IMAP")), diff --git a/web/htdocs/themes/classic/images/icon_plugins_containerization.png b/web/htdocs/themes/classic/images/icon_plugins_containerization.png new file mode 100644 index 0000000..e432b56 Binary files /dev/null and b/web/htdocs/themes/classic/images/icon_plugins_containerization.png differ diff --git a/web/htdocs/themes/facelift/images/icon_plugins_containerization.png b/web/htdocs/themes/facelift/images/icon_plugins_containerization.png new file mode 100644 index 0000000..e432b56 Binary files /dev/null and b/web/htdocs/themes/facelift/images/icon_plugins_containerization.png differ
5 years, 6 months
1
0
0
0
Minor simplification: Do not use to_dict_config()
by Lars Michelsen
Module: check_mk Branch: master Commit: 37b3c62d062bebc04bb9ca843dc9a87460a03e70 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=37b3c62d062beb…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Wed Mar 27 16:35:09 2019 +0100 Minor simplification: Do not use to_dict_config() Change-Id: Ic257c9bdcae7fa7b8d6fa677631da8f2c19bdc0e --- cmk/gui/plugins/wato/ac_tests.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmk/gui/plugins/wato/ac_tests.py b/cmk/gui/plugins/wato/ac_tests.py index f8213c1..eb676ff 100644 --- a/cmk/gui/plugins/wato/ac_tests.py +++ b/cmk/gui/plugins/wato/ac_tests.py @@ -824,10 +824,7 @@ class ACTestESXDatasources(ACTest): def execute(self): all_rules_ok = True for folder, rule_index, rule in self._get_rules(): - rule_config = rule.to_dict_config() - vsphere_queries_agent = (rule_config['value'].get('direct') in [ - 'agent', 'hostsystem_agent' - ]) + vsphere_queries_agent = (rule.value.get('direct') in ['agent', 'hostsystem_agent']) if vsphere_queries_agent: all_rules_ok = False yield ACResultCRIT(
5 years, 6 months
1
0
0
0
check_http: fix already diverging transforms
by Moritz Kiemer
Module: check_mk Branch: master Commit: 0a6be3cff3175966735746fe8aa097c016acefc7 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0a6be3cff31759…
Author: Moritz Kiemer <mo(a)mathias-kettner.de> Date: Wed Mar 27 14:20:29 2019 +0100 check_http: fix already diverging transforms Change-Id: I463696f52cd442654280aba2051eb54ddb6bd890 --- cmk/gui/plugins/wato/active_checks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmk/gui/plugins/wato/active_checks.py b/cmk/gui/plugins/wato/active_checks.py index d664b4b..9298ba7 100644 --- a/cmk/gui/plugins/wato/active_checks.py +++ b/cmk/gui/plugins/wato/active_checks.py @@ -1313,7 +1313,7 @@ class RulespecActiveChecksHttp(HostRulespec): mode_name = 'cert' if "cert_days" in mode else 'url' - transformed = {"name": params[0], "mode": (mode_name, mode)} + transformed = {"name": name, "mode": (mode_name, mode)} # The proxy option has been isolated in version 1.6.0i1 proxy_address = mode.pop("proxy", None) @@ -1326,7 +1326,7 @@ class RulespecActiveChecksHttp(HostRulespec): if auth: proxy["auth"] = auth - return {"name": name, "mode": (mode_name, mode)} + return transformed @rulespec_registry.register
5 years, 6 months
1
0
0
0
check_http: prepare for reorganized host options
by Moritz Kiemer
Module: check_mk Branch: master Commit: 0466891aed26a7ce4a4207ef3ebfdaaf53f6ee8c URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0466891aed26a7…
Author: Moritz Kiemer <mo(a)mathias-kettner.de> Date: Wed Mar 27 13:01:17 2019 +0100 check_http: prepare for reorganized host options Change-Id: I3ec944172cb79d83ed6782b4d16bbb4dac123de5 --- checks/check_http | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/checks/check_http b/checks/check_http index 19cbacc..849abeb 100644 --- a/checks/check_http +++ b/checks/check_http @@ -45,7 +45,7 @@ def _transform_check_http(params): return transformed -def _get_family_and_address(settings): +def _get_host(settings): # Use the address family of the monitored host by default family = settings.get("address_family") if family is None: @@ -56,7 +56,8 @@ def _get_family_and_address(settings): else: address = "$_HOSTADDRESS_4$" - return family, address + HostSettings = collections.namedtuple("HostSettings", ("address", "family")) + return HostSettings(address, family) def _get_proxy(params): @@ -73,12 +74,12 @@ def _get_proxy(params): return ProxySettings(proxy.get("address"), proxy.get("port"), auth) -def _certificate_args(address_family, address, proxy, settings): +def _certificate_args(host, proxy, settings): args = [] - server = settings.get('cert_host', address) + server = settings.get('cert_host', host.address) - if address_family == 'ipv6': + if host.family == 'ipv6': args += ['-6'] if "cert_days" in settings: @@ -113,7 +114,7 @@ def _certificate_args(address_family, address, proxy, settings): return args -def _url_args(address_family, address, proxy, settings): +def _url_args(host, proxy, settings): # get virthost settings: vhost, omit_ip = settings.get("virthost", (None, False)) @@ -123,12 +124,12 @@ def _url_args(address_family, address, proxy, settings): if proxy: args += ["-I", proxy.address] elif not omit_ip: - args += ["-I", address] + args += ["-I", host.address] if vhost: args += ["-H", vhost] - if address_family == 'ipv6': + if host.family == 'ipv6': args += ['-6'] # TODO: I think this should be overridden by the proxy port @@ -226,12 +227,12 @@ def check_http_arguments(params): mode_name, settings = params["mode"] - address_family, address = _get_family_and_address(settings) + host = _get_host(settings) proxy = _get_proxy(params) if mode_name == 'cert': - return _certificate_args(address_family, address, proxy, settings) - return _url_args(address_family, address, proxy, settings) + return _certificate_args(host, proxy, settings) + return _url_args(host, proxy, settings) def check_http_description(params):
5 years, 6 months
1
0
0
0
7070 FIX agent_kubernetes: don't output node with name "None"
by Tom Baerwinkel
Module: check_mk Branch: master Commit: 10ca8c66f0feafe51beb468c179077da4d54f87a URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=10ca8c66f0feaf…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de> Date: Tue Mar 26 18:40:35 2019 +0100 7070 FIX agent_kubernetes: don't output node with name "None" If pods cannot be scheduled their assigned node is "None". The special agent produced piggyback data for this "None" node. This output is now removed. Change-Id: Ic9f4545e43c8e2a6b3b96a2b22d2097083c88e75 --- .werks/7070 | 12 ++++++++++++ cmk/special_agents/agent_kubernetes.py | 13 ++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.werks/7070 b/.werks/7070 new file mode 100644 index 0000000..fe734cf --- /dev/null +++ b/.werks/7070 @@ -0,0 +1,12 @@ +Title: agent_kubernetes: don't output node with name "None" +Level: 1 +Component: checks +Compatible: compat +Edition: cre +Version: 1.6.0i1 +Date: 1553622124 +Class: fix + +If pods cannot be scheduled their assigned node is "None". +The special agent produced piggyback data for this "None" +node. This output is now removed. diff --git a/cmk/special_agents/agent_kubernetes.py b/cmk/special_agents/agent_kubernetes.py index ac250ac..20eb247 100644 --- a/cmk/special_agents/agent_kubernetes.py +++ b/cmk/special_agents/agent_kubernetes.py @@ -473,7 +473,13 @@ class PodList(ListLike[Pod]): # type: () -> Dict[str, Dict[str, Dict[str, int]]] pods_sorted = sorted(self, key=lambda pod: pod.node) by_node = itertools.groupby(pods_sorted, lambda pod: pod.node) - return {node: {'requests': {'pods': len(list(pods))}} for node, pods in by_node} + return { + node: { + 'requests': { + 'pods': len(list(pods)) + } + } for node, pods in by_node if node is not None + } def pods_in_cluster(self): return {'requests': {'pods': len(self)}} @@ -496,8 +502,9 @@ class PodList(ListLike[Pod]): by_node = itertools.groupby(pods_sorted, lambda pod: pod.node) merge = functools.partial(left_join_dicts, operation=operator.add) return { - node: reduce(merge, [p.resources for p in pods - ], Pod.zero_resources()) for node, pods in by_node + node: reduce(merge, [p.resources for p in pods], Pod.zero_resources()) + for node, pods in by_node + if node is not None } def cluster_resources(self):
5 years, 6 months
1
0
0
0
mk_jolokia: increase debug capability
by Moritz Kiemer
Module: check_mk Branch: master Commit: 54f1fc3df8bee845bc18fce1cfffed529f175e5e URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=54f1fc3df8bee8…
Author: Moritz Kiemer <mo(a)mathias-kettner.de> Date: Fri Mar 22 07:38:59 2019 +0100 mk_jolokia: increase debug capability Change-Id: I67fe1e997071b6babc9fea49a571c3ab2f878906 --- agents/plugins/mk_jolokia.py | 9 +++++++-- tests/unit/plugins/test_mk_jolokia.py | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/agents/plugins/mk_jolokia.py b/agents/plugins/mk_jolokia.py index bfe76e8..6e6ec35 100755 --- a/agents/plugins/mk_jolokia.py +++ b/agents/plugins/mk_jolokia.py @@ -52,8 +52,8 @@ except ImportError as import_error: " Please install it on the monitored system.") sys.exit(1) -VERBOSE = '--verbose' in sys.argv -DEBUG = '--debug' in sys.argv +VERBOSE = sys.argv.count('--verbose') + sys.argv.count('-v') + 2 * sys.argv.count('-vv') +DEBUG = sys.argv.count('--debug') MBEAN_SECTIONS = { 'jvm_threading': ("java.lang:type=Threading",), @@ -342,6 +342,11 @@ class JolokiaInstance(object): def validate_response(raw): '''return loaded response or raise exception''' + if VERBOSE > 1: + sys.stderr.write("DEBUG: %r:\n" + "DEBUG: headers: %r\n" + "DEBUG: content: %r\n\n" % (raw, raw.headers, raw.content)) + # check the status of the http server if not 200 <= raw.status_code < 300: sys.stderr.write("ERROR: HTTP STATUS: %d\n" % raw.status_code) diff --git a/tests/unit/plugins/test_mk_jolokia.py b/tests/unit/plugins/test_mk_jolokia.py index 427f9a1..e51155e 100644 --- a/tests/unit/plugins/test_mk_jolokia.py +++ b/tests/unit/plugins/test_mk_jolokia.py @@ -104,6 +104,8 @@ def test_jolokia_yield_configured_instances(): class _MockHttpResponse(object): def __init__(self, http_status, **kwargs): self.status_code = http_status + self.headers = {} + self.content = b'\x00' self._payload = kwargs def json(self):
5 years, 6 months
1
0
0
0
Inline 2 trivial helper functions.
by Sven Panne
Module: check_mk Branch: master Commit: 909155871ea4e131d86b662e529e6a7361f82ec2 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=909155871ea4e1…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Wed Mar 27 14:12:02 2019 +0100 Inline 2 trivial helper functions. This unifies access to custom variables a bit. Change-Id: Ib757f7ec15f6c646831fc381181313fd717a1743 --- livestatus/src/CustomTimeperiodColumn.cc | 18 ++++++------------ livestatus/src/CustomTimeperiodColumn.h | 2 -- livestatus/src/CustomVarsExplicitColumn.cc | 17 ++++++----------- livestatus/src/CustomVarsExplicitColumn.h | 3 --- 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/livestatus/src/CustomTimeperiodColumn.cc b/livestatus/src/CustomTimeperiodColumn.cc index 2acdad4..5b919f6 100644 --- a/livestatus/src/CustomTimeperiodColumn.cc +++ b/livestatus/src/CustomTimeperiodColumn.cc @@ -32,19 +32,13 @@ extern TimeperiodsCache *g_timeperiods_cache; // state of that period int32_t CustomTimeperiodColumn::getValue( Row row, const contact * /* auth_user */) const { - for (customvariablesmember *cvm = getCVM(row); cvm != nullptr; - cvm = cvm->next) { - if (cvm->variable_name == _varname) { - return static_cast<int32_t>( - g_timeperiods_cache->inTimeperiod(cvm->variable_value)); + if (auto p = columnData<customvariablesmember *>(row)) { + for (auto cvm = *p; cvm != nullptr; cvm = cvm->next) { + if (cvm->variable_name == _varname) { + return static_cast<int32_t>( + g_timeperiods_cache->inTimeperiod(cvm->variable_value)); + } } } return 1; // assume 24X7 } - -customvariablesmember *CustomTimeperiodColumn::getCVM(Row row) const { - if (auto p = columnData<customvariablesmember *>(row)) { - return *p; - } - return nullptr; -} diff --git a/livestatus/src/CustomTimeperiodColumn.h b/livestatus/src/CustomTimeperiodColumn.h index c8ca82b..9a93608 100644 --- a/livestatus/src/CustomTimeperiodColumn.h +++ b/livestatus/src/CustomTimeperiodColumn.h @@ -46,8 +46,6 @@ public: private: std::string _varname; - - customvariablesmember *getCVM(Row row) const; }; #endif // CustomTimeperiodColumn_h diff --git a/livestatus/src/CustomVarsExplicitColumn.cc b/livestatus/src/CustomVarsExplicitColumn.cc index 82d69af..dfe2112 100644 --- a/livestatus/src/CustomVarsExplicitColumn.cc +++ b/livestatus/src/CustomVarsExplicitColumn.cc @@ -24,20 +24,15 @@ #include "CustomVarsExplicitColumn.h" #include "Row.h" +#include "nagios.h" std::string CustomVarsExplicitColumn::getValue(Row row) const { - for (customvariablesmember *cvm = getCVM(row); cvm != nullptr; - cvm = cvm->next) { - if (cvm->variable_name == _varname) { - return cvm->variable_value; + if (auto p = columnData<customvariablesmember *>(row)) { + for (auto cvm = *p; cvm != nullptr; cvm = cvm->next) { + if (cvm->variable_name == _varname) { + return cvm->variable_value; + } } } return ""; } - -customvariablesmember *CustomVarsExplicitColumn::getCVM(Row row) const { - if (auto p = columnData<customvariablesmember *>(row)) { - return *p; - } - return nullptr; -} diff --git a/livestatus/src/CustomVarsExplicitColumn.h b/livestatus/src/CustomVarsExplicitColumn.h index 4254348..33d7064 100644 --- a/livestatus/src/CustomVarsExplicitColumn.h +++ b/livestatus/src/CustomVarsExplicitColumn.h @@ -28,7 +28,6 @@ #include "config.h" // IWYU pragma: keep #include <string> #include "StringColumn.h" -#include "nagios.h" class Row; class CustomVarsExplicitColumn : public StringColumn { @@ -45,8 +44,6 @@ public: private: std::string _varname; - - customvariablesmember *getCVM(Row row) const; }; #endif // CustomVarsExplicitColumn_h
5 years, 6 months
1
0
0
0
[CMK-1791] - removing separate binary for winperf sections
by Sergey Kipnis
Module: check_mk Branch: master Commit: eb3d9578a1052bb376686704591eee00c55b077d URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eb3d9578a1052b…
Author: Sergey Kipnis <sk(a)mathias-kettner.de> Date: Wed Mar 27 10:36:00 2019 +0100 [CMK-1791] - removing separate binary for winperf sections - new commandline API for main exe - revamped top level API for main exe - support winperf in main exe - yml by default set winperf.exe = 'agent', where agent means main exe - removed winperf from install - logging improvements - fixed AccumulateCounters API Change-Id: Ied88a3f81647e73a1835da8a27683d9dc24c37d3 --- agents/wnx/install/Product.wxs | 6 +- agents/wnx/install/resources/check_mk.yml | 2 +- agents/wnx/src/engine/engine.vcxproj | 2 + agents/wnx/src/engine/engine.vcxproj.filters | 6 + agents/wnx/src/engine/groups.cpp | 4 +- .../wnx/src/engine/providers/perf_counters_cl.cpp | 68 +++++++++ agents/wnx/src/engine/providers/perf_counters_cl.h | 33 +++++ agents/wnx/src/engine/service_processor.cpp | 30 ++++ agents/wnx/src/engine/service_processor.h | 5 +- agents/wnx/src/engine/windows_service_api.cpp | 16 +- agents/wnx/src/engine/windows_service_api.h | 2 +- agents/wnx/src/main/check_mk_service.cpp | 41 +++++- agents/wnx/src/main/check_mk_service.h | 2 +- .../src/providers/perf_counter/perf_counter.cpp | 46 +----- agents/wnx/test_files/config/check_mk_dev.yml | 2 +- agents/wnx/watest/test-runperf.cpp | 162 +++++++++++++++++++++ agents/wnx/watest/watest.vcxproj | 1 + agents/wnx/watest/watest.vcxproj.filters | 3 + 18 files changed, 375 insertions(+), 56 deletions(-) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=eb3d9578a1…
5 years, 6 months
1
0
0
0
fixed lynter error
by Andreas Boesl
Module: check_mk Branch: master Commit: 3d17b8a4b44c1248b7e7aae14b172fa190f1c1ce URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3d17b8a4b44c12…
Author: Andreas Boesl <ab(a)mathias-kettner.de> Date: Wed Mar 27 13:15:26 2019 +0100 fixed lynter error Change-Id: I1753d780b745a00e70cbdef6cfb0622fa19060b0 --- agents/special/agent_hivemanager | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/agents/special/agent_hivemanager b/agents/special/agent_hivemanager index c5bb839..ff218b4 100755 --- a/agents/special/agent_hivemanager +++ b/agents/special/agent_hivemanager @@ -48,8 +48,7 @@ def get_data(address): sys.exit(2) -address = "https://%s/hm/api/v1/devices" % ip -data = get_data(address) +data = get_data("https://%s/hm/api/v1/devices" % ip) informations = [ 'hostName',
5 years, 6 months
1
0
0
0
agent_hivemanger: now uses python requests for the communication
by Andreas Boesl
Module: check_mk Branch: master Commit: fb7adbe809779b38f8696b04da75bffbe94df57a URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fb7adbe809779b…
Author: Andreas Boesl <ab(a)mathias-kettner.de> Date: Wed Mar 27 12:51:18 2019 +0100 agent_hivemanger: now uses python requests for the communication Change-Id: Ib0e0f2ac2157ce0de6b0d672b4f81bd3a557ce18 --- .werks/7252 | 11 +++++++++++ agents/special/agent_hivemanager | 23 ++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.werks/7252 b/.werks/7252 new file mode 100644 index 0000000..3103e67 --- /dev/null +++ b/.werks/7252 @@ -0,0 +1,11 @@ +Title: agent_hivemanger: now uses python requests for the communication +Level: 1 +Component: checks +Class: feature +Compatible: compat +Edition: cre +State: unknown +Version: 1.6.0i1 +Date: 1553590614 + + diff --git a/agents/special/agent_hivemanager b/agents/special/agent_hivemanager index 5ffed14..c5bb839 100755 --- a/agents/special/agent_hivemanager +++ b/agents/special/agent_hivemanager @@ -27,7 +27,7 @@ import sys import json import base64 -import urllib2 +import requests try: ip = sys.argv[1] @@ -38,20 +38,19 @@ except: sys.exit(2) -def get_url(address): - request = urllib2.Request(address) +def get_data(address): base64string = base64.encodestring('%s:%s' % (user, password)).replace('\n', '') - request.add_header("Authorization", "Basic %s" % base64string) - request.add_header("Content-Type", "application/json") + headers = {"Authorization": "Basic %s" % base64string, "Content-Type": "application/json"} try: - return urllib2.urlopen(request) - except urllib2.HTTPError, e: - print e + return requests.get(address, headers=headers).text + except Exception, e: + sys.stderr.write("Connection error: %s" % e) sys.exit(2) -print "<<<hivemanager_devices:sep(124)>>>" -url = "https://%s/hm/api/v1/devices" % ip +address = "https://%s/hm/api/v1/devices" % ip +data = get_data(address) + informations = [ 'hostName', 'clients', @@ -68,7 +67,9 @@ informations = [ 'location', 'networkPolicy', ] -for line in json.loads(get_url(url).read()): + +print "<<<hivemanager_devices:sep(124)>>>" +for line in json.loads(data): if line['upTime'] == '': line['upTime'] = "down" print "|".join(map(str, ["%s::%s" % (x, y) for x, y in line.items() if x in informations]))
5 years, 6 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
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