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
June 2018
----- 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
179 discussions
Start a n
N
ew thread
Revert "Revert "added WK5818""
by Andreas
Module: check_mk Branch: master Commit: 4d98cac478d017ecb4b568bff713cd230333c705 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4d98cac478d017…
Author: Andreas <ab(a)mathias-kettner.de> Date: Fri Jun 8 08:57:17 2018 +0200 Revert "Revert "added WK5818"" This reverts commit fc68605ce7d06882b72169fb4de7b234fc58ff6b. Change-Id: I550e6dce667e2a3f1ebf12d2fda5d3f1df6859f3 --- .werks/5818 | 9 +++++++++ cmk_base/data_sources/__init__.py | 5 +++++ cmk_base/data_sources/abstract.py | 39 -------------------------------------- cmk_base/data_sources/tcp.py | 40 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 39 deletions(-) diff --git a/.werks/5818 b/.werks/5818 new file mode 100644 index 0000000..d184b2e --- /dev/null +++ b/.werks/5818 @@ -0,0 +1,9 @@ +Title: Fixed "unknown agent version" message in Check_MK check, shown by cluster hosts +Level: 1 +Component: checks +Compatible: compat +Edition: cre +Version: 1.6.0i1 +Date: 1528389637 +Class: fix + diff --git a/cmk_base/data_sources/__init__.py b/cmk_base/data_sources/__init__.py index 3a03826..af4f586 100644 --- a/cmk_base/data_sources/__init__.py +++ b/cmk_base/data_sources/__init__.py @@ -107,6 +107,11 @@ class DataSources(object): def _initialize_data_sources(self): self._sources = {} + if config.is_cluster(self._hostname): + # Cluster hosts do not have any actual data sources + # Instead all data is provided by the nodes + return + self._initialize_agent_based_data_sources() self._initialize_snmp_data_sources() self._initialize_management_board_data_sources() diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py index 1a599ac..7afea91 100644 --- a/cmk_base/data_sources/abstract.py +++ b/cmk_base/data_sources/abstract.py @@ -726,45 +726,6 @@ class CheckMKAgentDataSource(DataSource): return agent_info - def _is_expected_agent_version(self, agent_version, expected_version): - try: - if agent_version in [ '(unknown)', None, 'None' ]: - return False - - if type(expected_version) == str and expected_version != agent_version: - return False - - elif type(expected_version) == tuple and expected_version[0] == 'at_least': - spec = expected_version[1] - if cmk_base.utils.is_daily_build_version(agent_version) and 'daily_build' in spec: - expected = int(spec['daily_build'].replace('.', '')) - - branch = cmk_base.utils.branch_of_daily_build(agent_version) - if branch == "master": - agent = int(agent_version.replace('.', '')) - - else: # branch build (e.g. 1.2.4-2014.06.01) - agent = int(agent_version.split('-')[1].replace('.', '')) - - if agent < expected: - return False - - elif 'release' in spec: - if cmk_base.utils.is_daily_build_version(agent_version): - return False - - if cmk_base.utils.parse_check_mk_version(agent_version) \ - < cmk_base.utils.parse_check_mk_version(spec['release']): - return False - - return True - except Exception, e: - if cmk.debug.enabled(): - raise - raise MKGeneralException("Unable to check agent version (Agent: %s Expected: %s, Error: %s)" % - (agent_version, expected_version, e)) - - class ManagementBoardDataSource(DataSource): """Abstract base class for all data sources that work with the management board configuration""" diff --git a/cmk_base/data_sources/tcp.py b/cmk_base/data_sources/tcp.py index 1572425..2c62226 100644 --- a/cmk_base/data_sources/tcp.py +++ b/cmk_base/data_sources/tcp.py @@ -32,6 +32,7 @@ import subprocess import cmk.debug from cmk.exceptions import MKTerminate +import cmk_base.utils as utils import cmk_base.console as console import cmk_base.config as config import cmk_base.checks as checks @@ -194,6 +195,45 @@ class TCPDataSource(CheckMKAgentDataSource): return status, output, perfdata + def _is_expected_agent_version(self, agent_version, expected_version): + try: + if agent_version in [ '(unknown)', None, 'None' ]: + return False + + if type(expected_version) == str and expected_version != agent_version: + return False + + elif type(expected_version) == tuple and expected_version[0] == 'at_least': + spec = expected_version[1] + if utils.is_daily_build_version(agent_version) and 'daily_build' in spec: + expected = int(spec['daily_build'].replace('.', '')) + + branch = utils.branch_of_daily_build(agent_version) + if branch == "master": + agent = int(agent_version.replace('.', '')) + + else: # branch build (e.g. 1.2.4-2014.06.01) + agent = int(agent_version.split('-')[1].replace('.', '')) + + if agent < expected: + return False + + elif 'release' in spec: + if utils.is_daily_build_version(agent_version): + return False + + if utils.parse_check_mk_version(agent_version) \ + < utils.parse_check_mk_version(spec['release']): + return False + + return True + except Exception, e: + if cmk.debug.enabled(): + raise + raise MKGeneralException("Unable to check agent version (Agent: %s Expected: %s, Error: %s)" % + (agent_version, expected_version, e)) + + def _decrypt_package(self, encrypted_pkg, encryption_key): from Cryptodome.Cipher import AES from hashlib import md5
6 years
1
0
0
0
fixed another missing import, thanks pylint
by Andreas
Module: check_mk Branch: master Commit: ebf77ffcc2ce6c965c515374838c7e89088e0158 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ebf77ffcc2ce6c…
Author: Andreas <ab(a)mathias-kettner.de> Date: Fri Jun 8 09:03:58 2018 +0200 fixed another missing import, thanks pylint Change-Id: I44b7b51b9fc924a808ba3ca652decd8c079f0b9f --- cmk_base/data_sources/tcp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmk_base/data_sources/tcp.py b/cmk_base/data_sources/tcp.py index 2c62226..31881a5 100644 --- a/cmk_base/data_sources/tcp.py +++ b/cmk_base/data_sources/tcp.py @@ -36,7 +36,7 @@ import cmk_base.utils as utils import cmk_base.console as console import cmk_base.config as config import cmk_base.checks as checks -from cmk_base.exceptions import MKAgentError, MKEmptyAgentData +from cmk_base.exceptions import MKAgentError, MKEmptyAgentData, MKGeneralException from .abstract import DataSource, CheckMKAgentDataSource
6 years
1
0
0
0
By popular demand: Enable mixed-indentation check.
by Sven Panne
Module: check_mk Branch: master Commit: 7a795efec375bc6426234ae36e46bc5011ab4091 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7a795efec375bc…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Fri Jun 8 08:58:43 2018 +0200 By popular demand: Enable mixed-indentation check. Change-Id: I7b0d83c79b86d9a1e34d686a0e4bc1d91debb693 --- active_checks/check_cpu_peaks | 56 ++++++++++++++++++++-------------------- active_checks/check_notify_count | 2 +- bin/mkbench | 6 ++--- cmk_base/data_sources/snmp.py | 2 +- omd/packages/omd/omd | 32 +++++++++++------------ tests/pylint/pylintrc | 1 - 6 files changed, 49 insertions(+), 50 deletions(-) diff --git a/active_checks/check_cpu_peaks b/active_checks/check_cpu_peaks index 2baf6af..44c0c0e 100755 --- a/active_checks/check_cpu_peaks +++ b/active_checks/check_cpu_peaks @@ -112,10 +112,10 @@ try: datasets.append(data[1]) step_secs = data[0] - def sumsum(x): - if None in x: - return None - return int(sum([y for y in x])) + def sumsum(x): + if None in x: + return None + return int(sum([y for y in x])) #util_total = map(lambda x: int(sum([y for y in x if y != None])), util_total = map(sumsum, zip(datasets[0], datasets[1], datasets[2])) @@ -124,36 +124,36 @@ try: peak_time = time.localtime(fromtime + step_secs * util_total.index(cpu_peak)) if opt_verbose: - for idx, x in enumerate(datasets[0]): - sys.stdout.write("idx: %d " % idx) - sys.stdout.write("%s\t" % int(datasets[0][idx] or -1)) - sys.stdout.write("%s\t" % int(datasets[1][idx] or -1)) - sys.stdout.write("%s\n" % int(datasets[2][idx] or -1)) + for idx, x in enumerate(datasets[0]): + sys.stdout.write("idx: %d " % idx) + sys.stdout.write("%s\t" % int(datasets[0][idx] or -1)) + sys.stdout.write("%s\t" % int(datasets[1][idx] or -1)) + sys.stdout.write("%s\n" % int(datasets[2][idx] or -1)) if is_windows: - info = [ "CPU utilization from %s until %s" %\ - (time.strftime("%b %d %H:%M:%S", time.localtime(fromtime)), - time.strftime("%b %d %H:%M:%S", time.localtime(untiltime))) ] + info = [ "CPU utilization from %s until %s" %\ + (time.strftime("%b %d %H:%M:%S", time.localtime(fromtime)), + time.strftime("%b %d %H:%M:%S", time.localtime(untiltime))) ] else: - info = [ "CPU utilization (user, system, wait) from %s until %s" %\ - (time.strftime("%b %d %H:%M:%S", time.localtime(fromtime)), - time.strftime("%b %d %H:%M:%S", time.localtime(untiltime))) ] + info = [ "CPU utilization (user, system, wait) from %s until %s" %\ + (time.strftime("%b %d %H:%M:%S", time.localtime(fromtime)), + time.strftime("%b %d %H:%M:%S", time.localtime(untiltime))) ] if cpu_peak: - info.append("Highest Peak of %d%% at %s" % (cpu_peak, time.strftime("%b %d %H:%M:%S", peak_time))) - state = 0 - if crit_level and cpu_peak <= crit_level: - info.append("less than %d (!!)" % crit_level) - state = 2 - elif warn_level and cpu_peak <= warn_level: - info.append("less than %d (!)" % warn_level) - state = 1 - sys.stdout.write("%s\n" % ", ".join(info)) - sys.exit(state) + info.append("Highest Peak of %d%% at %s" % (cpu_peak, time.strftime("%b %d %H:%M:%S", peak_time))) + state = 0 + if crit_level and cpu_peak <= crit_level: + info.append("less than %d (!!)" % crit_level) + state = 2 + elif warn_level and cpu_peak <= warn_level: + info.append("less than %d (!)" % warn_level) + state = 1 + sys.stdout.write("%s\n" % ", ".join(info)) + sys.exit(state) else: - info.append("No data available in time period") - state = 0 - sys.stdout.write("%s\n" % ": ".join(info)) + info.append("No data available in time period") + state = 0 + sys.stdout.write("%s\n" % ": ".join(info)) sys.exit(state) diff --git a/active_checks/check_notify_count b/active_checks/check_notify_count index cb581ea..ed03b55 100755 --- a/active_checks/check_notify_count +++ b/active_checks/check_notify_count @@ -71,7 +71,7 @@ for o,a in opts: usage() sys.exit(0) elif o == '-r': - timerange = int(a) + timerange = int(a) elif o == '-w': warn = int(a) elif o == '-c': diff --git a/bin/mkbench b/bin/mkbench index 34154e3..bfdc457 100755 --- a/bin/mkbench +++ b/bin/mkbench @@ -730,8 +730,8 @@ class TestRunner(threading.Thread): "number of CPUs (%d)." % (m.cpu_load[1], self.test.system_info.cpu_count)) # Check memory threshold. There are different values provided by psutil. - # this value sounds good to me for testing. - if m.memory.available < 100*1024*1024: + # this value sounds good to me for testing. + if m.memory.available < 100*1024*1024: raise MKFailTestCase("There is only %s memory available." % (fmt_bytes(m.memory.available))) @@ -757,7 +757,7 @@ class TestRunner(threading.Thread): if m.cpu_load[0] > self.test.system_info.cpu_count * 0.2: return - if m.memory.percent > 10: + if m.memory.percent > 10: return if m.site_stats and m.site_stats["helper_usage_cmk"]*100 > 10: diff --git a/cmk_base/data_sources/snmp.py b/cmk_base/data_sources/snmp.py index 746b193..9efd554 100644 --- a/cmk_base/data_sources/snmp.py +++ b/cmk_base/data_sources/snmp.py @@ -172,7 +172,7 @@ class SNMPDataSource(DataSource): def _execute(self): - import cmk_base.inventory_plugins + import cmk_base.inventory_plugins self._verify_ipaddress() diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd index b2482af..bac0d7f 100644 --- a/omd/packages/omd/omd +++ b/omd/packages/omd/omd @@ -278,7 +278,7 @@ def user_confirms(title, message, relpath, yes_choice, yes_text, no_choice, no_t if choice == "abort": bail_out("Update aborted.") elif choice == "shell": - thedir = "/".join(user_path.split("/")[:-1]) + thedir = "/".join(user_path.split("/")[:-1]) sys.stdout.write("\n Starting BASH. Type CTRL-D to continue.\n\n") os.system("cd '%s' ; bash -i" % thedir) else: @@ -747,7 +747,7 @@ def create_skeleton_files(sitename, dir): continue if dirpath == "tmp" or dirpath.startswith("tmp/"): continue - create_skeleton_file(skelroot, sitedir, dirpath + "/" + entry, replacements) + create_skeleton_file(skelroot, sitedir, dirpath + "/" + entry, replacements) def delete_user_file(user_path): if not os.path.islink(user_path) and os.path.isdir(user_path): @@ -1741,15 +1741,15 @@ def check_status(sitename, display=True, daemon=None, bare=False): state = os.system("%s/%s status >/dev/null 2>&1" % (rc_dir, script)) >> 8 if display and (state != 5 or opt_verbose): - if bare: - sys.stdout.write(komponent + " ") - else: - sys.stdout.write("%-16s" % (komponent + ":")) - sys.stdout.write(tty_bold) + if bare: + sys.stdout.write(komponent + " ") + else: + sys.stdout.write("%-16s" % (komponent + ":")) + sys.stdout.write(tty_bold) - if bare: - if state != 5 or opt_verbose: - sys.stdout.write("%d\n" % state) + if bare: + if state != 5 or opt_verbose: + sys.stdout.write("%d\n" % state) if state == 0: if display and not bare: @@ -1779,10 +1779,10 @@ def check_status(sitename, display=True, daemon=None, bare=False): exit_code = 2 ovstate = tty_yellow + "partially running" if display: - if bare: - sys.stdout.write("OVERALL %d\n" % exit_code) - else: - sys.stdout.write("-----------------------\n") + if bare: + sys.stdout.write("OVERALL %d\n" % exit_code) + else: + sys.stdout.write("-----------------------\n") sys.stdout.write("Overall state: %s\n" % (tty_bold + ovstate + tty_normal)) return exit_code @@ -2498,7 +2498,7 @@ def main_uninstall(args, options=None): for path in [ g_info["OMD_PHYSICAL_BASE"], "/omd", - g_info["APACHE_CONF_DIR"] + "/zzz_omd.conf", + g_info["APACHE_CONF_DIR"] + "/zzz_omd.conf", "/etc/init.d/omd", "/usr/bin/omd" ]: shutil.rmtree(path, ignore_errors=True) @@ -3262,7 +3262,7 @@ def main_umount(args, options=None): continue sys.stdout.write("%sUnmounting tmpfs of site %s%s..." % (tty_bold, site, tty_normal)) - sys.stdout.flush() + sys.stdout.flush() if not unmount_tmpfs(site, False, kill="kill" in options): sys.stdout.write(tty_error + "\n") diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc index 084ab99..4225570 100644 --- a/tests/pylint/pylintrc +++ b/tests/pylint/pylintrc @@ -49,7 +49,6 @@ disable= logging-not-lazy, misplaced-comparison-constant, missing-docstring, - mixed-indentation, multiple-imports, multiple-statements, no-else-return,
6 years
1
0
0
0
Fix dependencies of core-related modules, part 6.
by Sven Panne
Module: check_mk Branch: master Commit: 7371d09d4a49defcfbab0d3bbdc490f616a9a7eb URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7371d09d4a49de…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Thu Jun 7 12:58:58 2018 +0200 Fix dependencies of core-related modules, part 6. The hook for precompilation is now passed down the call hierarchy. This removes another part of the wrong dependency direction. Change-Id: I534d576e802f95b968650e3f01e16de697837b88 --- cmk_base/automations/check_mk.py | 7 ++++++- cmk_base/core.py | 8 ++++---- cmk_base/core_config.py | 12 ++---------- cmk_base/discovery.py | 6 +++--- cmk_base/modes/check_mk.py | 19 ++++++++++++++----- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py index 86b4a2c..e025479 100644 --- a/cmk_base/automations/check_mk.py +++ b/cmk_base/automations/check_mk.py @@ -788,7 +788,12 @@ class AutomationRestart(Automation): if backup_path: os.remove(backup_path) - core_config.precompile() + if config.monitoring_core == "cmc": + from cmk_base.cee.core_cmc import precompile_hook + else: + from cmk_base.core_nagios import precompile_hook + precompile_hook() + core.do_core_action(self._mode()) else: broken_config_path = "%s/check_mk_objects.cfg.broken" % cmk.paths.tmp_dir diff --git a/cmk_base/core.py b/cmk_base/core.py index d719857..fcec2ca 100644 --- a/cmk_base/core.py +++ b/cmk_base/core.py @@ -65,12 +65,12 @@ _restart_lock_fd = None # | Invoke actions affecting the core like reload/restart | # '----------------------------------------------------------------------' -def do_reload(create_config_hook): - do_restart(create_config_hook, only_reload=True) +def do_reload(create_config_hook, precompile_hook): + do_restart(create_config_hook, precompile_hook, only_reload=True) # TODO: Cleanup duplicate code with automation_restart() -def do_restart(create_config_hook, only_reload=False): +def do_restart(create_config_hook, precompile_hook, only_reload=False): try: backup_path = None @@ -102,7 +102,7 @@ def do_restart(create_config_hook, only_reload=False): if backup_path: os.remove(backup_path) - core_config.precompile() + precompile_hook() do_core_action(only_reload and "reload" or "restart") else: diff --git a/cmk_base/core_config.py b/cmk_base/core_config.py index 5d33998..e32e6ee 100644 --- a/cmk_base/core_config.py +++ b/cmk_base/core_config.py @@ -266,19 +266,11 @@ def _verify_non_duplicate_hosts(): "This might lead to invalid/incomplete monitoring for these hosts." % ", ".join(duplicates)) -def precompile(): - if config.monitoring_core == "cmc": - from cmk_base.cee.core_cmc import precompile_hook - else: - from cmk_base.core_nagios import precompile_hook - precompile_hook() - - -def do_update(create_config_hook, with_precompile): +def do_update(create_config_hook, precompile_hook, with_precompile): try: do_create_config(create_config_hook, with_agents=with_precompile) if with_precompile: - precompile() + precompile_hook() except Exception, e: console.error("Configuration Error: %s\n" % e) diff --git a/cmk_base/discovery.py b/cmk_base/discovery.py index 0b9a05c..0e5a73d 100644 --- a/cmk_base/discovery.py +++ b/cmk_base/discovery.py @@ -461,7 +461,7 @@ def _get_autodiscovery_dir(): return cmk.paths.var_dir + '/autodiscovery' -def discover_marked_hosts(create_config_hook): +def discover_marked_hosts(create_config_hook, precompile_hook): console.verbose("Doing discovery for all marked hosts:\n") autodiscovery_dir = _get_autodiscovery_dir() @@ -497,9 +497,9 @@ def discover_marked_hosts(create_config_hook): if activation_required: console.verbose("\nRestarting monitoring core with updated configuration...\n") if config.monitoring_core == "cmc": - core.do_reload(create_config_hook) + core.do_reload(create_config_hook, precompile_hook) else: - core.do_restart(create_config_hook) + core.do_restart(create_config_hook, precompile_hook) def _discover_marked_host(hostname, all_hosts, now_ts, oldest_queued): diff --git a/cmk_base/modes/check_mk.py b/cmk_base/modes/check_mk.py index 7a3d9d3..aae74c9 100644 --- a/cmk_base/modes/check_mk.py +++ b/cmk_base/modes/check_mk.py @@ -1023,9 +1023,18 @@ def _create_config_hook(options=None): return create_config_hook +def _precompile_hook(): + from cmk_base.config import monitoring_core + if monitoring_core == "cmc": + from cmk_base.cee.core_cmc import precompile_hook + else: + from cmk_base.core_nagios import precompile_hook + return precompile_hook + + def mode_update_no_precompile(options): from cmk_base.core_config import do_update - do_update(_create_config_hook(options), with_precompile=False) + do_update(_create_config_hook(options), _precompile_hook(), with_precompile=False) modes.register(Mode( long_option="update-no-precompile", @@ -1082,7 +1091,7 @@ modes.register(Mode( def mode_update(options): from cmk_base.core_config import do_update - do_update(_create_config_hook(options), with_precompile=True) + do_update(_create_config_hook(options), _precompile_hook(), with_precompile=True) modes.register(Mode( long_option="update", @@ -1121,7 +1130,7 @@ modes.register(Mode( def mode_restart(): import cmk_base.core as core - core.do_restart(_create_config_hook()) + core.do_restart(_create_config_hook(), _precompile_hook()) modes.register(Mode( long_option="restart", @@ -1143,7 +1152,7 @@ modes.register(Mode( def mode_reload(): import cmk_base.core as core - core.do_reload(_create_config_hook()) + core.do_reload(_create_config_hook(), _precompile_hook()) modes.register(Mode( long_option="reload", @@ -1395,7 +1404,7 @@ modes.register(Mode( def mode_discover_marked_hosts(): import cmk_base.discovery as discovery - discovery.discover_marked_hosts(_create_config_hook()) + discovery.discover_marked_hosts(_create_config_hook(), _precompile_hook()) modes.register(Mode( long_option="discover-marked-hosts",
6 years
1
0
0
0
Revert "added WK5818"
by Sven Panne
Module: check_mk Branch: master Commit: fc68605ce7d06882b72169fb4de7b234fc58ff6b URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fc68605ce7d068…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Fri Jun 8 08:10:23 2018 +0200 Revert "added WK5818" The commit lead to 6 pylint warnings (undefined variable 'cmk_base') in cmk_base.data_sources.tcp. This reverts commit d6227564203a0fc7c57c1a19c8808db0f438061d. --- .werks/5818 | 9 --------- cmk_base/data_sources/__init__.py | 5 ----- cmk_base/data_sources/abstract.py | 39 +++++++++++++++++++++++++++++++++++++++ cmk_base/data_sources/tcp.py | 39 --------------------------------------- 4 files changed, 39 insertions(+), 53 deletions(-) diff --git a/.werks/5818 b/.werks/5818 deleted file mode 100644 index d184b2e..0000000 --- a/.werks/5818 +++ /dev/null @@ -1,9 +0,0 @@ -Title: Fixed "unknown agent version" message in Check_MK check, shown by cluster hosts -Level: 1 -Component: checks -Compatible: compat -Edition: cre -Version: 1.6.0i1 -Date: 1528389637 -Class: fix - diff --git a/cmk_base/data_sources/__init__.py b/cmk_base/data_sources/__init__.py index af4f586..3a03826 100644 --- a/cmk_base/data_sources/__init__.py +++ b/cmk_base/data_sources/__init__.py @@ -107,11 +107,6 @@ class DataSources(object): def _initialize_data_sources(self): self._sources = {} - if config.is_cluster(self._hostname): - # Cluster hosts do not have any actual data sources - # Instead all data is provided by the nodes - return - self._initialize_agent_based_data_sources() self._initialize_snmp_data_sources() self._initialize_management_board_data_sources() diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py index 7afea91..1a599ac 100644 --- a/cmk_base/data_sources/abstract.py +++ b/cmk_base/data_sources/abstract.py @@ -726,6 +726,45 @@ class CheckMKAgentDataSource(DataSource): return agent_info + def _is_expected_agent_version(self, agent_version, expected_version): + try: + if agent_version in [ '(unknown)', None, 'None' ]: + return False + + if type(expected_version) == str and expected_version != agent_version: + return False + + elif type(expected_version) == tuple and expected_version[0] == 'at_least': + spec = expected_version[1] + if cmk_base.utils.is_daily_build_version(agent_version) and 'daily_build' in spec: + expected = int(spec['daily_build'].replace('.', '')) + + branch = cmk_base.utils.branch_of_daily_build(agent_version) + if branch == "master": + agent = int(agent_version.replace('.', '')) + + else: # branch build (e.g. 1.2.4-2014.06.01) + agent = int(agent_version.split('-')[1].replace('.', '')) + + if agent < expected: + return False + + elif 'release' in spec: + if cmk_base.utils.is_daily_build_version(agent_version): + return False + + if cmk_base.utils.parse_check_mk_version(agent_version) \ + < cmk_base.utils.parse_check_mk_version(spec['release']): + return False + + return True + except Exception, e: + if cmk.debug.enabled(): + raise + raise MKGeneralException("Unable to check agent version (Agent: %s Expected: %s, Error: %s)" % + (agent_version, expected_version, e)) + + class ManagementBoardDataSource(DataSource): """Abstract base class for all data sources that work with the management board configuration""" diff --git a/cmk_base/data_sources/tcp.py b/cmk_base/data_sources/tcp.py index 42875b6..1572425 100644 --- a/cmk_base/data_sources/tcp.py +++ b/cmk_base/data_sources/tcp.py @@ -194,45 +194,6 @@ class TCPDataSource(CheckMKAgentDataSource): return status, output, perfdata - def _is_expected_agent_version(self, agent_version, expected_version): - try: - if agent_version in [ '(unknown)', None, 'None' ]: - return False - - if type(expected_version) == str and expected_version != agent_version: - return False - - elif type(expected_version) == tuple and expected_version[0] == 'at_least': - spec = expected_version[1] - if cmk_base.utils.is_daily_build_version(agent_version) and 'daily_build' in spec: - expected = int(spec['daily_build'].replace('.', '')) - - branch = cmk_base.utils.branch_of_daily_build(agent_version) - if branch == "master": - agent = int(agent_version.replace('.', '')) - - else: # branch build (e.g. 1.2.4-2014.06.01) - agent = int(agent_version.split('-')[1].replace('.', '')) - - if agent < expected: - return False - - elif 'release' in spec: - if cmk_base.utils.is_daily_build_version(agent_version): - return False - - if cmk_base.utils.parse_check_mk_version(agent_version) \ - < cmk_base.utils.parse_check_mk_version(spec['release']): - return False - - return True - except Exception, e: - if cmk.debug.enabled(): - raise - raise MKGeneralException("Unable to check agent version (Agent: %s Expected: %s, Error: %s)" % - (agent_version, expected_version, e)) - - def _decrypt_package(self, encrypted_pkg, encryption_key): from Cryptodome.Cipher import AES from hashlib import md5
6 years
1
0
0
0
added WK5818
by Andreas
Module: check_mk Branch: master Commit: d6227564203a0fc7c57c1a19c8808db0f438061d URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d6227564203a0f…
Author: Andreas <ab(a)mathias-kettner.de> Date: Thu Jun 7 18:46:16 2018 +0200 added WK5818 Change-Id: I080ac1ffc26512d1ef6b64ef5952ac988da54f14 --- .werks/5818 | 9 +++++++++ cmk_base/data_sources/__init__.py | 5 +++++ cmk_base/data_sources/abstract.py | 39 --------------------------------------- cmk_base/data_sources/tcp.py | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 39 deletions(-) diff --git a/.werks/5818 b/.werks/5818 new file mode 100644 index 0000000..d184b2e --- /dev/null +++ b/.werks/5818 @@ -0,0 +1,9 @@ +Title: Fixed "unknown agent version" message in Check_MK check, shown by cluster hosts +Level: 1 +Component: checks +Compatible: compat +Edition: cre +Version: 1.6.0i1 +Date: 1528389637 +Class: fix + diff --git a/cmk_base/data_sources/__init__.py b/cmk_base/data_sources/__init__.py index 3a03826..af4f586 100644 --- a/cmk_base/data_sources/__init__.py +++ b/cmk_base/data_sources/__init__.py @@ -107,6 +107,11 @@ class DataSources(object): def _initialize_data_sources(self): self._sources = {} + if config.is_cluster(self._hostname): + # Cluster hosts do not have any actual data sources + # Instead all data is provided by the nodes + return + self._initialize_agent_based_data_sources() self._initialize_snmp_data_sources() self._initialize_management_board_data_sources() diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py index 1a599ac..7afea91 100644 --- a/cmk_base/data_sources/abstract.py +++ b/cmk_base/data_sources/abstract.py @@ -726,45 +726,6 @@ class CheckMKAgentDataSource(DataSource): return agent_info - def _is_expected_agent_version(self, agent_version, expected_version): - try: - if agent_version in [ '(unknown)', None, 'None' ]: - return False - - if type(expected_version) == str and expected_version != agent_version: - return False - - elif type(expected_version) == tuple and expected_version[0] == 'at_least': - spec = expected_version[1] - if cmk_base.utils.is_daily_build_version(agent_version) and 'daily_build' in spec: - expected = int(spec['daily_build'].replace('.', '')) - - branch = cmk_base.utils.branch_of_daily_build(agent_version) - if branch == "master": - agent = int(agent_version.replace('.', '')) - - else: # branch build (e.g. 1.2.4-2014.06.01) - agent = int(agent_version.split('-')[1].replace('.', '')) - - if agent < expected: - return False - - elif 'release' in spec: - if cmk_base.utils.is_daily_build_version(agent_version): - return False - - if cmk_base.utils.parse_check_mk_version(agent_version) \ - < cmk_base.utils.parse_check_mk_version(spec['release']): - return False - - return True - except Exception, e: - if cmk.debug.enabled(): - raise - raise MKGeneralException("Unable to check agent version (Agent: %s Expected: %s, Error: %s)" % - (agent_version, expected_version, e)) - - class ManagementBoardDataSource(DataSource): """Abstract base class for all data sources that work with the management board configuration""" diff --git a/cmk_base/data_sources/tcp.py b/cmk_base/data_sources/tcp.py index 1572425..42875b6 100644 --- a/cmk_base/data_sources/tcp.py +++ b/cmk_base/data_sources/tcp.py @@ -194,6 +194,45 @@ class TCPDataSource(CheckMKAgentDataSource): return status, output, perfdata + def _is_expected_agent_version(self, agent_version, expected_version): + try: + if agent_version in [ '(unknown)', None, 'None' ]: + return False + + if type(expected_version) == str and expected_version != agent_version: + return False + + elif type(expected_version) == tuple and expected_version[0] == 'at_least': + spec = expected_version[1] + if cmk_base.utils.is_daily_build_version(agent_version) and 'daily_build' in spec: + expected = int(spec['daily_build'].replace('.', '')) + + branch = cmk_base.utils.branch_of_daily_build(agent_version) + if branch == "master": + agent = int(agent_version.replace('.', '')) + + else: # branch build (e.g. 1.2.4-2014.06.01) + agent = int(agent_version.split('-')[1].replace('.', '')) + + if agent < expected: + return False + + elif 'release' in spec: + if cmk_base.utils.is_daily_build_version(agent_version): + return False + + if cmk_base.utils.parse_check_mk_version(agent_version) \ + < cmk_base.utils.parse_check_mk_version(spec['release']): + return False + + return True + except Exception, e: + if cmk.debug.enabled(): + raise + raise MKGeneralException("Unable to check agent version (Agent: %s Expected: %s, Error: %s)" % + (agent_version, expected_version, e)) + + def _decrypt_package(self, encrypted_pkg, encryption_key): from Cryptodome.Cipher import AES from hashlib import md5
6 years
1
0
0
0
added WK5817
by Andreas
Module: check_mk Branch: master Commit: 72e20b1d8341077428b17a9418c09d65e634a4b8 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=72e20b1d834107…
Author: Andreas <ab(a)mathias-kettner.de> Date: Thu Jun 7 15:21:53 2018 +0200 added WK5817 Change-Id: If0ac5ff56d39e1fcd3c6928e9051dfca2796631e --- .werks/5817 | 11 +++++++++++ cmk_base/data_sources/abstract.py | 31 ++----------------------------- cmk_base/data_sources/tcp.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 29 deletions(-) diff --git a/.werks/5817 b/.werks/5817 new file mode 100644 index 0000000..cc110df --- /dev/null +++ b/.werks/5817 @@ -0,0 +1,11 @@ +Title: The "Check for correct version of Check_MK agent" rule no longer applies to datasource programs +Level: 1 +Component: checks +Class: fix +Compatible: compat +Edition: cre +State: unknown +Version: 1.6.0i1 +Date: 1528376768 + +The version checking is now correctly restricted to agent output from remote Check_MK agents. diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py index 4c38217..1a599ac 100644 --- a/cmk_base/data_sources/abstract.py +++ b/cmk_base/data_sources/abstract.py @@ -696,43 +696,16 @@ class CheckMKAgentDataSource(DataSource): # TODO: refactor def _summary_result(self): - expected_version = config.agent_target_version(self._hostname) - agent_info = self._get_agent_info() agent_version = agent_info["version"] - - status, output, perfdata = 0, [], [] - + output = [] if not config.is_cluster(self._hostname) and agent_version != None: output.append("Version: %s" % agent_version) if not config.is_cluster(self._hostname) and agent_info["agentos"] != None: output.append("OS: %s" % agent_info["agentos"]) - if expected_version and agent_version \ - and not self._is_expected_agent_version(agent_version, expected_version): - # expected version can either be: - # a) a single version string - # b) a tuple of ("at_least", {'daily_build': '2014.06.01', 'release': '1.2.5i4'} - # (the dict keys are optional) - if type(expected_version) == tuple and expected_version[0] == 'at_least': - expected = 'at least' - if 'daily_build' in expected_version[1]: - expected += ' build %s' % expected_version[1]['daily_build'] - if 'release' in expected_version[1]: - if 'daily_build' in expected_version[1]: - expected += ' or' - expected += ' release %s' % expected_version[1]['release'] - else: - expected = expected_version - output.append("unexpected agent version %s (should be %s), " % (agent_version, expected)) - status = self._exit_code_spec.get("wrong_version", 1) - - elif config.agent_min_version and agent_version < config.agent_min_version: - output.append("old plugin version %s (should be at least %s), " % (agent_version, config.agent_min_version)) - status = self._exit_code_spec.get("wrong_version", 1) - - return status, ", ".join(output), [] + return 0, ", ".join(output), [] def _get_agent_info(self): diff --git a/cmk_base/data_sources/tcp.py b/cmk_base/data_sources/tcp.py index 6b2070e..1572425 100644 --- a/cmk_base/data_sources/tcp.py +++ b/cmk_base/data_sources/tcp.py @@ -160,6 +160,40 @@ class TCPDataSource(CheckMKAgentDataSource): return output + # TODO: refactor + def _summary_result(self): + agent_info = self._get_agent_info() + agent_version = agent_info["version"] + + status, output, perfdata = super(TCPDataSource, self)._summary_result() + + expected_version = config.agent_target_version(self._hostname) + if expected_version and agent_version \ + and not self._is_expected_agent_version(agent_version, expected_version): + # expected version can either be: + # a) a single version string + # b) a tuple of ("at_least", {'daily_build': '2014.06.01', 'release': '1.2.5i4'} + # (the dict keys are optional) + if type(expected_version) == tuple and expected_version[0] == 'at_least': + expected = 'at least' + if 'daily_build' in expected_version[1]: + expected += ' build %s' % expected_version[1]['daily_build'] + if 'release' in expected_version[1]: + if 'daily_build' in expected_version[1]: + expected += ' or' + expected += ' release %s' % expected_version[1]['release'] + else: + expected = expected_version + output += ", unexpected agent version %s (should be %s)" % (agent_version, expected) + status = self._exit_code_spec.get("wrong_version", 1) + + elif config.agent_min_version and agent_version < config.agent_min_version: + output += ", old plugin version %s (should be at least %s)" % (agent_version, config.agent_min_version) + status = self._exit_code_spec.get("wrong_version", 1) + + return status, output, perfdata + + def _decrypt_package(self, encrypted_pkg, encryption_key): from Cryptodome.Cipher import AES from hashlib import md5
6 years
1
0
0
0
megaraid_bbu: Fix indentation
by Konstantin Büttner
Module: check_mk Branch: master Commit: 8f9ca1e04724e1133acc553b2e5d07e56a749ce9 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8f9ca1e04724e1…
Author: Konstantin Büttner <kb(a)mathias-kettner.de> Date: Thu Jun 7 14:22:56 2018 +0200 megaraid_bbu: Fix indentation --- checks/megaraid_bbu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checks/megaraid_bbu b/checks/megaraid_bbu index d9f7f08..6970c81 100644 --- a/checks/megaraid_bbu +++ b/checks/megaraid_bbu @@ -109,8 +109,8 @@ def check_megaraid_bbu(item, _no_params, info): if refstate: text += ' (%s)' % ("!" * refstate) text += ' (Expected: %s)' % refvalue - broken.append(text) - state = max(state, refstate) + broken.append(text) + state = max(state, refstate) except KeyError: pass
6 years
1
0
0
0
megaraid_pdisks: Fix indentation
by Konstantin Büttner
Module: check_mk Branch: master Commit: ba3c49b83fdb30d8e5fa72d42ba03d2189d8de50 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ba3c49b83fdb30…
Author: Konstantin Büttner <kb(a)mathias-kettner.de> Date: Thu Jun 7 14:16:43 2018 +0200 megaraid_pdisks: Fix indentation --- checks/megaraid_pdisks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checks/megaraid_pdisks b/checks/megaraid_pdisks index cff59ed..43aaf6a 100644 --- a/checks/megaraid_pdisks +++ b/checks/megaraid_pdisks @@ -75,7 +75,7 @@ def megaraid_pdisks_parse(info): adapters[adapter][enclosure_devid] = enclosure_devid except: # no enclosure device - enclosure_devid = 0 + enclosure_devid = 0 adapters[adapter][0] = 0 elif line[0] == "Enclosure" and line[1] == "Number:": for devid, number in current_adapter.items():
6 years
1
0
0
0
dell_om_processors: Fix typo
by Konstantin Büttner
Module: check_mk Branch: master Commit: 9b17da5dc0153c2758f753bd5cf390772b6634db URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9b17da5dc0153c…
Author: Konstantin Büttner <kb(a)mathias-kettner.de> Date: Thu Jun 7 14:13:34 2018 +0200 dell_om_processors: Fix typo --- checks/dell_om_processors | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checks/dell_om_processors b/checks/dell_om_processors index b295c44..de0916a 100644 --- a/checks/dell_om_processors +++ b/checks/dell_om_processors @@ -39,7 +39,7 @@ def check_dell_om_processors(item, _no_params, info): } cpu_readings = { - 0 : 'Unkown', + 0 : 'Unknown', 1 : 'Internal Error', # Internal Error 2 : 'Thermal Trip', # Thermal Trip 32 : 'Configuration Error', # Configuration Error
6 years
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
17
18
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Results per page:
10
25
50
100
200