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
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
September 2018
----- 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
12 participants
371 discussions
Start a n
N
ew thread
Refactored acknowledgement form rendering
by Lars Michelsen
Module: check_mk Branch: master Commit: ca2f82b16bdc12d9d0a721be4a5b69c4add784e4 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ca2f82b16bdc12…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Mon Sep 10 17:43:12 2018 +0200 Refactored acknowledgement form rendering Change-Id: Ie79b0c6c4eac9aa8301e543a143d5c468e0d0dcd --- cmk/gui/plugins/views/commands.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/cmk/gui/plugins/views/commands.py b/cmk/gui/plugins/views/commands.py index 551efb9..73fc782 100644 --- a/cmk/gui/plugins/views/commands.py +++ b/cmk/gui/plugins/views/commands.py @@ -473,6 +473,24 @@ def command_acknowledgement(cmdtag, spec, row): return commands, title +def render_acknowledgement(): + html.button("_acknowledge", _("Acknowledge")) + html.button("_remove_ack", _("Remove Acknowledgement")) + html.hr() + html.checkbox("_ack_sticky", config.view_action_defaults["ack_sticky"], + label=_("sticky")) + html.checkbox("_ack_notify", config.view_action_defaults["ack_notify"], + label=_("send notification")) + html.checkbox("_ack_persistent", config.view_action_defaults["ack_persistent"], + label=_('persistent comment')) + html.hr() + Age(display=["days", "hours", "minutes"], label=_("Expire acknowledgement after")).render_input("_ack_expire", 0) + html.help(_("Note: Expiration of acknowledgements only works when using the Check_MK Micro Core.")) + html.hr() + html.write_text(_("Comment") + ": ") + html.text_input("_ack_comment", size=48, submit="_acknowledge") + + register_command_group( ident = "acknowledge", title = _("Acknowledge"), @@ -484,22 +502,7 @@ multisite_commands.append({ "tables" : [ "host", "service", "aggr" ], "permission" : "action.acknowledge", "title" : _("Acknowledge Problems"), - "render" : lambda: \ - html.button("_acknowledge", _("Acknowledge")) == \ - html.button("_remove_ack", _("Remove Acknowledgement")) == \ - html.hr() == \ - html.checkbox("_ack_sticky", config.view_action_defaults["ack_sticky"], - label=_("sticky")) == \ - html.checkbox("_ack_notify", config.view_action_defaults["ack_notify"], - label=_("send notification")) == \ - html.checkbox("_ack_persistent", config.view_action_defaults["ack_persistent"], - label=_('persistent comment')) == \ - html.hr() == \ - Age(display=["days", "hours", "minutes"], label=_("Expire acknowledgement after")).render_input("_ack_expire", 0) == \ - html.help(_("Note: Expiration of acknowledgements only works when using the Check_MK Micro Core.")) == \ - html.hr() == \ - html.write_text(_("Comment") + ": ") == \ - html.text_input("_ack_comment", size=48, submit="_acknowledge"), + "render" : render_acknowledgement, "action" : command_acknowledgement, "group" : "acknowledge", })
6 years
1
0
0
0
Refactored view command rendering
by Lars Michelsen
Module: check_mk Branch: master Commit: f103909279c93e27cf1274a1b3455a1ce995a730 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f103909279c93e…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Mon Sep 10 19:16:56 2018 +0200 Refactored view command rendering Today: Being creative with lambda Change-Id: Ic70ef6e6d5c7e849363d83aff10dbdfd2a9ea7de --- cmk/gui/plugins/views/commands.py | 136 ++++++++++++++++++++++++++------------ 1 file changed, 93 insertions(+), 43 deletions(-) diff --git a/cmk/gui/plugins/views/commands.py b/cmk/gui/plugins/views/commands.py index b7ecc5b..baa7490 100644 --- a/cmk/gui/plugins/views/commands.py +++ b/cmk/gui/plugins/views/commands.py @@ -92,15 +92,18 @@ config.declare_permission("action.reschedule", [ "user", "admin" ]) +def render_reschedule(): + html.button("_resched_checks", _("Reschedule")) + html.write_text(" " + _("and spread over") + " ") + html.number_input("_resched_spread", 0, size=3) + html.write_text(" " + _("minutes") + " ") + + multisite_commands.append({ "tables" : [ "host", "service" ], "permission" : "action.reschedule", "title" : _("Reschedule active checks"), - "render" : lambda: \ - html.button("_resched_checks", _("Reschedule")) == \ - html.write_text(" " + _("and spread over") + " ") == \ - html.number_input("_resched_spread", 0, size=3) == \ - html.write_text(" " + _("minutes") + " "), + "render" : render_reschedule, "action" : command_reschedule, "row_stats" : True, # Get information about number of rows and current row nr. }) @@ -135,13 +138,17 @@ def command_notifications(cmdtag, spec, row): return ("DISABLE_" + cmdtag + "_NOTIFICATIONS;%s" % spec, _("<b>disable notifications</b> for")) + +def render_notifications(): + html.button("_enable_notifications", _("Enable")) + html.button("_disable_notifications", _("Disable")) + + multisite_commands.append({ "tables" : [ "host", "service" ], "permission" : "action.notifications", "title" : _("Notifications"), - "render" : lambda: \ - html.button("_enable_notifications", _("Enable")) == \ - html.button("_disable_notifications", _("Disable")), + "render" : render_notifications, "action" : command_notifications, }) @@ -175,13 +182,17 @@ def command_enable_active(cmdtag, spec, row): return ("DISABLE_" + cmdtag + "_CHECK;%s" % spec, _("<b>disable active checks</b> for")) + +def render_enable_active(): + html.button("_enable_checks", _("Enable")) + html.button("_disable_checks", _("Disable")) + + multisite_commands.append({ "tables" : [ "host", "service" ], "permission" : "action.enablechecks", "title" : _("Active checks"), - "render" : lambda: \ - html.button("_enable_checks", _("Enable")) == \ - html.button("_disable_checks", _("Disable")), + "render" : render_enable_active, "action" : command_enable_active, }) @@ -210,13 +221,17 @@ def command_enable_passive(cmdtag, spec, row): return ("DISABLE_PASSIVE_" + cmdtag + "_CHECKS;%s" % spec, _("<b>disable passive checks</b> for")) + +def render_enable_passive(): + html.button("_enable_passive_checks", _("Enable")) + html.button("_disable_passive_checks", _("Disable")) + + multisite_commands.append({ "tables" : [ "host", "service" ], "permission" : "action.enablechecks", "title" : _("Passive checks"), - "render" : lambda: \ - html.button("_enable_passive_checks", _("Enable")) == \ - html.button("_disable_passive_checks", _("Disable")), + "render" : render_enable_passive, "action" : command_enable_passive, }) @@ -243,16 +258,22 @@ config.declare_permission("action.clearmodattr", _("Reset all manually modified attributes of a host or service (like disabled notifications)"), [ "admin" ]) + +def render_clear_modified(): + html.button("_clear_modattr", _('Clear modified attributes')) + + +def action_clear_modified(cmdtag, spec, row): + if html.var("_clear_modattr"): + return "CHANGE_" + cmdtag + "_MODATTR;%s;0" % spec, _("<b>clear the modified attributes</b> of") + + multisite_commands.append({ "tables" : [ "host", "service" ], "permission" : "action.clearmodattr", "title" : _("Modified attributes"), - "render" : lambda: \ - html.button("_clear_modattr", _('Clear modified attributes')), - "action" : lambda cmdtag, spec, row: ( - html.var("_clear_modattr") and ( - "CHANGE_" + cmdtag + "_MODATTR;%s;0" % spec, - _("<b>clear the modified attributes</b> of"))), + "render" : render_clear_modified, + "action" : action_clear_modified, }) @@ -386,18 +407,21 @@ def command_custom_notification(cmdtag, spec, row): return command, title +def render_custom_notification(): + html.write_text(_('Comment') + ": ") + html.text_input("_cusnot_comment", "TEST", size=20, submit="_customnotification") + html.write_text(" ") + html.checkbox("_cusnot_forced", False, label=_("forced")) + html.checkbox("_cusnot_broadcast", False, label=_("broadcast")) + html.write_text(" ") + html.button("_customnotification", _('Send')) + + multisite_commands.append({ "tables" : [ "host", "service" ], "permission" : "action.customnotification", "title" : _("Custom notification"), - "render" : lambda: \ - html.write_text(_('Comment') + ": ") == \ - html.text_input("_cusnot_comment", "TEST", size=20, submit="_customnotification") == \ - html.write_text(" ") == \ - html.checkbox("_cusnot_forced", False, label=_("forced")) == \ - html.checkbox("_cusnot_broadcast", False, label=_("broadcast")) == \ - html.write_text(" ") == \ - html.button("_customnotification", _('Send')), + "render" : render_custom_notification, "action" : command_custom_notification, }) @@ -541,15 +565,19 @@ def command_comment(cmdtag, spec, row): title = _("<b>add a comment to</b>") return command, title + +def render_comment(): + html.write_text(_('Comment')+": ") + html.text_input("_comment", size=33, submit="_add_comment") + html.write_text(" ") + html.button("_add_comment", _("Add comment")) + + multisite_commands.append({ "tables" : [ "host", "service" ], "permission" : "action.addcomment", "title" : _("Add comment"), - "render" : lambda: \ - html.write_text(_('Comment')+": ") == \ - html.text_input("_comment", size=33, submit="_add_comment") == \ - html.write_text(" ") == \ - html.button("_add_comment", _("Add comment")), + "render" : render_comment, "action" : command_comment, }) @@ -852,14 +880,22 @@ multisite_commands.append({ "group" : "downtimes", }) +def remove_downtimes(cmdtag, spec, row): + if html.has_var("_remove_downtimes"): + return ("DEL_%s_DOWNTIME;%d" % (cmdtag, spec), _("remove")) + + +def render_downtimes(): + html.button("_remove_downtimes", _("Remove")) + + # REMOVE DOWNTIMES (table downtimes) multisite_commands.append({ "tables" : [ "downtime" ], "permission" : "action.downtimes", "title" : _("Remove downtimes"), - "render" : lambda: html.button("_remove_downtimes", _("Remove")), - "action" : lambda cmdtag, spec, row: html.has_var("_remove_downtimes") and \ - ( "DEL_%s_DOWNTIME;%d" % (cmdtag, spec), _("remove")) + "render" : render_downtimes, + "action" : remove_downtimes, }) # REMOVE COMMENTS (table comments) @@ -877,12 +913,17 @@ def remove_comments(cmdtag, spec, row): return commands, _("remove") + +def render_remove_comments(): + html.button("_remove_comments", _("Remove")) + + multisite_commands.append({ "tables" : [ "comment" ], "permission" : "action.addcomment", "title" : _("Remove comments"), - "render" : lambda: html.button("_remove_comments", _("Remove")), - "action" : remove_comments + "render" : render_remove_comments, + "action" : remove_comments, }) #. @@ -914,6 +955,12 @@ def command_executor_star(command, site): stars.add(spec) config.user.save_stars(stars) + +def render_star(): + html.button("_star", _("Add to Favorites")) + html.button("_unstar", _("Remove from Favorites")) + + config.declare_permission("action.star", _("Use favorites"), _("This permission allows a user to make certain host and services " @@ -925,9 +972,7 @@ multisite_commands.append({ "tables" : [ "host", "service" ], "permission" : "action.star", "title" : _("Favorites"), - "render" : lambda: \ - html.button("_star", _("Add to Favorites")) == \ - html.button("_unstar", _("Remove from Favorites")), + "render" : render_star, "action" : command_star, "executor" : command_executor_star, }) @@ -957,11 +1002,16 @@ def executor_acknowledge_failed_notification(command, site): acktime = int(command) notifications.acknowledge_failed_notifications(acktime) + +def render_acknowledge_failed_notification(): + html.button("_acknowledge_failed_notification", _("Acknowledge")) + + multisite_commands.append({ "tables" : [ "log" ], "permission" : "general.acknowledge_failed_notifications", "title" : _("Acknowledge"), - "render" : lambda: html.button("_acknowledge_failed_notification", _("Acknowledge")), + "render" : render_acknowledge_failed_notification, "action" : command_acknowledge_failed_notification, - "executor" : executor_acknowledge_failed_notification + "executor" : executor_acknowledge_failed_notification, })
6 years
1
0
0
0
Fixed integration test
by Lars Michelsen
Module: check_mk Branch: master Commit: a79a7150602e0cf6fcfdf1575e0aaf6545bba861 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a79a7150602e0c…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Mon Sep 10 17:07:22 2018 +0200 Fixed integration test Change-Id: I4b688e7c16ec4530b20c10983915f53ca827dbca --- tests/integration/cmk_base/test_automations.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/cmk_base/test_automations.py b/tests/integration/cmk_base/test_automations.py index d70dd47..1c08e3c 100644 --- a/tests/integration/cmk_base/test_automations.py +++ b/tests/integration/cmk_base/test_automations.py @@ -85,6 +85,7 @@ def test_registered_automations(site): 'get-check-manpage', 'get-configuration', 'get-real-time-checks', + 'get-service-configurations', 'inventory', 'notification-analyse', 'notification-get-bulks',
6 years
1
0
0
0
Fixed merge issues
by Lars Michelsen
Module: check_mk Branch: master Commit: 030ad109cd34ca2e26bcb318cc174dc90017f4f0 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=030ad109cd34ca…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Mon Sep 10 17:06:06 2018 +0200 Fixed merge issues Change-Id: I8fa658d1000beb763be177af2e2cc2133541e86a --- cmk_base/automations/check_mk.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py index 2fd244f..32c0c0c 100644 --- a/cmk_base/automations/check_mk.py +++ b/cmk_base/automations/check_mk.py @@ -523,8 +523,6 @@ class AutomationAnalyseServices(Automation): # TODO: Was ist mit Clustern??? # TODO: Klappt das mit automatischen verschatten von SNMP-Checks (bei dual Monitoring) def execute(self, args): - import cmk_base.check_table as check_table - hostname = args[0] servicedesc = args[1].decode("utf-8") check_api_utils.set_hostname(hostname) @@ -1430,7 +1428,7 @@ class AutomationGetServiceConfigurations(Automation): # legacy checks via active_checks actchecks = [] for acttype, rules in config.active_checks.iteritems(): - entries = rulesets.host_extra_conf(hostname, rules) + entries = config.host_extra_conf(hostname, rules) for params in entries: description = config.active_check_service_description(hostname, acttype, params) actchecks.append((acttype, description, params)) @@ -1438,9 +1436,8 @@ class AutomationGetServiceConfigurations(Automation): def _get_checkgroup_of_checks(self): checkgroup_of_checks = {} - for check_plugin_name, check in checks.check_info.items(): + for check_plugin_name, check in config.check_info.items(): checkgroup_of_checks[check_plugin_name] = check.get("group") return checkgroup_of_checks automations.register(AutomationGetServiceConfigurations()) -
6 years
1
0
0
0
Introduced automation call get-service-configurations and
by Andreas Boesl
Module: check_mk Branch: master Commit: 4127cde9e94526156a4da1e297dc65ea0688dee8 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4127cde9e94526…
Author: Andreas Boesl <ab(a)mathias-kettner.de> Date: Fri Sep 7 11:48:08 2018 +0200 Introduced automation call get-service-configurations and explicit setting of service custom variables and one integration test Change-Id: I35e76ddda7dcfb287cf4841dbb14a1b183b23544 --- cmk_base/automations/check_mk.py | 40 ++++++++++++++++++++++++++ cmk_base/config.py | 9 ++++++ cmk_base/default_config/base.py | 3 ++ tests/integration/cmk_base/test_automations.py | 9 ++++++ 4 files changed, 61 insertions(+) diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py index 8c2536f..2fd244f 100644 --- a/cmk_base/automations/check_mk.py +++ b/cmk_base/automations/check_mk.py @@ -40,6 +40,7 @@ import cmk_base.core import cmk_base.core_config as core_config import cmk_base.snmp as snmp import cmk_base.discovery as discovery +import cmk_base.check_table as check_table from cmk_base.automations import automations, Automation, MKAutomationError import cmk_base.check_utils import cmk_base.autochecks @@ -1404,3 +1405,42 @@ class AutomationGetBulks(Automation): automations.register(AutomationGetBulks()) + + +class AutomationGetServiceConfigurations(Automation): + cmd = "get-service-configurations" + needs_config = True + needs_checks = True + + def execute(self, args): + result = {"hosts": {}} + for hostname in config.all_active_hosts(): + result["hosts"][hostname] = self._get_config_for_host(hostname) + + result["checkgroup_of_checks"] = self._get_checkgroup_of_checks() + return result + + + def _get_config_for_host(self, hostname): + return {"checks": check_table.get_check_table(hostname, remove_duplicates = True), + "active_checks": self._get_active_checks(hostname)} + + + def _get_active_checks(self, hostname): + # legacy checks via active_checks + actchecks = [] + for acttype, rules in config.active_checks.iteritems(): + entries = rulesets.host_extra_conf(hostname, rules) + for params in entries: + description = config.active_check_service_description(hostname, acttype, params) + actchecks.append((acttype, description, params)) + return actchecks + + def _get_checkgroup_of_checks(self): + checkgroup_of_checks = {} + for check_plugin_name, check in checks.check_info.items(): + checkgroup_of_checks[check_plugin_name] = check.get("group") + return checkgroup_of_checks + +automations.register(AutomationGetServiceConfigurations()) + diff --git a/cmk_base/config.py b/cmk_base/config.py index bc05f0e..5ec77f9 100644 --- a/cmk_base/config.py +++ b/cmk_base/config.py @@ -1010,6 +1010,15 @@ def agent_target_version(hostname): # +# Explicit custom variables +# +def get_explicit_service_custom_variables(hostname, service_description): + try: + return explicit_service_custom_variables[(hostname, service_description)] + except KeyError: + return {} + +# # SNMP # diff --git a/cmk_base/default_config/base.py b/cmk_base/default_config/base.py index 1220494..fdde9dc 100644 --- a/cmk_base/default_config/base.py +++ b/cmk_base/default_config/base.py @@ -82,6 +82,9 @@ explicit_snmp_communities = {} # override the rule based configuration snmp_timing = [] snmp_character_encodings = [] +# Custom variables +explicit_service_custom_variables = {} + # Management board settings management_board_config = [] # Ruleset to specify management board settings management_protocol = {} # Mapping from hostname to management board protocol diff --git a/tests/integration/cmk_base/test_automations.py b/tests/integration/cmk_base/test_automations.py index e7c1594..d70dd47 100644 --- a/tests/integration/cmk_base/test_automations.py +++ b/tests/integration/cmk_base/test_automations.py @@ -478,6 +478,15 @@ def test_automation_get_configuration(test_cfg, site): site.write_file("etc/check_mk/main.mk", "") +def test_automation_get_service_configurations(test_cfg, site): + data = _execute_automation(site, "get-service-configurations") + assert type(data) == dict + assert data["checkgroup_of_checks"] + assert data["hosts"]["modes-test-host"] + print data["hosts"]["modes-test-host"] + assert data["hosts"]["modes-test-host"]["checks"][("cpu.loads", None)][1] == "CPU load" + + # TODO: rename-hosts # TODO: delete-hosts # TODO: scan-parents
6 years
1
0
0
0
Integration tests: Use branch daily version as it was intended
by Lars Michelsen
Module: check_mk Branch: master Commit: c24c045b5cb5ac47074e31e3b64bd617607a5af9 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c24c045b5cb5ac…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Mon Sep 10 16:35:54 2018 +0200 Integration tests: Use branch daily version as it was intended An integration test e.g. for the 1.5.0 branch should use the 1.5.0 daily build by default. The branch was hard coded previously. Change-Id: I759100216698e11b861aa67a4c89f4158e0e9997 --- tests/conftest.py | 2 +- tests/testlib/__init__.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 9b39812..8721826 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -217,7 +217,7 @@ def _get_site_object(): return os.environ.get("EDITION", testlib.CMKVersion.CEE) def site_branch(): - return os.environ.get("BRANCH", "master") + return os.environ.get("BRANCH", testlib.current_branch_name()) def reuse_site(): return os.environ.get("REUSE", "1") == "1" diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py index 42a1dd3..977cd62 100644 --- a/tests/testlib/__init__.py +++ b/tests/testlib/__init__.py @@ -60,6 +60,11 @@ def virtualenv_path(): return None +def current_branch_name(): + branch_name = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).split("\n", 1)[0] + return branch_name.decode("utf-8") + + class APIError(Exception): pass
6 years
1
0
0
0
6502 FIX Fixed config generation for check/service/notification period.
by Sven Panne
Module: check_mk Branch: master Commit: 89370b9bb8c9c32eb5d799afe3f51589382003af URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=89370b9bb8c9c3…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Sep 10 15:28:46 2018 +0200 6502 FIX Fixed config generation for check/service/notification period. 1.5.0p3 introduced a regression which caused all check/service/notification periods to be 24X7. This has been fixed. Change-Id: If5b10d8f99026d204a35d8cba2a088303b99116c --- .werks/6502 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.werks/6502 b/.werks/6502 new file mode 100644 index 0000000..78352cc --- /dev/null +++ b/.werks/6502 @@ -0,0 +1,12 @@ +Title: Fixed config generation for check/service/notification period. +Level: 2 +Component: config +Class: fix +Compatible: compat +Edition: cee +State: unknown +Version: 1.6.0i1 +Date: 1536585960 + +1.5.0p3 introduced a regression which caused all check/service/notification +periods to be 24X7. This has been fixed.
6 years
1
0
0
0
SLES15: Fixed wrong dependency
by Lars Michelsen
Module: check_mk Branch: master Commit: 3ccd5556a69dce0772bb15ae6d82bc9373aef448 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ccd5556a69dce…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Mon Sep 10 15:12:32 2018 +0200 SLES15: Fixed wrong dependency Change-Id: I0bb78161fd5b53ad48ad12690f0cf3a91d9304d3 --- omd/distros/SLES_15.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omd/distros/SLES_15.mk b/omd/distros/SLES_15.mk index 98045e5..4447504 100644 --- a/omd/distros/SLES_15.mk +++ b/omd/distros/SLES_15.mk @@ -93,7 +93,7 @@ OS_PACKAGES += libgsf-1-114 # needed by msitools/Agent Bakery OS_PACKAGES += cpio # needed for Agent bakery (solaris pkgs) OS_PACKAGES += poppler-tools # needed for preview of PDF in reporting OS_PACKAGES += libpcap1 # needed for ICMP of CMC -OS_PACKAGES += libffi4 # needed for pyOpenSSL and dependant +OS_PACKAGES += libffi7 # needed for pyOpenSSL and dependant OS_PACKAGES += libjpeg62 # needed by PIL OS_PACKAGES += libgthread-2_0-0 # Needed by cmc (rrd library) USERADD_OPTIONS = -M
6 years
1
0
0
0
6490 fileinfo.groups: Shows all matching files and marks files which exceed the thresholds
by Simon Betz
Module: check_mk Branch: master Commit: 51a0270ce6174e2d8508007faeacccc052586a83 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=51a0270ce6174e…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Fri Sep 7 09:38:31 2018 +0200 6490 fileinfo.groups: Shows all matching files and marks files which exceed the thresholds Change-Id: I8b1aa0c8caff7704509914bae2630f4f10d6f33e --- .werks/6490 | 10 ++++++++++ checks/fileinfo | 17 +++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.werks/6490 b/.werks/6490 new file mode 100644 index 0000000..b021153 --- /dev/null +++ b/.werks/6490 @@ -0,0 +1,10 @@ +Title: fileinfo.groups: Shows all matching files and marks files which exceed the thresholds +Level: 1 +Component: checks +Compatible: compat +Edition: cre +Version: 1.6.0i1 +Date: 1536305849 +Class: feature + + diff --git a/checks/fileinfo b/checks/fileinfo index 7120962..414fded 100644 --- a/checks/fileinfo +++ b/checks/fileinfo @@ -267,7 +267,7 @@ def check_fileinfo_groups(item, params, info): include_patterns = set() exclude_patterns = set() files_not_readable = set() - files_passes_thresholds = set() + files_passes_thresholds = {} try: reftime = int(info[0][0]) @@ -333,9 +333,9 @@ def check_fileinfo_groups(item, params, info): ("size", size), ]: for state, _, __, ___ in _fileinfo_check_file(value, params, key): - if not state: - continue - files_passes_thresholds.add((filename, size, age)) + files_passes_thresholds.setdefault(filename, { + "size": size, "age": age, "states": [] + })["states"].append(state) if age_oldest is None: age_oldest = 0 @@ -363,10 +363,11 @@ def check_fileinfo_groups(item, params, info): if any(exclude_patterns): long_output.append("Exclude patterns: %s" % ", ".join(exclude_patterns)) - for filename, size, age in files_passes_thresholds: - long_output.append("[%s] Age: %s, Size: %s" % \ - (filename, get_age_human_readable(age), - get_filesize_human_readable(size))) + for filename, attrs in files_passes_thresholds.iteritems(): + long_output.append("[%s] Age: %s, Size: %s%s" % \ + (filename, get_age_human_readable(attrs["age"]), + get_filesize_human_readable(attrs["size"]), + state_markers[max(attrs["states"])])) if long_output: yield 0, "\n%s" % "\n".join(long_output)
6 years
1
0
0
0
fileinfo: Minor cleanup
by Simon Betz
Module: check_mk Branch: master Commit: 1f3fa413f684c694e0a1f3e6d1e11d2646f6c329 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1f3fa413f684c6…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Mon Sep 10 11:29:28 2018 +0200 fileinfo: Minor cleanup Change-Id: I9c5df73e4eeacedcdf97ff026cc77e9bb8e5f4dd --- checks/fileinfo | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/checks/fileinfo b/checks/fileinfo index aed29a5..7120962 100644 --- a/checks/fileinfo +++ b/checks/fileinfo @@ -223,6 +223,7 @@ def fileinfo_groups_precompile(hostname, item, params): def _filename_matches(filename, reftime, inclusion, exclusion): + date_inclusion = "" inclusion_is_regex = False exclusion_is_regex = False @@ -236,6 +237,7 @@ def _filename_matches(filename, reftime, inclusion, exclusion): inclusion_tmp = fileinfo_process_date(inclusion, reftime) if inclusion != inclusion_tmp: inclusion = inclusion_tmp + date_inclusion = inclusion_tmp if inclusion_is_regex: incl_match = regex(inclusion).match(filename) @@ -246,7 +248,7 @@ def _filename_matches(filename, reftime, inclusion, exclusion): excl_match = regex(exclusion).match(filename) else: excl_match = fnmatch.fnmatch(filename, exclusion) - return incl_match and not excl_match + return incl_match and not excl_match, date_inclusion def check_fileinfo_groups(item, params, info): @@ -273,20 +275,23 @@ def check_fileinfo_groups(item, params, info): yield 3, "Missing reference timestamp" return + # Old format does not support '%s' in group name + group_patterns = set(params.get('precompiled_patterns', [])) + for entry in params.get('group_patterns', []): + group_patterns.add(entry) + # Start counting values on all files for line in info[1:]: filename = line[0] - # Old format does not support '%s' in group name - group_patterns = set(params.get('precompiled_patterns', [])) - for entry in params.get('group_patterns', []): - group_patterns.add(entry) + size_str = line[1] - for pattern in group_patterns: - # endswith("No such file...") is needed to - # support the solaris perl based version of fileinfo - if filename.endswith("No such file or directory"): - continue + # endswith("No such file...") is needed to + # support the solaris perl based version of fileinfo + if filename.endswith("No such file or directory")\ + or size_str in ['missing', '']: + continue + for pattern in group_patterns: if type(pattern) == str: # support old format pattern = (pattern, '') @@ -294,13 +299,11 @@ def check_fileinfo_groups(item, params, info): include_patterns.add(inclusion) exclude_patterns.add(exclusion) - if not _filename_matches(filename, reftime, inclusion, exclusion): + filename_matches, date_inclusion = _filename_matches(filename, reftime, inclusion, exclusion) + if not filename_matches: continue - size_str = line[1] - if size_str in ['missing', '']: - continue - elif size_str == "not readable": + if size_str == "not readable": files_not_readable.add(size_str) continue @@ -339,21 +342,15 @@ def check_fileinfo_groups(item, params, info): # Start Checking check_definition = [ - ("Oldest age", "age_oldest", age_oldest, get_age_human_readable), - ("Newest age", "age_newest", age_newest, get_age_human_readable), - ("Count", "count", count_all, saveint), - ("Size", "size", size_all, get_filesize_human_readable), + ("Count", "count", count_all, saveint), + ("Size", "size", size_all, get_filesize_human_readable), + ("Largest size", "size_largest", size_largest, get_filesize_human_readable), + ("Smallest size", "size_smallest", size_smallest, get_filesize_human_readable), + ("Oldest age", "age_oldest", age_oldest, get_age_human_readable), + ("Newest age", "age_newest", age_newest, get_age_human_readable), + ("Date pattern", "date pattern", date_inclusion, str), ] - if size_smallest is not None: - check_definition.append(("Smallest size", "size_smallest", - size_smallest, get_filesize_human_readable)) - if size_largest != 0: - check_definition.append(("Largest size", "size_largest", - size_largest, get_filesize_human_readable)) - if date_inclusion: - check_definition.append(("Date pattern", "date pattern", date_inclusion, str)) - if files_not_readable: yield 1, "Files not readable: %s" % ", ".join(files_not_readable) @@ -380,6 +377,9 @@ def fileinfo_check_function(check_definition, params, outof_range_txt): states = [0] perfdata = [] for title, key, value, verbfunc in check_definition: + if value in [None, ""]: + continue + infotext = "%s: %s" % (title, verbfunc(value)) warn, crit = None, None for state, warn, crit, comp_text in _fileinfo_check_file(value, params, key):
6 years
1
0
0
0
← Newer
1
...
24
25
26
27
28
29
30
...
38
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
Results per page:
10
25
50
100
200