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
December
November
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
January 2018
----- 2024 -----
December 2024
November 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
10 participants
255 discussions
Start a n
N
ew thread
Updated a few Python modules.
by Sven Panne
Module: check_mk Branch: master Commit: 41cc0d0ce768b5820e9c261c40238672870e540b URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=41cc0d0ce768b5…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Wed Jan 24 11:27:49 2018 +0100 Updated a few Python modules. cffi-1.11.3 => cffi-1.11.4 Pillow-3.4.2 => Pillow-5.0.0 pycryptodome-3.4.7 => pycryptodomex-3.4.7 pykerberos-1.1.14 => pykerberos-1.2.1 pysnmp-4.3.5 => pysnmp-4.4.4 reportlab-3.3.0 => reportlab-3.4.0 tinkerforge-2.1.11 => tinkerforge-2.1.15 Change-Id: Iff1550e4c64cce5f05ac31644aec118796dbb645 --- omd/packages/python-modules/Makefile | 14 +++++++------- .../{Pillow-3.4.2.tar.gz => Pillow-5.0.0.tar.gz} | Bin 10814666 -> 14220993 bytes omd/packages/python-modules/src/cffi-1.11.3.tar.gz | Bin 436359 -> 0 bytes omd/packages/python-modules/src/cffi-1.11.4.tar.gz | Bin 0 -> 436857 bytes .../python-modules/src/pycryptodome-3.4.7.tar.gz | Bin 6483140 -> 0 bytes .../python-modules/src/pycryptodomex-3.4.7.tar.gz | Bin 0 -> 6483404 bytes .../python-modules/src/pykerberos-1.1.14.tar.gz | Bin 20454 -> 0 bytes .../python-modules/src/pykerberos-1.2.1.tar.gz | Bin 0 -> 24535 bytes .../python-modules/src/pysnmp-4.3.5.tar.gz | Bin 404793 -> 0 bytes .../python-modules/src/pysnmp-4.4.4.tar.gz | Bin 0 -> 436318 bytes .../python-modules/src/reportlab-3.3.0.tar.gz | Bin 1959255 -> 0 bytes .../python-modules/src/reportlab-3.4.0.tar.gz | Bin 0 -> 1995779 bytes .../python-modules/src/tinkerforge-2.1.11.tar.gz | Bin 134326 -> 0 bytes .../python-modules/src/tinkerforge-2.1.15.tar.gz | Bin 0 -> 191508 bytes 14 files changed, 7 insertions(+), 7 deletions(-) diff --git a/omd/packages/python-modules/Makefile b/omd/packages/python-modules/Makefile index bb69393..7684b8f 100644 --- a/omd/packages/python-modules/Makefile +++ b/omd/packages/python-modules/Makefile @@ -14,11 +14,11 @@ MODULES += setuptools-38.4.0.zip # needed by rrdtool bindings # Modules really needed on all platforms MODULES += pysphere-0.1.7.zip MODULES += pyasn1-0.4.2.tar.gz -MODULES += pycryptodome-3.4.7.tar.gz +MODULES += pycryptodomex-3.4.7.tar.gz MODULES += ordereddict-1.1.tar.gz # needed by pysmi MODULES += ply-3.10.tar.gz # needed by pysmi MODULES += pysmi-0.2.2.tar.gz # needed by EC (for trap translation) -MODULES += pysnmp-4.3.5.tar.gz # needed by EC (for trap translation) +MODULES += pysnmp-4.4.4.tar.gz # needed by EC (for trap translation) MODULES += setuptools-git-1.2.tar.gz # needed for pymssql MODULES += pymssql-2.1.3.tar.gz # needed for check_sql (together with freetds) @@ -42,10 +42,10 @@ MODULES += psycopg2-2.6.2.tar.gz # needed by check_sql MODULES += dicttoxml-1.7.4.tar.gz # needed by inventory XML export MODULES += pycparser-2.18.tar.gz # needed for cffi MODULES += enum34-1.1.6.tar.gz # needed for cffi -MODULES += cffi-1.11.3.tar.gz # needed by e.g. Pillow -MODULES += Pillow-3.4.2.tar.gz # needed by reportlab (pillow>=2.4.0) +MODULES += cffi-1.11.4.tar.gz # needed by e.g. Pillow +MODULES += Pillow-5.0.0.tar.gz # needed by reportlab (pillow>=2.4.0) MODULES += pip-9.0.1.tar.gz # needed by reportlab (pip>=1.4.1) -MODULES += reportlab-3.3.0.tar.gz # needed by reporting +MODULES += reportlab-3.4.0.tar.gz # needed by reporting MODULES += PyPDF2-1.26.0.tar.gz # needed by reporting MODULES += npyscreen-4.10.5.tar.gz # needed for mkbench @@ -104,10 +104,10 @@ MODULES+=requests-2.13.0.tar.gz # Has requests as dependency -> must be built after MODULES += pyOpenSSL-16.2.0.tar.gz # Added for check_bi_aggr with kerberos support -MODULES+=pykerberos-1.1.14.tar.gz +MODULES+=pykerberos-1.2.1.tar.gz MODULES+=requests-kerberos-0.11.0.tar.gz # Added for tinkerforge special agent -MODULES+=tinkerforge-2.1.11.tar.gz +MODULES+=tinkerforge-2.1.15.tar.gz # Added for check_sftp MODULES+=paramiko-2.1.2.tar.gz diff --git a/omd/packages/python-modules/src/Pillow-3.4.2.tar.gz b/omd/packages/python-modules/src/Pillow-5.0.0.tar.gz similarity index 55% rename from omd/packages/python-modules/src/Pillow-3.4.2.tar.gz rename to omd/packages/python-modules/src/Pillow-5.0.0.tar.gz index 4bbee5b..c9562c4 100644 Binary files a/omd/packages/python-modules/src/Pillow-3.4.2.tar.gz and b/omd/packages/python-modules/src/Pillow-5.0.0.tar.gz differ diff --git a/omd/packages/python-modules/src/cffi-1.11.3.tar.gz b/omd/packages/python-modules/src/cffi-1.11.3.tar.gz deleted file mode 100644 index fe8ca34..0000000 Binary files a/omd/packages/python-modules/src/cffi-1.11.3.tar.gz and /dev/null differ diff --git a/omd/packages/python-modules/src/cffi-1.11.4.tar.gz b/omd/packages/python-modules/src/cffi-1.11.4.tar.gz new file mode 100644 index 0000000..ccc37f1 Binary files /dev/null and b/omd/packages/python-modules/src/cffi-1.11.4.tar.gz differ diff --git a/omd/packages/python-modules/src/pycryptodome-3.4.7.tar.gz b/omd/packages/python-modules/src/pycryptodome-3.4.7.tar.gz deleted file mode 100644 index 4071f98..0000000 Binary files a/omd/packages/python-modules/src/pycryptodome-3.4.7.tar.gz and /dev/null differ diff --git a/omd/packages/python-modules/src/pycryptodomex-3.4.7.tar.gz b/omd/packages/python-modules/src/pycryptodomex-3.4.7.tar.gz new file mode 100644 index 0000000..b07e7af Binary files /dev/null and b/omd/packages/python-modules/src/pycryptodomex-3.4.7.tar.gz differ diff --git a/omd/packages/python-modules/src/pykerberos-1.1.14.tar.gz b/omd/packages/python-modules/src/pykerberos-1.1.14.tar.gz deleted file mode 100644 index 7ca5135..0000000 Binary files a/omd/packages/python-modules/src/pykerberos-1.1.14.tar.gz and /dev/null differ diff --git a/omd/packages/python-modules/src/pykerberos-1.2.1.tar.gz b/omd/packages/python-modules/src/pykerberos-1.2.1.tar.gz new file mode 100644 index 0000000..cac9db1 Binary files /dev/null and b/omd/packages/python-modules/src/pykerberos-1.2.1.tar.gz differ diff --git a/omd/packages/python-modules/src/pysnmp-4.3.5.tar.gz b/omd/packages/python-modules/src/pysnmp-4.3.5.tar.gz deleted file mode 100644 index ea3567a..0000000 Binary files a/omd/packages/python-modules/src/pysnmp-4.3.5.tar.gz and /dev/null differ diff --git a/omd/packages/python-modules/src/pysnmp-4.4.4.tar.gz b/omd/packages/python-modules/src/pysnmp-4.4.4.tar.gz new file mode 100644 index 0000000..723f170 Binary files /dev/null and b/omd/packages/python-modules/src/pysnmp-4.4.4.tar.gz differ diff --git a/omd/packages/python-modules/src/reportlab-3.3.0.tar.gz b/omd/packages/python-modules/src/reportlab-3.3.0.tar.gz deleted file mode 100644 index 351d74a..0000000 Binary files a/omd/packages/python-modules/src/reportlab-3.3.0.tar.gz and /dev/null differ diff --git a/omd/packages/python-modules/src/reportlab-3.4.0.tar.gz b/omd/packages/python-modules/src/reportlab-3.4.0.tar.gz new file mode 100644 index 0000000..21bf743 Binary files /dev/null and b/omd/packages/python-modules/src/reportlab-3.4.0.tar.gz differ diff --git a/omd/packages/python-modules/src/tinkerforge-2.1.11.tar.gz b/omd/packages/python-modules/src/tinkerforge-2.1.11.tar.gz deleted file mode 100644 index 6b0ac23..0000000 Binary files a/omd/packages/python-modules/src/tinkerforge-2.1.11.tar.gz and /dev/null differ diff --git a/omd/packages/python-modules/src/tinkerforge-2.1.15.tar.gz b/omd/packages/python-modules/src/tinkerforge-2.1.15.tar.gz new file mode 100644 index 0000000..6b782ca Binary files /dev/null and b/omd/packages/python-modules/src/tinkerforge-2.1.15.tar.gz differ
6 years, 10 months
1
0
0
0
Adapted test data format
by Simon Betz
Module: check_mk Branch: master Commit: 8f04af36686712a323decddb2ad7bf491aa6526a URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8f04af36686712…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Wed Jan 24 10:46:22 2018 +0100 Adapted test data format Change-Id: I891b807c392d7c0eb348f1f2cbf4e7f9d40e5f63 --- .../tree_new_large_ora_tablespaces_fixed_len | 82515 +------------------ .../tree_new_large_ora_tablespaces_variable_len | 82509 +----------------- .../tree_test_data/tree_old_large_ora_tablespaces | 82515 +------------------ 3 files changed, 3 insertions(+), 247536 deletions(-) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=8f04af3668…
6 years, 10 months
1
0
0
0
Win-agent: let std::vector manage its heap, part X
by Jukka Aro
Module: check_mk Branch: master Commit: c2695437069419a8bf83941d744cade0fe096b19 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c2695437069419…
Author: Jukka Aro <ja(a)mathias-kettner.de> Date: Wed Jan 24 10:29:35 2018 +0100 Win-agent: let std::vector manage its heap, part X Leave dynamic memory allocation to std::vector as it does it better than you do. --- agents/windows/SectionManager.cc | 28 +++++++++++++--------------- agents/windows/SectionManager.h | 11 ++++++++--- agents/windows/build_version | 2 +- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/agents/windows/SectionManager.cc b/agents/windows/SectionManager.cc index 48cefa4..421b644 100644 --- a/agents/windows/SectionManager.cc +++ b/agents/windows/SectionManager.cc @@ -35,8 +35,8 @@ std::string mapSectionName(const std::string §ionName) { } // namespace template <> -winperf_counter *from_string<winperf_counter *>(const WinApiAdaptor &winapi, - const std::string &value) { +winperf_counter from_string<winperf_counter>(const WinApiAdaptor &winapi, + const std::string &value) { size_t colonIdx = value.find_last_of(":"); if (colonIdx == std::string::npos) { fprintf(stderr, @@ -45,25 +45,23 @@ winperf_counter *from_string<winperf_counter *>(const WinApiAdaptor &winapi, value.c_str()); exit(1); } - winperf_counter *result = new winperf_counter(); - result->name = std::string(value.begin() + colonIdx + 1, value.end()); + std::string name(value.begin() + colonIdx + 1, value.end()); std::string base_id(value.begin(), value.begin() + colonIdx); - auto non_digit = std::find_if_not(base_id.begin(), base_id.end(), isdigit); + int id = 0; if (non_digit == base_id.end()) { - result->id = std::stoi(base_id); + id = std::stoi(base_id); } else { - result->id = resolveCounterName(winapi, base_id); - if (result->id == -1) { - delete result; + id = resolveCounterName(winapi, base_id); + if (id == -1) { throw StringConversionError( "No matching performance counter id found for " + value); } } - return result; + return {id, name}; } SectionManager::SectionManager(Configuration &config, @@ -120,11 +118,11 @@ bool SectionManager::useRealtimeMonitoring() const { } void SectionManager::loadDynamicSections() { - for (winperf_counter *counter : *_winperf_counters) { - if (counter->id != -1) { - addSection((new SectionWinperf(counter->name.c_str(), _env, _logger, - _winapi)) - ->withBase(counter->id)); + for (const auto &counter : *_winperf_counters) { + if (counter.id != -1) { + addSection( + (new SectionWinperf(counter.name, _env, _logger, _winapi)) + ->withBase(counter.id)); } } } diff --git a/agents/windows/SectionManager.h b/agents/windows/SectionManager.h index b6424ef..3b5b0d3 100644 --- a/agents/windows/SectionManager.h +++ b/agents/windows/SectionManager.h @@ -36,13 +36,18 @@ class WinApiAdaptor; // Configuration for section [winperf] struct winperf_counter { + winperf_counter(int id_, const std::string &name_) : id(id_), name(name_) {} int id; std::string name; }; +inline std::ostream &operator<<(std::ostream &out, const winperf_counter &wpc) { + return out << "(id = " << wpc.id << ", name = " << wpc.name << ")"; +} + template <> -winperf_counter *from_string<winperf_counter *>(const WinApiAdaptor &winapi, - const std::string &value); +winperf_counter from_string<winperf_counter>(const WinApiAdaptor &winapi, + const std::string &value); std::ostream &operator<<(std::ostream &out, const std::pair<std::string, std::string> &value); @@ -88,7 +93,7 @@ private: _realtime_sections; KeyedListConfigurable<std::string> _script_local_includes; KeyedListConfigurable<std::string> _script_plugin_includes; - ListConfigurable<std::vector<winperf_counter *>> _winperf_counters; + ListConfigurable<std::vector<winperf_counter>> _winperf_counters; const Environment &_env; Logger *_logger; const WinApiAdaptor &_winapi; diff --git a/agents/windows/build_version b/agents/windows/build_version index 5caf80a..dc3b4b1 100644 --- a/agents/windows/build_version +++ b/agents/windows/build_version @@ -1 +1 @@ -3074 +3076
6 years, 10 months
1
0
0
0
Removed TODO
by Simon Betz
Module: check_mk Branch: master Commit: f74fa0b3db86f129bcac01d89c2fcb353014b234 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f74fa0b3db86f1…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Wed Jan 24 10:25:04 2018 +0100 Removed TODO Change-Id: I0a8cf7a3bd98574b87df2fe950a507629c67cbed --- web/plugins/wato/inventory.py | 1 - 1 file changed, 1 deletion(-) diff --git a/web/plugins/wato/inventory.py b/web/plugins/wato/inventory.py index 0f98462..52aac82 100644 --- a/web/plugins/wato/inventory.py +++ b/web/plugins/wato/inventory.py @@ -150,7 +150,6 @@ register_rule(group, match = "dict", ) -#TODO register_rule(group, "status_data_inventory", title=_("Do status data inventory"),
6 years, 10 months
1
0
0
0
5605 HW/SW Inventory: Status data can be integrated into HW/ SW Inventory tree
by Simon Betz
Module: check_mk Branch: master Commit: bd41470f5934237d981c79eb9d50e349d6daaf83 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bd41470f593423…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Wed Dec 13 16:43:52 2017 +0100 5605 HW/SW Inventory: Status data can be integrated into HW/SW Inventory tree Change-Id: I1ad57ee9afa24950f2f0a6f9375da4a75ad2ee7f --- .werks/5605 | 99 ++++++++++++++++++++++ cmk_base/checking.py | 18 ++++ cmk_base/checks.py | 2 + cmk_base/default_config/base.py | 1 + cmk_base/inventory.py | 98 +++++++++++++-------- lib/structured_data.py | 2 +- tests/cmk/structured_data/test_structured_data.py | 17 ++-- tests/cmk/structured_data/tree_test_data/tree_a | 1 - tests/cmk/structured_data/tree_test_data/tree_b | 1 - tests/cmk/structured_data/tree_test_data/tree_inv | 1 + .../cmk/structured_data/tree_test_data/tree_status | 1 + web/htdocs/inventory.py | 17 +++- web/plugins/wato/inventory.py | 11 +++ 13 files changed, 225 insertions(+), 44 deletions(-) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=bd41470f59…
6 years, 10 months
1
0
0
0
Windows: allow single quotes in MRPE plugin path
by Jukka Aro
Module: check_mk Branch: master Commit: b8ad11340307fdd0456876d08561ae5bcc6a3c27 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b8ad11340307fd…
Author: Jukka Aro <ja(a)mathias-kettner.de> Date: Tue Jan 23 16:35:19 2018 +0100 Windows: allow single quotes in MRPE plugin path Werk #5698 allowed to give MRPE plugin paths containing spaces in double quotes. Allow giving MRPE plugin paths also in single quotes as this seems to conform to the "common Windows behaviour" (whatever that might be). --- agents/windows/build_version | 2 +- agents/windows/sections/SectionMRPE.cc | 50 ++++++++++------ agents/windows/stringutil.cc | 10 ++++ agents/windows/stringutil.h | 76 +++++++++++++++++++++++-- agents/windows/test/sections/SectionMRPETest.cc | 18 +++++- 5 files changed, 130 insertions(+), 26 deletions(-) diff --git a/agents/windows/build_version b/agents/windows/build_version index 5fd86fd..5caf80a 100644 --- a/agents/windows/build_version +++ b/agents/windows/build_version @@ -1 +1 @@ -3072 +3074 diff --git a/agents/windows/sections/SectionMRPE.cc b/agents/windows/sections/SectionMRPE.cc index 376f49d..e528eb9 100644 --- a/agents/windows/sections/SectionMRPE.cc +++ b/agents/windows/sections/SectionMRPE.cc @@ -140,12 +140,35 @@ bool SectionMRPE::produceOutputInner(std::ostream &out) { namespace { -void cleanQuotes(string &s) { - if (s.front() == '"' && s.back() == '"') { +enum class QuoteType { none, singleQuoted, doubleQuoted }; + +inline bool quoted(QuoteType qt) { return qt != QuoteType::none; } + +inline QuoteType getQuoteType(const string &s) { + if (s.front() == '\'' && s.back() == '\'') { + return QuoteType::singleQuoted; + } else if (s.front() == '"' && s.back() == '"') { + return QuoteType::doubleQuoted; + } else { + return QuoteType::none; + } +} + +void removeQuotes(string &s, QuoteType qt) { + if (quoted(qt)) { s = s.substr(1, s.size() - 2); } } +void wrapInQuotes(string &s, QuoteType qt) { + if (quoted(qt)) { + char quote = (qt == QuoteType::singleQuoted) ? '\'' : '"'; + s.reserve(s.size() + 2); + s.insert(0, 1, quote); + s.push_back(quote); + } +} + void normalizeCommand(string &cmd) { if (isPathRelative(cmd)) { Environment *env = Environment::instance(); @@ -154,16 +177,10 @@ void normalizeCommand(string &cmd) { } ltrim(cmd); rtrim(cmd); - bool quoted = cmd.front() == '"' && cmd.back() == '"'; - if (quoted) { - cleanQuotes(cmd); - } + auto quoteType = getQuoteType(cmd); + removeQuotes(cmd, quoteType); cmd.insert(0, env->agentDirectory() + "\\"); - if (quoted) { - cmd.reserve(cmd.size() + 2); - cmd.insert(0, 1, '"'); - cmd.push_back('"'); - } + wrapInQuotes(cmd, quoteType); } } @@ -171,10 +188,7 @@ void normalizeCommand(string &cmd) { template <> mrpe_entry from_string<mrpe_entry>(const WinApiAdaptor &, const string &value) { - regex re("(\"([^\"]+)\"|[^\" ]+)"); - vector<string> tokens{ - sregex_token_iterator{value.cbegin(), value.cend(), re, 1}, - sregex_token_iterator{}}; + vector<string> tokens = tokenizePossiblyQuoted(value); if (tokens.size() < 2) { throw StringConversionError( @@ -182,9 +196,9 @@ mrpe_entry from_string<mrpe_entry>(const WinApiAdaptor &, const string &value) { "Format: SERVICEDESC COMMANDLINE"); } - auto plugin_name = tokens[1]; // Intentional copy + auto plugin_name = tokens[1]; // Intentional copy // compute plugin name, drop directory part - cleanQuotes(plugin_name); + removeQuotes(plugin_name, getQuoteType(plugin_name)); for (const auto &delimiter : {"/", "\\"}) { auto pos = plugin_name.find_last_of(delimiter); @@ -206,7 +220,7 @@ mrpe_entry from_string<mrpe_entry>(const WinApiAdaptor &, const string &value) { } auto &service_description = tokens[0]; - cleanQuotes(service_description); + removeQuotes(service_description, getQuoteType(service_description)); return {"", command_line, plugin_name, service_description}; } diff --git a/agents/windows/stringutil.cc b/agents/windows/stringutil.cc index d89efce..67e5060 100644 --- a/agents/windows/stringutil.cc +++ b/agents/windows/stringutil.cc @@ -79,6 +79,16 @@ char *next_word(char **line) { return 0; } +template <> +std::regex possiblyQuotedRegex<char>() { + return std::regex{"(\"([^\"]+)\"|'([^']+)'|[^\" \\t]+)"}; +} + +template <> +std::wregex possiblyQuotedRegex<wchar_t>() { + return std::wregex{L"(\"([^\"]+)\"|'([^']+)'|[^\" \\t]+)"}; +} + unsigned long long string_to_llu(const char *s) { unsigned long long value = 0; unsigned long long mult = 1; diff --git a/agents/windows/stringutil.h b/agents/windows/stringutil.h index b8cac68..15901db 100644 --- a/agents/windows/stringutil.h +++ b/agents/windows/stringutil.h @@ -61,11 +61,67 @@ inline void rtrim(std::string &s) { std::vector<const char *> split_line(char *pos, int (*split_pred)(int)); char *next_word(char **line); -inline std::vector<std::string> tokenize(const std::string &input, - const std::string &delimiter) { - regex re(delimiter); - sregex_token_iterator first{input.cbegin(), input.cend(), re, -1}, last; - return {first, last}; +template <typename CharT> +inline std::vector<std::basic_string<CharT>> tokenizeBase( + const std::basic_string<CharT> &input, const std::basic_regex<CharT> &re, + int submatch) { + return {std::regex_token_iterator< + typename std::basic_string<CharT>::const_iterator>{ + input.cbegin(), input.cend(), re, submatch}, + std::regex_token_iterator< + typename std::basic_string<CharT>::const_iterator>{}}; +} + +/** + * Split a string into tokens at given delimiter. + * + * @param[in] input The string to be split + * @param[in] delimiter The delimiter to split at + * @return A vector of tokens + */ +template <typename CharT> +inline std::vector<std::basic_string<CharT>> tokenize( + const std::basic_string<CharT> &input, + const std::basic_string<CharT> &delimiter) { + return tokenizeBase(input, std::basic_regex<CharT>{delimiter}, -1); +} + +/** + * Split a string into tokens at given delimiter. + * + * @param[in] input The string to be split + * @param[in] delimiter The delimiter to split at + * @return A vector of tokens + */ +template <typename CharT> +inline std::vector<std::basic_string<CharT>> tokenize( + const std::basic_string<CharT> &input, const CharT *delimiter) { + return tokenizeBase(input, std::basic_regex<CharT>{delimiter}, -1); +} + +template <typename CharT> +inline std::basic_regex<CharT> possiblyQuotedRegex(); +template <> +std::regex possiblyQuotedRegex<char>(); +template <> +std::wregex possiblyQuotedRegex<wchar_t>(); + +/** + * Split a string into tokens at space or tab. Substrings enclosed in single or + * double quotes are not split and the enclosing quotes are retained in the + * returned tokens. + * + * Example: () + * input: This\t'is \t an' "example sentence." + * returned tokens: This, 'is \t an', "example sentence." + * + * @param[in] input The string to be split + * @return A vector of tokens + */ +template <typename CharT> +inline std::vector<std::basic_string<CharT>> tokenizePossiblyQuoted( + const std::basic_string<CharT> &input) { + return tokenizeBase(input, possiblyQuotedRegex<CharT>(), 1); } unsigned long long string_to_llu(const char *s); @@ -130,6 +186,16 @@ std::basic_string<SeparatorT> join(const std::vector<ValueT> &input, return join(input.begin(), input.end(), sep); } +/** + * Check if a path is relative or absolute. Works with both Windows and Unix + * style paths with backslash and forward slash separators, respectively. The + * presence of Windows drive letter does not affect the result for absolute or + * relative paths. Absolute UNC paths starting with either '\\' or '//' are + * recognized as absolute paths. + + * param[in] path The path to be checked + * return True if the path is relative, False if it is absolute + */ inline bool isPathRelative(const std::string &path) { const std::array<regex, 2> regexes{ // Windows absolute path (with/without drive letter or UNC): diff --git a/agents/windows/test/sections/SectionMRPETest.cc b/agents/windows/test/sections/SectionMRPETest.cc index 460d495..1c20390 100644 --- a/agents/windows/test/sections/SectionMRPETest.cc +++ b/agents/windows/test/sections/SectionMRPETest.cc @@ -50,7 +50,7 @@ TEST_F(wa_SectionMRPETest, from_string__relative_path_params_no_quotes) { } TEST_F(wa_SectionMRPETest, - from_string__absolute_path__with_spaces_params_with_quotes) { + from_string__absolute_path__with_spaces_params_with_double_quotes) { const std::string input{ "\"foo bar\" \"\\baz qux\\quux\" corge \"grault garply\""}; const mrpe_entry expected{"", "\"\\baz qux\\quux\" corge \"grault garply\"", @@ -58,7 +58,8 @@ TEST_F(wa_SectionMRPETest, ASSERT_EQ(expected, from_string<mrpe_entry>(_mockwinapi, input)); } -TEST_F(wa_SectionMRPETest, from_string__relative_path_params_with_quotes) { +TEST_F(wa_SectionMRPETest, + from_string__relative_path_params_with_double_quotes) { const std::string cwd{"C:\\corge"}; EXPECT_CALL(_mockwinapi, GetCurrentDirectoryA(32767, _)) .WillOnce(DoAll(SetArrayArgument<1>(cwd.cbegin(), cwd.cend()), @@ -69,3 +70,16 @@ TEST_F(wa_SectionMRPETest, from_string__relative_path_params_with_quotes) { "foo"}; ASSERT_EQ(expected, from_string<mrpe_entry>(_mockwinapi, input)); } + +TEST_F(wa_SectionMRPETest, + from_string__relative_path_params_with_single_quotes) { + const std::string cwd{"C:\\corge"}; + EXPECT_CALL(_mockwinapi, GetCurrentDirectoryA(32767, _)) + .WillOnce(DoAll(SetArrayArgument<1>(cwd.cbegin(), cwd.cend()), + Return(cwd.size()))); + ::Environment testEnv{true, false, &_mocklogger, _mockwinapi}; + const std::string input{"foo 'bar baz\\qux' quux"}; + const mrpe_entry expected{"", "'C:\\corge\\bar baz\\qux' quux", "qux", + "foo"}; + ASSERT_EQ(expected, from_string<mrpe_entry>(_mockwinapi, input)); +}
6 years, 10 months
1
0
0
0
Adapted test
by Simon Betz
Module: check_mk Branch: master Commit: 29a803a5dbc00c6953926f759d51dae7cbb30c29 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=29a803a5dbc00c…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Wed Jan 24 08:53:06 2018 +0100 Adapted test Change-Id: If5bfd9e1818a1356737e51f6ab88e6233c3f9380 --- tests/cmk/structured_data/test_structured_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cmk/structured_data/test_structured_data.py b/tests/cmk/structured_data/test_structured_data.py index 1a9c65f..a768d28 100644 --- a/tests/cmk/structured_data/test_structured_data.py +++ b/tests/cmk/structured_data/test_structured_data.py @@ -539,7 +539,7 @@ def test_structured_data_StructuredDataTree_building_tree(): (("tree_old_large_ora_tablespaces", "tree_new_large_ora_tablespaces_fixed_len", "tree_new_large_ora_tablespaces_variable_len"), - (0.8, 0.5, 0.002), + (1.2, 0.5, 0.002), (82523, 82523, 82517), ((0, 16272, 0), (16270, 0, 16272)), ),
6 years, 10 months
1
0
0
0
Fixed not existing inventory tree handling
by Simon Betz
Module: check_mk Branch: master Commit: 9c161578d42e67896d3228555820a3b110ac6f3c URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9c161578d42e67…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Tue Jan 23 15:41:56 2018 +0100 Fixed not existing inventory tree handling Change-Id: I765bbc40a3aa2e55b4cf2024f2ff0c00ddca9406 --- web/htdocs/inventory.py | 8 +++++--- web/plugins/views/inventory.py | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/htdocs/inventory.py b/web/htdocs/inventory.py index e2709f0..a42de0e 100644 --- a/web/htdocs/inventory.py +++ b/web/htdocs/inventory.py @@ -105,18 +105,18 @@ def sort_children(children): def load_tree(hostname): # Load data of a host, cache it in the current HTTP request if not hostname: - return {} + return None inventory_tree_cache = html.get_cached("inventory") if not inventory_tree_cache: - inventory_tree_cache = {} + inventory_tree_cache = StructuredDataTree() html.set_cache("inventory", inventory_tree_cache) if hostname in inventory_tree_cache: inventory_tree = inventory_tree_cache[hostname] else: if '/' in hostname: - return StructuredDataTree() # just for security reasons + return None # just for security reasons cache_path = "%s/inventory/%s" % (cmk.paths.var_dir, hostname) inventory_tree = StructuredDataTree().load_from(cache_path) inventory_tree_cache[hostname] = inventory_tree @@ -238,6 +238,8 @@ def _inventory_of_host(host_name, request): raise MKAuthException(_("Sorry, you are not allowed to access the host %s.") % host_name) inventory_tree = load_tree(host_name) + if not inventory_tree: + return {} if "paths" in request: parsed_paths = [] for path in request["paths"]: diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py index 55f1a87..c05cafb 100644 --- a/web/plugins/views/inventory.py +++ b/web/plugins/views/inventory.py @@ -977,6 +977,8 @@ def _create_view_enabled_check_func(invpath): if context["host"] == "": return False struct_tree = inventory.load_tree(context["host"]) + if not struct_tree: + return False if struct_tree.is_empty(): return False parsed_path, unused_key = inventory.parse_tree_path(invpath)
6 years, 10 months
1
0
0
0
Fixed typo
by Simon Betz
Module: check_mk Branch: master Commit: f7952cd728670840e3bf2274b9ea2bee26fb8431 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f7952cd7286708…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Tue Jan 23 15:43:52 2018 +0100 Fixed typo Change-Id: I531bd94e09a722a7651b3cab381757c51900ed91 --- web/htdocs/inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/htdocs/inventory.py b/web/htdocs/inventory.py index a42de0e..020338d 100644 --- a/web/htdocs/inventory.py +++ b/web/htdocs/inventory.py @@ -109,7 +109,7 @@ def load_tree(hostname): inventory_tree_cache = html.get_cached("inventory") if not inventory_tree_cache: - inventory_tree_cache = StructuredDataTree() + inventory_tree_cache = {} html.set_cache("inventory", inventory_tree_cache) if hostname in inventory_tree_cache:
6 years, 10 months
1
0
0
0
Refactored HW/SW Inventory: Use composite pattern for tree structure und visitor pattern for tree rendering
by Simon Betz
Module: check_mk Branch: master Commit: 0407622bedcf53918771392595ffe14c92845c44 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0407622bedcf53…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Thu Oct 5 15:49:25 2017 +0200 Refactored HW/SW Inventory: Use composite pattern for tree structure und visitor pattern for tree rendering Change-Id: I192b62e6e67c77d0b4a950ba1b769f575bbe98e2 --- cmk_base/checking.py | 1 - cmk_base/inventory.py | 180 +- lib/structured_data.py | 1050 + tests/cmk/structured_data/test_structured_data.py | 628 + tests/cmk/structured_data/tree_test_data/tree_a | 1 + tests/cmk/structured_data/tree_test_data/tree_b | 1 + .../tree_test_data/tree_new_addresses | 1 + .../tree_new_addresses_arrays_memory | 1 + .../structured_data/tree_test_data/tree_new_arrays | 1 + .../structured_data/tree_test_data/tree_new_heute | 16652 ++++ .../tree_test_data/tree_new_interfaces | 6183 ++ .../tree_new_large_ora_tablespaces_fixed_len | 82514 +++++++++++++++++++ .../tree_new_large_ora_tablespaces_variable_len | 82508 ++++++++++++++++++ .../structured_data/tree_test_data/tree_new_memory | 1 + .../tree_test_data/tree_old_addresses | 1 + .../tree_old_addresses_arrays_memory | 1 + .../structured_data/tree_test_data/tree_old_arrays | 1 + .../structured_data/tree_test_data/tree_old_heute | 16653 ++++ .../tree_test_data/tree_old_interfaces | 6282 ++ .../tree_test_data/tree_old_large_ora_tablespaces | 82514 +++++++++++++++++++ .../structured_data/tree_test_data/tree_old_memory | 1 + web/htdocs/inventory.py | 426 +- web/htdocs/views.py | 28 +- web/plugins/views/inventory.py | 667 +- web/plugins/visuals/inventory.py | 12 +- 25 files changed, 295548 insertions(+), 760 deletions(-) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=0407622bed…
6 years, 10 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
26
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
Results per page:
10
25
50
100
200