lists.checkmk.com
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
List overview
Download
Checkmk git commits
July 2018
----- 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
467 discussions
Start a n
N
ew thread
Add helper for checking whether or not tracking is active + early exit if not
by Lars Michelsen
Module: check_mk Branch: master Commit: ed23640261dc855d16fb22383052d82272caf1c3 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ed23640261dc85…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Fri Jul 27 13:01:56 2018 +0200 Add helper for checking whether or not tracking is active + early exit if not Change-Id: Ib3b08a4f5f94f5048aabadd47adcfa790a6b40a6 --- cmk/cpu_tracking.py | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/cmk/cpu_tracking.py b/cmk/cpu_tracking.py index d09de20..e14018a 100644 --- a/cmk/cpu_tracking.py +++ b/cmk/cpu_tracking.py @@ -59,33 +59,43 @@ def end(): def push_phase(phase): - if current_phase != None: - console.vverbose("[cpu_tracking] Push phase (Stack: %r)\n" % phase_stack) - phase_stack.append(current_phase) - _set_phase(phase) + if _is_not_tracking(): + return + + console.vverbose("[cpu_tracking] Push phase (Stack: %r)\n" % phase_stack) + phase_stack.append(current_phase) + _set_phase(phase) def pop_phase(): - if current_phase != None: - console.vverbose("[cpu_tracking] Pop current phase (Stack: %r)\n" % phase_stack) - if len(phase_stack) == 1: - _set_phase(None) - else: - _set_phase(phase_stack[-1]) + if _is_not_tracking(): + return + + console.vverbose("[cpu_tracking] Pop current phase (Stack: %r)\n" % phase_stack) + if len(phase_stack) == 1: + _set_phase(None) + else: + _set_phase(phase_stack[-1]) - del phase_stack[-1] + del phase_stack[-1] def get_times(): return times +def _is_not_tracking(): + return current_phase is None + + def _set_phase(phase): global current_phase - if current_phase != None: - console.vverbose("[cpu_tracking] Set phase: %s (previous %s)\n" % (phase, current_phase)) - _add_times_to_phase() - current_phase = phase + if _is_not_tracking(): + return + + console.vverbose("[cpu_tracking] Set phase: %s (previous %s)\n" % (phase, current_phase)) + _add_times_to_phase() + current_phase = phase def _add_times_to_phase():
6 years, 2 months
1
0
0
0
Fix time calculation bug and some clean ups on the way
by Lars Michelsen
Module: check_mk Branch: master Commit: aa5a17a28c4a4ca1dde543fe64a6ab76a0c07e15 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=aa5a17a28c4a4c…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Fri Jul 27 13:16:08 2018 +0200 Fix time calculation bug and some clean ups on the way * Removed the special case of current_phase. All elements of the phase stack are now in the stack list and the last element of the list is always the current phase. * Fix an accounting bug which lead to invalid time calculations. This issue made the Check_MK service report wrong run time information. Change-Id: I9e1caa27f266c3e54c3f7ab5295d0e5d36edb6f8 --- cmk/cpu_tracking.py | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/cmk/cpu_tracking.py b/cmk/cpu_tracking.py index e14018a..76fad2a 100644 --- a/cmk/cpu_tracking.py +++ b/cmk/cpu_tracking.py @@ -41,42 +41,38 @@ except NameError: times = {} last_time_snapshot = [] phase_stack = [] -current_phase = None def start(initial_phase): - global times, last_time_snapshot, current_phase, phase_stack - times = {} + global times, last_time_snapshot console.vverbose("[cpu_tracking] Start with phase '%s'\n" % initial_phase) + times = {} last_time_snapshot = _time_snapshot() - current_phase = initial_phase - phase_stack = [] - _set_phase(initial_phase) + + del phase_stack[:] + phase_stack.append(initial_phase) def end(): console.vverbose("[cpu_tracking] End\n") - _set_phase(None) + _add_times_to_phase() + del phase_stack[:] def push_phase(phase): if _is_not_tracking(): return - console.vverbose("[cpu_tracking] Push phase (Stack: %r)\n" % phase_stack) - phase_stack.append(current_phase) - _set_phase(phase) + console.vverbose("[cpu_tracking] Push phase '%s' (Stack: %r)\n" % (phase, phase_stack)) + _add_times_to_phase() + phase_stack.append(phase) def pop_phase(): if _is_not_tracking(): return - console.vverbose("[cpu_tracking] Pop current phase (Stack: %r)\n" % phase_stack) - if len(phase_stack) == 1: - _set_phase(None) - else: - _set_phase(phase_stack[-1]) - + console.vverbose("[cpu_tracking] Pop phase '%s' (Stack: %r)\n" % (phase_stack[-1], phase_stack)) + _add_times_to_phase() del phase_stack[-1] @@ -85,23 +81,13 @@ def get_times(): def _is_not_tracking(): - return current_phase is None - - -def _set_phase(phase): - global current_phase - if _is_not_tracking(): - return - - console.vverbose("[cpu_tracking] Set phase: %s (previous %s)\n" % (phase, current_phase)) - _add_times_to_phase() - current_phase = phase + return not bool(phase_stack) def _add_times_to_phase(): global last_time_snapshot new_time_snapshot = _time_snapshot() - for phase in current_phase, "TOTAL": + for phase in phase_stack[-1], "TOTAL": phase_times = times.get(phase, [ 0.0 ] * len(new_time_snapshot)) times[phase] = [ phase_times[i] + new_time_snapshot[i] - last_time_snapshot[i] @@ -110,4 +96,5 @@ def _add_times_to_phase(): def _time_snapshot(): + # TODO: Create a better structure for this data return list(os.times()[:4]) + [ time.time() ]
6 years, 2 months
1
0
0
0
Fixed lost host attributes after refcktoring
by Lars Michelsen
Module: check_mk Branch: master Commit: b3c6e2676292cf83c64e80ca79fc8ac7eb9eee9d URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b3c6e2676292cf…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Fri Jul 27 23:37:14 2018 +0200 Fixed lost host attributes after refcktoring Change-Id: I422edc914a7c5b700c5a18a9025e08a520966a55 --- cmk/gui/wato/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmk/gui/wato/__init__.py b/cmk/gui/wato/__init__.py index 951ab20..a55e748 100644 --- a/cmk/gui/wato/__init__.py +++ b/cmk/gui/wato/__init__.py @@ -1546,7 +1546,7 @@ class HostMode(WatoMode): configure_attributes( new=self._mode != "edit", - hosts={self._host.name(): self._host} if self._mode == "edit" else {}, + hosts={self._host.name(): self._host} if self._mode != "new" else {}, for_what="host" if not self._is_cluster() else "cluster", parent = watolib.Folder.current() )
6 years, 2 months
1
0
0
0
6375 FIX Fixed sidebar folding when " Show Check_MK edition & version in sidebar" is disabled
by Lars Michelsen
Module: check_mk Branch: master Commit: 4f82760a3613e3760729e031df939681a041c3fd URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4f82760a3613e3…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Mon Jul 30 11:55:36 2018 +0200 6375 FIX Fixed sidebar folding when "Show Check_MK edition & version in sidebar" is disabled When the global setting "Show Check_MK edition & version in sidebar" is disabled the folding of the sidebar was not possible in previous releases. Additionally, unacknowledged incompatible werks were shown while they should be hidden just like the version information. Change-Id: Ie6a19eabf2c53d3f22cae1402d118c19c90e1ea0 --- .werks/6375 | 14 ++++++++++++++ cmk/gui/sidebar.py | 11 ++++++----- web/htdocs/js/sidebar.js | 8 ++++++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.werks/6375 b/.werks/6375 new file mode 100644 index 0000000..1828810 --- /dev/null +++ b/.werks/6375 @@ -0,0 +1,14 @@ +Title: Fixed sidebar folding when "Show Check_MK edition & version in sidebar" is disabled +Level: 1 +Component: multisite +Class: fix +Compatible: compat +Edition: cre +State: unknown +Version: 1.6.0i1 +Date: 1532723132 + +When the global setting "Show Check_MK edition & version in sidebar" is disabled +the folding of the sidebar was not possible in previous releases. Additionally, +unacknowledged incompatible werks were shown while they should be hidden just +like the version information. diff --git a/cmk/gui/sidebar.py b/cmk/gui/sidebar.py index 7738979..2ea840c 100644 --- a/cmk/gui/sidebar.py +++ b/cmk/gui/sidebar.py @@ -232,11 +232,12 @@ def sidebar_head(): html.br() html.write(cmk.__version__) - if werks.may_acknowledge(): - num_unacknowledged_werks = werks.num_unacknowledged_incompatible_werks() - if num_unacknowledged_werks: - html.span(num_unacknowledged_werks, class_="unack_werks", - title=_("%d unacknowledged incompatible werks") % num_unacknowledged_werks) + if werks.may_acknowledge(): + num_unacknowledged_werks = werks.num_unacknowledged_incompatible_werks() + if num_unacknowledged_werks: + html.span(num_unacknowledged_werks, class_="unack_werks", + title=_("%d unacknowledged incompatible werks") % num_unacknowledged_werks) + html.close_a() html.close_div() html.close_a() diff --git a/web/htdocs/js/sidebar.js b/web/htdocs/js/sidebar.js index 5882a8c..47b2b00 100644 --- a/web/htdocs/js/sidebar.js +++ b/web/htdocs/js/sidebar.js @@ -514,7 +514,9 @@ function fold_sidebar() document.getElementById('check_mk_sidebar').style.position = "relative"; document.getElementById('check_mk_sidebar').style.left = "-265px"; document.getElementById('side_footer').style.display = "none"; - document.getElementById('side_version').style.display = "none"; + var version = document.getElementById('side_version'); + if (version) + version.style.display = "none"; parent.document.body.cols = sidebar_width() + ",*"; get_url('sidebar_fold.py?fold=yes'); } @@ -526,7 +528,9 @@ function unfold_sidebar() document.getElementById('check_mk_sidebar').style.position = ""; document.getElementById('check_mk_sidebar').style.left = "0"; document.getElementById('side_footer').style.display = ""; - document.getElementById('side_version').style.display = ""; + var version = document.getElementById('side_version'); + if (version) + version.style.display = ""; parent.document.body.cols = sidebar_width() + ",*"; get_url('sidebar_fold.py?fold='); }
6 years, 2 months
1
0
0
0
6205 HP ProLiant Power Supply Unit
by Moritz Kiemer
Module: check_mk Branch: master Commit: 3cd61175ac2633a9aff231afc817d4f0cd94678e URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3cd61175ac2633…
Author: Moritz Kiemer <mo(a)mathias-kettner.de> Date: Tue Jun 12 17:36:01 2018 +0200 6205 HP ProLiant Power Supply Unit hp_proliant_psu: Add information on the currently used capacity, per PS Unit and in total. Apply warning/critical levels to capacity in percent. Change-Id: I424299047365def951f0359671058cfbbfbfd39e --- .werks/6205 | 12 +++++ checkman/hp_proliant_psu | 10 +++- checks/hp_proliant_psu | 92 +++++++++++++++++++++++++------- cmk/gui/plugins/metrics/check_mk.py | 12 +++++ cmk/gui/plugins/wato/check_parameters.py | 20 +++++++ 5 files changed, 126 insertions(+), 20 deletions(-) diff --git a/.werks/6205 b/.werks/6205 new file mode 100644 index 0000000..0e47af2 --- /dev/null +++ b/.werks/6205 @@ -0,0 +1,12 @@ +Title: hp_proliant_psu: HP ProLiant Power Supply Unit +Level: 1 +Component: checks +Compatible: compat +Edition: cre +Version: 1.6.0i1 +Date: 1528817718 +Class: feature + +Add information on the currently used capacity, +per PS Unit and in total. Apply warning/critical levels to +capacity in percent. diff --git a/checkman/hp_proliant_psu b/checkman/hp_proliant_psu index 27bfdf0..fea46a0 100644 --- a/checkman/hp_proliant_psu +++ b/checkman/hp_proliant_psu @@ -7,11 +7,17 @@ description: This check connects to the SNMP agent installed on an operating system on a HP Proliant server and reads the information from the {CPQHLTH-MIB} MIB. + The systems SNMP agent is extended by the HP Management Agents which need to be installed on the monitored systems. - The check monitors the operational state of the PSUs in the server. + The check monitors the operational state of the PSUs in the server, as well + as the current capacity. + + You can change the default Warn/Crit levels of 80/90 percent by setting + the service parameter "HP ProLiant Power Supply Unit". inventory: One check is automatically created for each PSU entry which is provided - and marked as present in the SNMP output. + and marked as present in the SNMP output. Additionally one service is + created which sums up the used capacity. diff --git a/checks/hp_proliant_psu b/checks/hp_proliant_psu index 7f5a479..f6040c5 100644 --- a/checks/hp_proliant_psu +++ b/checks/hp_proliant_psu @@ -24,41 +24,97 @@ # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301 USA. -# Author: Lars Michelsen <lm(a)mathias-kettner.de> -hp_proliant_psu_status_map = { 1: 'other', 2: 'ok', 3: 'degraded', 4: 'failed' } -hp_proliant_status2nagios_map = { 'other': 3, 'ok': 0, 'degraded': 2, 'failed': 2 } -hp_proliant_present_map = { 1: 'other', 2: 'absent', 3: 'present' } -hp_proliant_redundant_map = { 1: 'other', 2: 'notRedundant', 3: 'redundant' } +condition_map = {'1': ('other', 3), # the status could not be + # determined or not present. + '2': ('ok', 0), # operating normally + '3': ('degraded', 2), # component is outside of + # normal operating range. + '4': ('failed', 2), # component detects condition + # that could damage system + } -def inventory_hp_proliant_psu(info): - if len(info) > 0: - return [ (line[0] + '/' + line[1], None) for line in info if line[2] == '3' ] -def check_hp_proliant_psu(item, params, info): - for line in info: - if '/' in item and line[0] + '/' + line [1] == item or line[0] == item: - chassis, bay, present, status, redundant = line - snmp_status = hp_proliant_psu_status_map[int(status)] - status = hp_proliant_status2nagios_map[snmp_status] +factory_settings["hp_proliant_psu_levels"] = { + "levels": (80, 90), +} + + +def parse_hp_proliant_psu(info): + parsed = {} + Psu = collections.namedtuple("Psu", ['chassis', 'bay', 'condition', + 'used', 'max']) + for chassis, bay, present, cond, used, capacity_maximum in info: + if present != '3' or capacity_maximum == '0': + continue + item = "%s/%s" % (chassis, bay) + try: + parsed[item] = Psu(chassis, bay, cond, + int(used), int(capacity_maximum)) + except ValueError: + pass + return parsed + + +def inventory_hp_proliant_psu(parsed): + """Inventorizes all present PSUs, as well as the Sum over all PSUs""" + for item in parsed: + yield item, None + yield 'Total', None + + +def check_hp_proliant_psu(item, params, parsed): + + psu = parsed.get(item) + if psu is not None: + yield 0, "Chassis %s/Bay %s" % (psu.chassis, psu.bay) + snmp_state, status = condition_map[psu.condition] + yield status, 'State: "%s"' % snmp_state + elif item != 'Total': + yield 3, "item not found in snmp data" + return + else: # compute Total + PsuTotal = collections.namedtuple("Psu", ['used', 'max']) + psu = PsuTotal(sum(v.used for v in parsed.values()), + sum(v.max for v in parsed.values())) + + # usage info + info = 'Usage: %d Watts' % psu.used + cap_perc = psu.used * 100 / psu.max + perf_data = [('power_usage_percentage', cap_perc), + ('power_usage', psu.used), + ] + + # check for user defined thresholds here + warn, crit = params["levels"] + msg = " (warn/crit at %s/%s)" % (warn, crit) + if cap_perc > crit: + yield 2, info + msg, perf_data + elif cap_perc > warn: + yield 1, info + msg, perf_data + else: + yield 0, info, perf_data + - return (status, 'PSU in chassis %s, bay %s is in state "%s"' % - (chassis, bay, snmp_status)) - return (3, "item not found in snmp data") check_info["hp_proliant_psu"] = { 'check_function': check_hp_proliant_psu, 'inventory_function': inventory_hp_proliant_psu, + 'parse_function': parse_hp_proliant_psu, + 'default_levels_variable': "hp_proliant_psu_levels", 'service_description': 'HW PSU %s', + 'group': 'hw_psu', 'snmp_info': ( ".1.3.6.1.4.1.232.6.2.9.3.1", [ "1", # cpqHeFltTolPowerSupplyChassis "2", # cpqHeFltTolPowerSupplyBay "3", # cpqHeFltTolPowerSupplyPresent "4", # cpqHeFltTolPowerSupplyCondition - "9", # cpqHeFltTolPowerSupplyRedundant + "7", # cpqHeFltTolPowerSupplyCapacityUsed + "8", # cpqHeFltTolPowerSupplyCapacityMaximum ] ), 'snmp_scan_function': \ lambda oid: "proliant" in oid(".1.3.6.1.4.1.232.2.2.4.2.0", "").lower(), + 'has_perfdata': True, } diff --git a/cmk/gui/plugins/metrics/check_mk.py b/cmk/gui/plugins/metrics/check_mk.py index bcdaff3..af5a642 100644 --- a/cmk/gui/plugins/metrics/check_mk.py +++ b/cmk/gui/plugins/metrics/check_mk.py @@ -749,6 +749,18 @@ metric_info["trend_hoursleft"] = { "color" : "#94b65a", } +metric_info["power_usage_percentage"] = { + "title" : _("Power Usage"), + "color" : "13/a", + "unit" : "%", +} + +metric_info["power_usage"] = { + "title" : _("Power Usage"), + "color" : "13/b", + "unit" : "w", +} + metric_info["swap_total"] = { "title" : _("Swap installed"), "color": "#e0e0e0", diff --git a/cmk/gui/plugins/wato/check_parameters.py b/cmk/gui/plugins/wato/check_parameters.py index 57d9f3c..bbf48f8 100644 --- a/cmk/gui/plugins/wato/check_parameters.py +++ b/cmk/gui/plugins/wato/check_parameters.py @@ -5122,6 +5122,26 @@ register_check_parameters( ) +register_check_parameters( + subgroup_environment, + 'hw_psu', + _("Power Supply Unit"), + Dictionary( + elements = [ + ("levels", Tuple( + title = _("PSU Capacity Levels"), + elements = [ + Percentage(title = _("Warning at"), default_value = 80.0), + Percentage(title = _("Critical at"), default_value = 90.0), + ], + )), + ], + ), + None, + match_type = "dict" +) + + #. # .--Storage-------------------------------------------------------------. # | ____ _ |
6 years, 2 months
1
0
0
0
Fixed refcktoring issue
by Lars Michelsen
Module: check_mk Branch: master Commit: d277e6189e8f9ec719f8dd897ad5abb50163970c URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d277e6189e8f9e…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Fri Jul 27 23:13:23 2018 +0200 Fixed refcktoring issue Change-Id: I8a9130d735a192c5ac1a97df3c2ad41207d68d50 --- cmk/gui/plugins/visuals/filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmk/gui/plugins/visuals/filters.py b/cmk/gui/plugins/visuals/filters.py index f5c625c..23814fe 100644 --- a/cmk/gui/plugins/visuals/filters.py +++ b/cmk/gui/plugins/visuals/filters.py @@ -1195,7 +1195,7 @@ class FilterStarred(FilterTristate): def __init__(self, what): self.what = what - title = what == _("Favorite Hosts") if what == "host" else _("Favorite Services") + title = _("Favorite Hosts") if what == "host" else _("Favorite Services") FilterTristate.__init__(self, name = what + "_favorites",
6 years, 2 months
1
0
0
0
Fix error with registration of LegacyUserAttribute
by Tom Baerwinkel
Module: check_mk Branch: master Commit: 7b3696918f50cc38d9e0c045f8bedf4de4864e5b URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7b3696918f50cc…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de> Date: Fri Jul 27 17:13:31 2018 +0200 Fix error with registration of LegacyUserAttribute Change-Id: If8a928ba4973f30a7554fcc1eab3f839f1931eb6 --- cmk/gui/userdb.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/cmk/gui/userdb.py b/cmk/gui/userdb.py index 33919b8..d0b6529 100644 --- a/cmk/gui/userdb.py +++ b/cmk/gui/userdb.py @@ -491,25 +491,29 @@ def convert_session_info(value): class GenericUserAttribute(cmk.gui.plugins.userdb.UserAttribute): - def __init__(self, name, valuespec, user_editable, show_in_table, topic, add_custom_macro, domain, permission, from_config): + def __init__(self, user_editable, show_in_table, add_custom_macro, domain, permission, from_config): super(GenericUserAttribute, self).__init__() - self._name = name - self._valuespec = valuespec self._user_editable = user_editable self._show_in_table = show_in_table - self._topic = topic self._add_custom_macro = add_custom_macro self._domain = domain self._permission = permission self._from_config = from_config - def name(self): - return self._name + @classmethod + def name(cls): + return cls._name - def valuespec(self): - return self._valuespec + @classmethod + def valuespec(cls): + return cls._valuespec + + + @classmethod + def topic(cls): + return cls._topic def from_config(self): @@ -528,10 +532,6 @@ class GenericUserAttribute(cmk.gui.plugins.userdb.UserAttribute): return self._show_in_table - def topic(self): - return self._topic - - def add_custom_macro(self): return self._add_custom_macro @@ -547,13 +547,14 @@ def declare_user_attribute(name, vs, user_editable = True, permission = None, @user_attribute_registry.register class LegacyUserAttribute(GenericUserAttribute): + _name = name + _valuespec = vs + _topic = topic if topic else 'personal' + def __init__(self): super(LegacyUserAttribute, self).__init__( - name, - valuespec=vs, user_editable=user_editable, show_in_table=show_in_table, - topic=topic and topic or 'personal', add_custom_macro=add_custom_macro, domain=domain, permission=permission,
6 years, 2 months
1
0
0
0
Add missing topics for attributes in the personal settings section
by Tom Baerwinkel
Module: check_mk Branch: master Commit: c5941cc2dd38cf2a403fd9931ccbf54fd1f5d2db URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c5941cc2dd38cf…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de> Date: Fri Jul 27 12:48:12 2018 +0200 Add missing topics for attributes in the personal settings section Add the topic "personal" to the personal settings of a user. This fixes a bug that the personal settings of a user did not load completely and saving a user resulted in a crash. Change-Id: I4cf7c1912061bb38cc4f6c7c3881f326f6b88edc --- cmk/gui/plugins/userdb/user_attributes.py | 20 ++++++++++++++++++++ cmk/gui/plugins/userdb/utils.py | 11 ++++++----- cmk/gui/wato/__init__.py | 2 +- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/cmk/gui/plugins/userdb/user_attributes.py b/cmk/gui/plugins/userdb/user_attributes.py index db08f37..bde8b0e 100644 --- a/cmk/gui/plugins/userdb/user_attributes.py +++ b/cmk/gui/plugins/userdb/user_attributes.py @@ -36,6 +36,10 @@ class ForceAuthUserUserAttribute(UserAttribute): return "force_authuser" + def topic(self): + return "personal" + + def valuespec(self): return Checkbox( title = _("Visibility of Hosts/Services"), @@ -59,6 +63,10 @@ class ForceAuthUserWebserviceUserAttribute(UserAttribute): return "force_authuser_webservice" + def topic(self): + return "personal" + + def valuespec(self): return Checkbox( title = _("Hosts/Service visibility (Webservice, Deprecated)"), @@ -82,6 +90,10 @@ class DisableNotificationsUserAttribute(UserAttribute): return "disable_notifications" + def topic(self): + return "personal" + + def valuespec(self): return Transform(Dictionary( title=_("Disable Notifications"), @@ -123,6 +135,10 @@ class StartURLUserAttribute(UserAttribute): return "start_url" + def topic(self): + return "personal" + + def valuespec(self): return Transform( Alternative( @@ -161,6 +177,10 @@ class UIThemeUserAttribute(UserAttribute): return "ui_theme" + def topic(self): + return "personal" + + def valuespec(self): return Alternative( title = _("User interface theme"), diff --git a/cmk/gui/plugins/userdb/utils.py b/cmk/gui/plugins/userdb/utils.py index 5872229..7ea3146 100644 --- a/cmk/gui/plugins/userdb/utils.py +++ b/cmk/gui/plugins/userdb/utils.py @@ -147,6 +147,12 @@ class UserAttribute(object): @abc.abstractmethod + def topic(self): + # type: () -> bytes + raise NotImplementedError() + + + @abc.abstractmethod def valuespec(self): raise NotImplementedError() @@ -171,11 +177,6 @@ class UserAttribute(object): return False - def topic(self): - # type: () -> Optional[bytes] - return None - - def add_custom_macro(self): # type: () -> bool return False diff --git a/cmk/gui/wato/__init__.py b/cmk/gui/wato/__init__.py index 01efc21..951ab20 100644 --- a/cmk/gui/wato/__init__.py +++ b/cmk/gui/wato/__init__.py @@ -10707,7 +10707,7 @@ class ModeEditUser(WatoMode): ) - def _show_custom_user_attributes(self, topic=None): + def _show_custom_user_attributes(self, topic): for name, attr in userdb.get_user_attributes(): if topic is not None and topic != attr.topic(): continue # skip attrs of other topics
6 years, 2 months
1
0
0
0
6140 mssql_blocked_sessions: Now the check is instance aware
by Simon Betz
Module: check_mk Branch: master Commit: 0766ab0c9fd86dc701e5847dbff6442b0bd865a7 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0766ab0c9fd86d…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Mon Jun 25 15:57:49 2018 +0200 6140 mssql_blocked_sessions: Now the check is instance aware Change-Id: Id5b316d26cea6d71895700dd2f126ff63f032905 --- .werks/6140 | 18 +++++++ agents/windows/plugins/mssql.vbs | 9 +++- checks/mssql_blocked_sessions | 90 ++++++++++++++++++++------------ cmk/gui/plugins/wato/check_parameters.py | 34 ++++++++++++ cmk_base/config.py | 2 +- 5 files changed, 118 insertions(+), 35 deletions(-) diff --git a/.werks/6140 b/.werks/6140 new file mode 100644 index 0000000..b336ef8 --- /dev/null +++ b/.werks/6140 @@ -0,0 +1,18 @@ +Title: mssql_blocked_sessions: This check is now instance aware +Level: 1 +Component: checks +Compatible: incomp +Edition: cre +Version: 1.6.0i1 +Date: 1529935714 +Class: feature + +In order to make this check work take the following steps: +<ul> +<li>Install the newest agent plugin {{mssql.vbs}}.</li> + +<li>Transform all configured parameters from the old deprecared ruleset +{{MSSQL Blocked Sessions}} into the new ruleset of the same name.</li> + +<li>Perform a rediscovery on the affected hosts.</li> +</ul> diff --git a/agents/windows/plugins/mssql.vbs b/agents/windows/plugins/mssql.vbs index f7e7921..c50f109 100644 --- a/agents/windows/plugins/mssql.vbs +++ b/agents/windows/plugins/mssql.vbs @@ -307,13 +307,18 @@ For Each instance_id In instances.Keys: Do ' Continue trick "FROM sys.dm_os_waiting_tasks " & _ "WHERE blocking_session_id <> 0 ", CONN addOutput(sections("blocked_sessions")) - Dim session_id, wait_duration_ms, wait_type, blocking_session_id + Dim instanceName, session_id, wait_duration_ms, wait_type, blocking_session_id Do While NOT RS.Eof + instanceName = Replace(Trim(RS("instance_name")), " ", "_") + If instanceName = "" Then + instanceName = "None" + End If session_id = Trim(RS("session_id")) wait_duration_ms = Trim(RS("wait_duration_ms")) wait_type = Trim(RS("wait_type")) blocking_session_id = Trim(RS("blocking_session_id")) - addOutput(session_id & "|" & wait_duration_ms & "|" & wait_type & "|" & blocking_session_id) + addOutput(instanceName & "|" session_id & "|" & wait_duration_ms & "|" & _ + wait_type & "|" & blocking_session_id) RS.MoveNext Loop RS.Close diff --git a/checks/mssql_blocked_sessions b/checks/mssql_blocked_sessions index a9e163a..2d6519e 100644 --- a/checks/mssql_blocked_sessions +++ b/checks/mssql_blocked_sessions @@ -35,49 +35,74 @@ # schema as "mssql_instance". -factory_settings['mssql_blocked_sessions_default_levels'] = {'state': 2} +factory_settings['mssql_blocked_sessions_default_levels'] = { + 'state': 2, +} + + +def parse_mssql_blocked_sessions(info): + db_instance = collections. namedtuple("DBInstance", ["session_id", "wait_type", + "blocking_session_id", "wait_duration"]) + parsed = {} + for line in info: + if len(line) == 5: + inst, session_id, wait_duration_ms, wait_type, blocking_session_id = line + elif len(line) == 4: + session_id, wait_duration_ms, wait_type, blocking_session_id = line + inst = "" + else: + continue + parsed.setdefault(inst, []).append( + db_instance(session_id, wait_type, + blocking_session_id, float(wait_duration_ms)/1000,)) + return parsed -def inventory_mssql_blocked_sessions(info): - return [(None, {})] +def inventory_mssql_blocked_sessions(parsed): + for instance in parsed: + yield instance, {} + + +def check_mssql_blocked_sessions(item, params, parsed): + if item not in parsed: + # Assume general connection problem to the database, which is reported + # by the "X Instance" service and skip this check. + raise MKCounterWrapped("Failed to retrieve data from database") -def check_mssql_blocked_sessions(_no_item, params, info): summary = {} details = [] + warn, crit = params.get('waittime', (None, None)) ignored_waittypes = set() - for line in info: - if "blocked" in line[0].lower(): - continue # Skip debug output which was send by old agent by accident + waittypes_to_be_ignored = params.get("ignore_waittypes", []) - session_id, wait_duration_ms, wait_type, blocking_session_id = line - - if wait_type in params.get("ignore_waittypes", []): - ignored_waittypes.add(wait_type) + for e in parsed[item]: + if e.wait_type in waittypes_to_be_ignored: + ignored_waittypes.add(e.wait_type) continue + level_info = "" state = 0 - if params.has_key('waittime'): - warn, crit = params['waittime'] - wait_duration_sec = float(wait_duration_ms) / 1000 - if wait_duration_sec >= crit: - state = 2 - elif wait_duration_sec >= warn: - state = 1 - - summary.setdefault(session_id, set()) - summary[session_id].add(blocking_session_id) - details.append((state, "Session %s blocked by %s (Wait %s ms, Type: %s)" % \ - (session_id, blocking_session_id, wait_duration_ms, wait_type))) + if crit is not None and e.wait_duration >= crit: + state = 2 + elif warn is not None and e.wait_duration >= warn: + state = 1 + if state: + level_info = " (warn/crit at %s/%s)" % ( + get_age_human_readable(warn), + get_age_human_readable(crit)) + + summary.setdefault(e.session_id, 0) + summary[e.session_id] += 1 + details.append((state, "Session %s blocked by %s (Type: %s, Wait: %s)%s" % \ + (e.session_id, e.blocking_session_id, e.wait_type, + get_age_human_readable(e.wait_duration), level_info))) if summary: - yield params['state'], "Summary: %s" % \ - ", ".join(["%s blocked by %s ID(s)" % (k, len(v)) - for k,v in summary.items()]) - - fst_state, fst_infotext = details[0] - yield fst_state, "\nDetails:\n%s" % fst_infotext - for state, infotext in details[1:]: + yield params['state'], "Summary: %s" % ( + ", ".join(["%s blocked by %s ID(s)" % (k, v) + for k,v in summary.iteritems()])) + for state, infotext in details: yield state, "\n%s" % infotext else: @@ -88,9 +113,10 @@ def check_mssql_blocked_sessions(_no_item, params, info): check_info['mssql_blocked_sessions'] = { + 'parse_function' : parse_mssql_blocked_sessions, 'inventory_function' : inventory_mssql_blocked_sessions, 'check_function' : check_mssql_blocked_sessions, - 'service_description' : 'MSSQL Blocked Sessions', - 'group' : 'mssql_blocked_sessions', + 'service_description' : 'MSSQL %s Blocked Sessions', + 'group' : 'mssql_instance_blocked_sessions', 'default_levels_variable' : 'mssql_blocked_sessions_default_levels', } diff --git a/cmk/gui/plugins/wato/check_parameters.py b/cmk/gui/plugins/wato/check_parameters.py index 55778f0..57d9f3c 100644 --- a/cmk/gui/plugins/wato/check_parameters.py +++ b/cmk/gui/plugins/wato/check_parameters.py @@ -11026,6 +11026,40 @@ register_check_parameters( ), None, "dict", + deprecated=True, +) + +register_check_parameters( + subgroup_applications, + "mssql_instance_blocked_sessions", + _("MSSQL Blocked Sessions"), + Dictionary( + elements = [ + ("state", MonitoringState( + title=_("State of MSSQL Blocked Sessions is treated as"), + help=_("The default state if there is at least one " + "blocked session."), + default_value=2, + )), + ("waittime", Tuple( + title=_("Levels for wait"), + help=_("The threshholds for wait_duration_ms. Will " + "overwrite the default state set above."), + default_value=(0, 0), + elements=[ + Float(title = _("Warning at"), unit = _("seconds"), display_format = "%.3f"), + Float(title = _("Critical at"), unit = _("seconds"), display_format = "%.3f"), + ] + )), + ("ignore_waittypes", DualListChoice( + title=_("Ignore wait types"), + rows=40, + choices=[ (entry, entry) for entry in mssql_waittypes ], + )), + ], + ), + TextAscii(title=_("Instance name")), + "dict", ) register_check_parameters( diff --git a/cmk_base/config.py b/cmk_base/config.py index 9bc15b6..be96928 100644 --- a/cmk_base/config.py +++ b/cmk_base/config.py @@ -1323,7 +1323,7 @@ _old_service_descriptions = { "mssql_tablespaces" : "%s Sizes", "mssql_transactionlogs" : "Transactionlog %s", "mssql_versions" : "%s Version", - + "mssql_blocked_sessions" : lambda item: (False, "MSSQL Blocked Sessions"), } def service_description(hostname, check_plugin_name, item):
6 years, 2 months
1
0
0
0
Fixed recently introduced formating issue
by Lars Michelsen
Module: check_mk Branch: master Commit: 28613ffb3f0e6f22581977e3cc4e2a635202e844 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=28613ffb3f0e6f…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Fri Jul 27 15:12:27 2018 +0200 Fixed recently introduced formating issue Change-Id: Ie4b1e6fbf1751d14f7abe4f1ad860fc619929aa6 --- cmk/tty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmk/tty.py b/cmk/tty.py index 63e9be7..e9f2a4d 100644 --- a/cmk/tty.py +++ b/cmk/tty.py @@ -115,7 +115,7 @@ def print_table(headers, colors, rows, indent = ""): if type(x) == unicode: return x.encode('utf-8') else: - return "%s" % x + return "%s" % (x,) for row in rows: lengths = [ max(len(make_utf8(c)), l) for c, l in zip(row, lengths) ]
6 years, 2 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
47
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Results per page:
10
25
50
100
200