lists.checkmk.com
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
List overview
Download
Checkmk git commits
May 2011
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
checkmk-commits@lists.checkmk.com
2 participants
134 discussions
Start a n
N
ew thread
Check_MK Git: check_mk: WATO: do snmp scan only on button
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 839f469a604986dee2273bb3c48265cf5c603ee0 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=839f469a604986…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 17:26:19 2011 +0200 WATO: do snmp scan only on button --- ChangeLog | 2 ++ modules/automation.py | 15 ++++++++++++++- web/htdocs/wato.py | 30 ++++++++++++++++++++---------- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index b569d56..e621f49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,8 @@ * Bulk operation on host lists (inventory, tags changed, etc) * Easy search operation in host lists * Dialog for global host search + * Services dialog now tries to use cached data. On SNMP hosts + no scan will be done until new button "Full Scan" is pressed. MK Livestatus: * Column aggregation (Stats) now also works for perf_data diff --git a/modules/automation.py b/modules/automation.py index 0d7a703..298fa97 100644 --- a/modules/automation.py +++ b/modules/automation.py @@ -120,6 +120,11 @@ def automation_inventory(args): def automation_try_inventory(args): + if args[0] == '--cache': + global opt_use_cachefile + opt_use_cachefile = True + args = args[1:] + hostname = args[0] try: ipaddress = lookup_ipaddress(hostname) @@ -128,8 +133,16 @@ def automation_try_inventory(args): f = [] + # if we are using cache files, then we restrict us to existing + # check types. SNMP scan is only done without the --cache option if is_snmp_host(hostname): - f = do_snmp_scan([hostname], True, True) + if opt_use_cachefile: + existing_checks = set([ cn for (cn, item) in get_check_table(hostname) ]) + for cn in inventorable_checktypes("snmp"): + if cn in existing_checks: + f += make_inventory(cn, [hostname], True, True) + else: + f = do_snmp_scan([hostname], True, True) if is_tcp_host(hostname): for cn in inventorable_checktypes("tcp"): diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py index 2bd9527..1821cec 100644 --- a/web/htdocs/wato.py +++ b/web/htdocs/wato.py @@ -744,11 +744,22 @@ def mode_inventory(phase, firsttime): raise MKGeneralException("You called this page for a non-existing host.") if phase == "title": - return "Services of host %s" % hostname + title = "Services of host %s" % hostname + if html.var("scan"): + title += " (live scan)" + else: + title += " (cached data)" + return title + + elif phase == "buttons": + html.context_button(_("Host list"), make_link([("mode", "file")])) + html.context_button(_("Edit host"), make_link([("mode", "edithost"), ("host", hostname)])) + html.context_button(_("Full Scan"), html.makeuri([("scan", "yes")])) elif phase == "action": if html.check_transaction(): - table = check_mk_automation("try-inventory", [hostname]) + cache_options = not html.var("scan") and [ '--cache' ] or [] + table = check_mk_automation("try-inventory", cache_options + [hostname]) table.sort() active_checks = {} new_target = "file" @@ -768,9 +779,6 @@ def mode_inventory(phase, firsttime): return new_target, message return "file" - elif phase == "buttons": - html.context_button("Host list", make_link([("mode", "file")])) - html.context_button("Edit host", make_link([("mode", "edithost"), ("host", hostname)])) else: show_service_table(hostname, firsttime) @@ -1429,15 +1437,15 @@ def check_mk_automation(command, args=[], indata=""): sudoline = None if defaults.check_mk_automation: commandargs = defaults.check_mk_automation.split() - cmd = commandargs + [ command ] + args + cmd = commandargs + [ command, '--' ] + args else: omd_mode, omd_site = html.omd_mode() if not omd_mode or omd_mode == 'own': commandargs = [ 'check_mk', '--automation' ] - cmd = commandargs + [ command ] + args + cmd = commandargs + [ command, '--' ] + args else: # OMD shared mode commandargs = [ 'sudo', '/bin/su', '-', omd_site, '-c', 'check_mk --automation' ] - cmd = commandargs[:-1] + [ commandargs[-1] + ' ' + ' '.join([ command ] + args) ] + cmd = commandargs[:-1] + [ commandargs[-1] + ' ' + ' '.join([ command, '--' ] + args) ] sudoline = "%s ALL = (root) NOPASSWD: /bin/su - %s -c check_mk\\ --automation\\ *" % (html.apache_user(), omd_site) sudo_msg = '' @@ -1753,7 +1761,8 @@ def changelog_button(): def show_service_table(hostname, firsttime): # Read current check configuration - table = check_mk_automation("try-inventory", [hostname]) + cache_options = not html.var("scan") and [ '--cache' ] or [] + table = check_mk_automation("try-inventory", cache_options + [hostname]) table.sort() html.begin_form("checks", None, "POST") @@ -1771,8 +1780,9 @@ def show_service_table(hostname, firsttime): if fixall == 2: html.button("_fixall", "Fix all missing/exceeding") + if len(table) > 0: + html.button("_save", _("Save manual check configuration")) - html.button("_save", "Save manual check configuration") html.hidden_fields() html.write("<table class=data>\n")
13 years, 6 months
1
0
0
0
Check_MK Git: check_mk: Multisite: fix another UTF-8 problem
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 06ea3b4b05a05d81dbd72214c93419c2477272e4 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=06ea3b4b05a05d…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 16:42:43 2011 +0200 Multisite: fix another UTF-8 problem --- web/htdocs/htmllib.py | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py index 07febe4..662f981 100644 --- a/web/htdocs/htmllib.py +++ b/web/htdocs/htmllib.py @@ -410,32 +410,32 @@ class html: def html_head(self, title): if not self.req.header_sent: - self.req.write( + self.write( u'''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd
"> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>''') # Ich versteh mit dem drecks UTF-8 bald garnix mehr... # self.req.write(title.encode("utf-8")) - self.req.write(title) - self.req.write('''</title> + self.write(title) + self.write('''</title> <link rel="stylesheet" type="text/css" href="check_mk.css">''') if config.custom_style_sheet: - self.req.write(' <link rel="stylesheet" type="text/css" href="%s">' % config.custom_style_sheet) - self.req.write(''' + self.write(' <link rel="stylesheet" type="text/css" href="%s">' % config.custom_style_sheet) + self.write(''' <script type='text/javascript' src='js/check_mk.js'></script> <script type='text/javascript' src='js/hover.js'></script> ''') if self.browser_reload != 0: if self.browser_redirect != '': - self.req.write("<script type=\"text/javascript\">setReload(%s, '%s')</script>\n" % + self.write("<script type=\"text/javascript\">setReload(%s, '%s')</script>\n" % (self.browser_reload, self.browser_redirect)) else: - self.req.write("<script type=\"text/javascript\">setReload(%s)</script>\n" % self.browser_reload) + self.write("<script type=\"text/javascript\">setReload(%s)</script>\n" % self.browser_reload) - self.req.write("</head>\n") + self.write("</head>\n") self.req.header_sent = True def html_foot(self): @@ -475,7 +475,7 @@ class html: if self.focus_object: formname, varname = self.focus_object obj = formname + "." + varname - self.req.write("<script language=\"javascript\" type=\"text/javascript\">\n" + self.write("<script language=\"javascript\" type=\"text/javascript\">\n" "<!--\n" "document.%s.focus();\n" "document.%s.select();\n" @@ -489,7 +489,7 @@ class html: if self.browser_reload: corner_text += "refresh: %d secs" % self.browser_reload si = self.render_status_icons() - self.req.write("<table class=footer><tr>" + self.write("<table class=footer><tr>" "<td class=left>%s</td>" "<td class=middle></td>" "<td class=right>%s</td></tr></table>"
13 years, 6 months
1
0
0
0
Check_MK Git: check_mk: WATO: no pending log after deletion of empty file
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 82eb21cce345349ee6bcf84329f576805f453339 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=82eb21cce34534…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 15:50:10 2011 +0200 WATO: no pending log after deletion of empty file --- web/htdocs/wato.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py index 42bfa1b..2bd9527 100644 --- a/web/htdocs/wato.py +++ b/web/htdocs/wato.py @@ -1875,7 +1875,10 @@ def delete_file_after_confirm(del_file): hosts = read_configuration_file(g_folder, del_file) for delname in hosts: check_mk_automation("delete-host", [delname]) - log_pending(del_file, "delete-file", "Deleted file %s" % del_file["title"]) + if len(hosts) > 0: + log_pending(del_file, "delete-file", _("Deleted file %s") % del_file["title"]) + else: + log_audit(del_file, "delete-file", _("Deleted empty file %s") % del_file["title"]) del g_files[del_file["path"]] del g_folder["files"][del_file["name"]] delete_configuration_file(g_folder, del_file)
13 years, 6 months
1
0
0
0
Check_MK Git: check_mk: WATO: Button for clearing the audit log
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 5cf88f039fa1644c0ed3f3cbc731ac9b393354d5 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5cf88f039fa164…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 15:41:58 2011 +0200 WATO: Button for clearing the audit log --- web/htdocs/wato.py | 59 ++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 48 insertions(+), 11 deletions(-) diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py index 17bc7f8..42bfa1b 100644 --- a/web/htdocs/wato.py +++ b/web/htdocs/wato.py @@ -1241,20 +1241,25 @@ def mode_changelog(phase): elif phase == "buttons": html.context_button("Back", make_link([("mode", "folder")])) - pending = parse_audit_log("pending") - if len(pending) > 0: + if log_exists("pending"): html.context_button(_("Activate Changes!"), - html.makeuri([("_action", "activate"), ("_transid", html.current_transid())]), True) + html.makeuri([("_action", "activate"), ("_transid", html.current_transid())]), True) + if log_exists("audit"): + html.context_button(_("Clear Audit Log"), + html.makeuri([("_action", "clear"), ("_transid", html.current_transid())])) elif phase == "action": - if html.check_transaction(): - try: - check_mk_automation("restart") - except Exception, e: - raise MKUserError(None, str(e)) - log_commit_pending() # flush logfile with pending actions - log_audit(None, "activate-config", "Configuration activated, monitoring server restarted") - return None, "The new configuration has been successfully activated." + if html.var("_action") == "clear": + return clear_audit_log_after_confirm() + elif html.check_transaction(): + try: + check_mk_automation("restart") + except Exception, e: + raise MKUserError(None, str(e)) + log_commit_pending() # flush logfile with pending actions + log_audit(None, "activate-config", "Configuration activated, monitoring server restarted") + return None, "The new configuration has been successfully activated." + else: pending = parse_audit_log("pending") @@ -1307,6 +1312,33 @@ def log_commit_pending(): if os.path.exists(pending): os.remove(pending) +def clear_audit_log(): + path = conf_dir + "/audit.log" + if os.path.exists(path): + newpath = path + time.strftime(".%Y-%m-%d") + if os.path.exists(newpath): + n = 1 + while True: + n += 1 + with_num = newpath + "-%d" % n + if not os.path.exists(with_num): + newpath = with_num + break + os.rename(path, newpath) + +def clear_audit_log_after_confirm(): + if not html.transaction_valid(): + return None # Browser reload + wato_html_head(_("Confirm deletion of audit logfile")) + c = html.confirm(_("Do you really want to clear audit logfile?")) + if c: + clear_audit_log() + return None, _("Cleared audit logfile.") + elif c == False: # not yet confirmed + return "" + else: + return None # browser reload + def parse_audit_log(what): path = conf_dir + "/" + what + ".log" if os.path.exists(path): @@ -1318,6 +1350,11 @@ def parse_audit_log(what): return entries return [] +def log_exists(what): + path = conf_dir + "/" + what + ".log" + return os.path.exists(path) + + def render_linkinfo(linkinfo): if ':' in linkinfo:
13 years, 6 months
1
0
0
0
Check_MK Git: check_mk: WATO: sort host-move combos alphabetically
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: eb38ae17df131dbbe67e30664545a41afdf8b594 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eb38ae17df131d…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 15:26:58 2011 +0200 WATO: sort host-move combos alphabetically --- web/htdocs/wato.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py index 1cb4687..17bc7f8 100644 --- a/web/htdocs/wato.py +++ b/web/htdocs/wato.py @@ -1876,7 +1876,7 @@ def host_move_combo(host = None): else: html.hidden_field("host", host) uri = html.makeuri([("host", host), ("_transid", html.current_transid() )]) - html.select(None, selections, "", + html.sorted_select(None, selections, "", "location.href='%s' + '&_move_host_to=' + this.value;" % uri);
13 years, 6 months
1
0
0
0
Check_MK Git: check_mk: WATO: bulk inventory: allow to just retry failed hosts
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: c341df84fe5253a2aafe6145423d120ed81c0704 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c341df84fe5253…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 15:24:30 2011 +0200 WATO: bulk inventory: allow to just retry failed hosts --- web/htdocs/js/wato.js | 75 ++++++++++++++++++++++++++++++++++++++++-------- web/htdocs/wato.py | 19 ++++++------ 2 files changed, 72 insertions(+), 22 deletions(-) diff --git a/web/htdocs/js/wato.js b/web/htdocs/js/wato.js index 2ed080a..66f8a81 100644 --- a/web/htdocs/js/wato.js +++ b/web/htdocs/js/wato.js @@ -30,7 +30,7 @@ function getElementsByClass(cl) { var items = new Array(); var elements = document.getElementsByTagName('*'); for(var i = 0; i < elements.length; i++) - if(elements[i].className == cl) + if (elements[i].className == cl) items.push(elements[i]); return items; } @@ -42,7 +42,7 @@ function wato_check_all(css_class) { // First check if all boxes are checked var all_checked = true; for(var i = 0; i < items.length && all_checked == true; i++) - if(items[i].checked == false) + if (items[i].checked == false) all_checked = false; // Now set the new state @@ -55,8 +55,16 @@ function wato_check_all(css_class) { // ---------------------------------------------------------------------------- +// WATO mode during progress +var progress_mode = null; +// WATO url belonging to progress +var progress_url = null; +// timeout for progress +var progress_timeout = null; // Keeps the items to be fetched var progress_items = null; +// items failed, needed for retry +var failed_items = null; // Number of total items to handle var progress_total_num = 0; // The URL to redirect to after finish/abort button pressed @@ -81,7 +89,7 @@ function progress_handle_response(data, code) { alert('Invalid response: ' + code); } - if(header === null) { + if (header === null) { alert('Header is null!'); } @@ -97,14 +105,15 @@ function progress_handle_response(data, code) { update_progress_bar(header); // Process optional body - if(typeof(body) !== 'undefined' && body != '') + if (typeof(body) !== 'undefined' && body != '') progress_attach_log(body); - if(header[0] === 'pause') { + if (header[0] === 'pause') progress_pause(); - } else if(header[0] === 'abort') { + else if (header[0] == 'failed') + failed_items.push(item); + else if (header[0] === 'abort') return; - } progress_items.shift(); progress_running = false; @@ -126,6 +135,19 @@ function progress_proceed() { document.getElementById('progress_proceed').style.display = 'none'; } +function progress_retry() { + document.getElementById('progress_retry').style.display = 'none'; + document.getElementById('progress_pause').style.display = ''; + document.getElementById('progress_abort').style.display = ''; + progress_clean_log(); + clear_progress_stats(); + progress_items = failed_items; + failed_items = Array(); + progress_scheduler(progress_mode, progress_url, progress_timeout, [], "", ""); +} + + + /* Is called when the processing is completely finished */ function progress_finished() { update_progress_title(progress_fin_txt); @@ -135,6 +157,9 @@ function progress_finished() { document.getElementById('progress_pause').style.display = 'none'; document.getElementById('progress_proceed').style.display = 'none'; document.getElementById('progress_abort').style.display = 'none'; + if (failed_items.length > 0) + document.getElementById('progress_retry').style.display = ''; + } /* Is called by the users abort/finish button click */ @@ -144,10 +169,22 @@ function progress_end() { location.href = progress_end_url; } +function clear_progress_stats() { + for(var i = 1; i < 100; i++) { + var o = document.getElementById('progress_stat' + (i - 1)); + if (o) { + o.innerHTML = "0"; + o = null; + } + else + break; + } +} + function update_progress_stats(header) { for(var i = 1; i < header.length; i++) { var o = document.getElementById('progress_stat' + (i - 1)); - if(o) { + if (o) { o.innerHTML = parseInt(o.innerHTML) + parseInt(header[i]); o = null; } @@ -178,26 +215,38 @@ function progress_attach_log(t) { log = null; } +function progress_clean_log() { + var log = document.getElementById('progress_log'); + log.innerHTML = ''; + log.scrollTop = 0; + log = null; +} + function progress_scheduler(mode, url_prefix, timeout, items, end_url, finished_txt) { // Initialize - if(progress_items === null) { + if (progress_items === null) { progress_items = items; + failed_items = Array(); progress_total_num = items.length; progress_end_url = end_url; progress_fin_txt = finished_txt; + progress_mode = mode; + progress_url = url_prefix; + progress_timeout = timeout; } // Escape the loop when ended - if(progress_ended) + if (progress_ended) return false; // Regular processing when not paused and not already running - if(!progress_paused && !progress_running) { - if(progress_items.length > 0) { + if (!progress_paused && !progress_running) { + if (progress_items.length > 0) { // Progressing progress_running = true; update_progress_title(progress_items[0]); - get_url(url_prefix + '&_transid=-1&_item=' + escape(progress_items[0]), progress_handle_response, [ mode, progress_items[0] ]); + get_url(url_prefix + '&_transid=-1&_item=' + + escape(progress_items[0]), progress_handle_response, [ mode, progress_items[0] ]); } else { progress_finished(); return; diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py index 2ae6451..1cb4687 100644 --- a/web/htdocs/wato.py +++ b/web/htdocs/wato.py @@ -954,14 +954,14 @@ def mode_bulk_inventory(phase): elif phase == "action": if html.var("_item"): how = html.var("how") - hostname = html.var("_item").encode("utf-8") + hostname = html.var("_item") try: counts = check_mk_automation("inventory", [how, hostname]) - result = repr([ 'continue' ] + list(counts)) + "\n" + result = repr([ 'continue', 0 ] + list(counts)) + "\n" result += "Inventorized %s<br>\n" % hostname log_pending(hostname, "bulk-inventory", "Inventorized host: %d added, %d removed, %d kept, %d total services" % counts) except Exception, e: - result = repr([ 'pause', 0, 0, 0, 0, ]) + "\n" + result = repr([ 'failed', 1, 0, 0, 0, 0, ]) + "\n" result += "Error during inventory of %s: %s<br>\n" % (hostname, e) html.write(result) return "" @@ -976,7 +976,7 @@ def mode_bulk_inventory(phase): interactive_progress( hostnames, # list of items "Bulk inventory", # title - [ ("Services added", 0), ("Services removed", 0), ("Services kept", 0), ("Total services", 0) ], # stats table + [ ("Failed hosts", 0), ("Services added", 0), ("Services removed", 0), ("Services kept", 0), ("Total services", 0) ], # stats table [ ("mode", "file") ], # URL for "Stop/Finish" button 50, # ms to sleep between two steps ) @@ -1986,11 +1986,12 @@ def interactive_progress(items, title, stats, finishvars, timewait): html.write(" </table>") html.write("</td>") html.write("<td class=buttons>") - html.jsbutton('progress_pause', 'Pause', 'javascript:progress_pause()') - html.jsbutton('progress_proceed', 'Proceed', 'javascript:progress_proceed()', 'display:none') - html.jsbutton('progress_finished', 'Finish', 'javascript:progress_end()', 'display:none') - html.jsbutton('progress_restart', 'Restart', 'javascript:location.reload()') - html.jsbutton('progress_abort', 'Abort', 'javascript:progress_end()') + html.jsbutton('progress_pause', _('Pause'), 'javascript:progress_pause()') + html.jsbutton('progress_proceed', _('Proceed'), 'javascript:progress_proceed()', 'display:none') + html.jsbutton('progress_finished', _('Finish'), 'javascript:progress_end()', 'display:none') + html.jsbutton('progress_retry', _('Retry Failed Hosts'), 'javascript:progress_retry()', 'display:none') + html.jsbutton('progress_restart', _('Restart'), 'javascript:location.reload()') + html.jsbutton('progress_abort', _('Abort'), 'javascript:progress_end()') html.write("</td></tr>") html.write("</table>") html.write("</center>")
13 years, 6 months
1
0
0
0
Check_MK Git: check_mk: WATO: new global host search
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: ac75b6ea32f1f05a988fce25c7882671dda3f60c URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ac75b6ea32f1f0…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 14:48:36 2011 +0200 WATO: new global host search --- ChangeLog | 2 + web/htdocs/wato.py | 209 +++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 194 insertions(+), 17 deletions(-) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=ac75b6ea32…
13 years, 6 months
1
0
0
0
Check_MK Git: check_mk: FIX: Avoid exceptions in sidebar on Nagios restart
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 2c744d58b76abe0819c7cebafa06cacb5ee4ae19 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2c744d58b76abe…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 11:08:44 2011 +0200 FIX: Avoid exceptions in sidebar on Nagios restart --- .bugs/98 | 4 ++ ChangeLog | 1 + web/htdocs/index.py | 84 ++++++++++++++++++++++++++++----------------- web/htdocs/js/check_mk.js | 10 +++-- 4 files changed, 63 insertions(+), 36 deletions(-) diff --git a/.bugs/98 b/.bugs/98 index 2d91ae1..ab23b6a 100644 --- a/.bugs/98 +++ b/.bugs/98 @@ -18,3 +18,7 @@ a state. The livestatus socket is missing in such a case. 2011-02-03 10:23:30: changed state open -> done jQuery was removed - the window is gone. + +2011-05-24 11:08:02: changed state done -> done +All Ajax-Requests now get a clean error code 500 and handle this +in case of Livestatus errors. diff --git a/ChangeLog b/ChangeLog index 24beb99..968e81e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ Multisite: * FIX: make non-Ascii characters in services names work again + * FIX: Avoid exceptions in sidebar on Nagios restart * Introduced basic infrastructure for multilanguage support in Multisite * Make 'Views' snapin foldable diff --git a/web/htdocs/index.py b/web/htdocs/index.py index 5bfa3ff..4601b6b 100644 --- a/web/htdocs/index.py +++ b/web/htdocs/index.py @@ -153,8 +153,14 @@ def handler(req, profiling = True): __builtin__.html = html req.uriinfo = htmllib.uriinfo(req) + response_code = apache.OK try: read_get_vars(req) + + # Ajax-Functions want no HTML output in case of an error but + # just a plain server result code of 500 + fail_silently = html.has_var("_ajaxid") + config.load_config() # load multisite.mk if html.var("debug"): # Debug flag may be set via URL config.debug = True @@ -225,55 +231,69 @@ def handler(req, profiling = True): handler(html) except MKUserError, e: - html.header("Invalid User Input") - html.show_error(str(e)) - html.footer() + if not fail_silently: + html.header("Invalid User Input") + html.show_error(str(e)) + html.footer() + response_code = apache.HTTP_BAD_REQUEST except MKAuthException, e: - html.header(_("Permission denied")) - html.show_error(str(e)) - html.footer() + if not fail_silently: + html.header(_("Permission denied")) + html.show_error(str(e)) + html.footer() + response_code = apache.HTTP_FORBIDDEN except MKConfigError, e: - html.header(_("Configuration Error")) - html.show_error(str(e)) - html.footer() + if not fail_silently: + html.header(_("Configuration Error")) + html.show_error(str(e)) + html.footer() apache.log_error(_("Configuration error: %s") % (e,), apache.APLOG_ERR) + response_code = apache.HTTP_INTERNAL_SERVER_ERROR except MKGeneralException, e: - html.header(_("Error")) - html.show_error(str(e)) - html.footer() + if not fail_silently: + html.header(_("Error")) + html.show_error(str(e)) + html.footer() apache.log_error(_("Error: %s") % (e,), apache.APLOG_ERR) + response_code = apache.HTTP_INTERNAL_SERVER_ERROR except livestatus.MKLivestatusNotFoundError, e: - html.header(_("Data not found")) - html.show_error(_("The following query produced no output:\n<pre>\n%s</pre>\n") % \ - e.query) - html.footer() + if not fail_silently: + html.header(_("Data not found")) + html.show_error(_("The following query produced no output:\n<pre>\n%s</pre>\n") % \ + e.query) + html.footer() + response_code = apache.HTTP_NOT_FOUND except livestatus.MKLivestatusException, e: - html.header(_("Livestatus problem")) - html.show_error(_("Livestatus problem: %s") % e) - html.footer() + if not fail_silently: + html.header(_("Livestatus problem")) + html.show_error(_("Livestatus problem: %s") % e) + html.footer() + response_code = apache.HTTP_INTERNAL_SERVER_ERROR except Exception, e: - html.header(_("Internal Error")) - if config.debug: - import traceback, StringIO - txt = StringIO.StringIO() - t, v, tb = sys.exc_info() - traceback.print_exception(t, v, tb, None, txt) - html.show_error("%s: %s<pre>%s</pre>" % (_('Internal error:'), e, txt.getvalue())) - else: - url = html.makeuri([("debug", "1")]) - html.show_error("%s: %s (<a href=\"%s\">%s</a>)" % (_('Internal error:'), e, url, _('Retry with debug mode'))) - apache.log_error("%s %s" % (_('Internal error:'), e), apache.APLOG_ERR) - html.footer() + if not fail_silently: + html.header(_("Internal Error")) + if config.debug: + import traceback, StringIO + txt = StringIO.StringIO() + t, v, tb = sys.exc_info() + traceback.print_exception(t, v, tb, None, txt) + html.show_error("%s: %s<pre>%s</pre>" % (_('Internal error:'), e, txt.getvalue())) + else: + url = html.makeuri([("debug", "1")]) + html.show_error("%s: %s (<a href=\"%s\">%s</a>)" % (_('Internal error:'), e, url, _('Retry with debug mode'))) + apache.log_error("%s %s" % (_('Internal error:'), e), apache.APLOG_ERR) + html.footer() + response_code = apache.HTTP_INTERNAL_SERVER_ERROR # Disconnect from livestatus! html.live = None - return apache.OK + return response_code def page_not_found(html): html.header(_("Page not found")) diff --git a/web/htdocs/js/check_mk.js b/web/htdocs/js/check_mk.js index 547b4e8..f39d782 100644 --- a/web/htdocs/js/check_mk.js +++ b/web/htdocs/js/check_mk.js @@ -43,7 +43,7 @@ function get_url(url, handler, data, errorHandler) { } // Dynamic part to prevent caching - var dyn = "_t="+Date.parse(new Date()); + var dyn = "_ajaxid="+Date.parse(new Date()); if (url.indexOf('\?') !== -1) { dyn = "&"+dyn; } else { @@ -55,11 +55,13 @@ function get_url(url, handler, data, errorHandler) { if (typeof handler === 'function') AJAX.onreadystatechange = function() { if (AJAX.readyState == 4) - if(AJAX.status == 200) + if (AJAX.status == 200) { handler(data, AJAX.responseText); - else - if(typeof errorHandler !== 'undefined') + } + else { + if (typeof errorHandler !== 'undefined') errorHandler(data, AJAX.status); + } } AJAX.send(null); return true;
13 years, 6 months
1
0
0
0
Check_MK Git: check_mk: WATO: Button for activating changes now always on top
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: 202e758319857668a90aa791d693dcc88c0af339 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=202e7583198576…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 10:30:06 2011 +0200 WATO: Button for activating changes now always on top --- web/htdocs/wato.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py index ba6de35..bc38ca6 100644 --- a/web/htdocs/wato.py +++ b/web/htdocs/wato.py @@ -1084,6 +1084,10 @@ def mode_changelog(phase): elif phase == "buttons": html.context_button("Back", make_link([("mode", "folder")])) + pending = parse_audit_log("pending") + if len(pending) > 0: + html.context_button(_("Activate Changes!"), + html.makeuri([("_action", "activate"), ("_transid", html.current_transid())]), True) elif phase == "action": if html.check_transaction(): @@ -1098,10 +1102,8 @@ def mode_changelog(phase): else: pending = parse_audit_log("pending") if len(pending) > 0: - message = "<h1>Changes which are not yet activated:</h1>" + message = "<h1>" + _("Changes which are not yet activated:") + "</h1>" message += render_audit_log(pending, "pending") - message += '<a href="%s" class=button>Activate Changes!</a>' % \ - html.makeuri([("_action", "activate"), ("_transid", html.current_transid())]) html.show_warning(message) else: html.write("<p>No pending changes, monitoring server is up to date.</p>")
13 years, 6 months
1
0
0
0
Check_MK Git: check_mk: WATO: snapin is foldable, right margin honored
by git@mathias-kettner.de
Module: check_mk Branch: master Commit: b7cb288e7841828bb9fcb00acf093d1c8b1ca39c URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b7cb288e784182…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Tue May 24 10:07:47 2011 +0200 WATO: snapin is foldable, right margin honored --- ChangeLog | 1 + web/htdocs/check_mk.css | 11 ++++++++++- web/htdocs/htmllib.py | 7 +++++-- web/htdocs/wato.py | 18 ++++++++++++------ web/plugins/sidebar/wato.py | 2 +- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index fb6366f..24beb99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ WATO: * Configration files can now be administered via the WEB UI (config_files in multisite.mk is obsolete) + * Snapin is tree-based and foldable * Bulk operation on host lists (inventory, tags changed, etc) MK Livestatus: diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css index 029ea0d..912eeaf 100644 --- a/web/htdocs/check_mk.css +++ b/web/htdocs/check_mk.css @@ -56,6 +56,15 @@ b.treeangle.title { font-weight: bold; color: #ffffff; } +ul.treeangle { + /* border: 1px solid #4060ff; */ + padding-left: 20px; +} +ul.treeangle li { + margin: 0px; + margin-left: 16px; + padding-left: 20px; +} /* __ __ _ @@ -352,7 +361,7 @@ div.snapin ul { margin: 0; padding: 0; padding-left: 16px; - width: 220px; + /* width: 220px; Bei mehrstufigen Einrueckungen stimmt der rechte Rand nicht */ } li.sidebar { diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py index 8b29899..07febe4 100644 --- a/web/htdocs/htmllib.py +++ b/web/htdocs/htmllib.py @@ -671,8 +671,11 @@ class html: self.write('<img align=absbottom class="treeangle" id="treeimg.%s.%s" ' 'src="images/tree_%s.png" %s>' % (treename, id, img_num, onclick)) - self.write('<b class="treeangle title" class=treeangle %s>%s</b><br>' % - (onclick, title)) + if title[0] == '<': # custom HTML code + self.write(title) + else: + self.write('<b class="treeangle title" class=treeangle %s>%s</b><br>' % + (onclick, title)) self.write('<ul class="treeangle" style="display: %s" id="tree.%s.%s">' % ((not isopen) and "none" or "", treename, id)) diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py index 5f5f259..ba6de35 100644 --- a/web/htdocs/wato.py +++ b/web/htdocs/wato.py @@ -967,20 +967,26 @@ def render_link_tree(h, format): load_folder_config() def render_folder(f): + + subfolders = f["folders"] path = f["path"] + filename = "/" + "/".join(path) + "/" if len(path) > 0: - filename = "/" + "/".join(path) + "/" url = "wato.py?filename=" + htmllib.urlencode(filename) - html.write(format % (url, f["title"])) + if len(subfolders) == 0: + title = format % (url, f["title"]) + else: + title = '<a target=main href="%s">%s</a>' % (url, f["title"]) else: - html.write('<a target=main href="wato.py">%s</a>' % f["title"]) + title = '<a target=main href="wato.py">%s</a>' % f["title"] - subfolders = f["folders"] if len(subfolders) > 0: - html.write('<ul>') + html.begin_foldable_container('wato', filename, False, title) for sf in sort_by_title(subfolders.values()): render_folder(sf) - html.write('</ul>') + html.end_foldable_container() + else: + html.write(title) render_folder(g_root_folder) diff --git a/web/plugins/sidebar/wato.py b/web/plugins/sidebar/wato.py index fdee6f1..1766f7b 100644 --- a/web/plugins/sidebar/wato.py +++ b/web/plugins/sidebar/wato.py @@ -48,7 +48,7 @@ def ajax_wato_files(h): global html html = h if config.may("use_wato"): - format = ("<li class=sidebar>%s</li>" % link("XX", "XX")).replace("XX", "%s") + format = ("<li>%s</li>" % link("XX", "XX")).replace("XX", "%s") wato.render_link_tree(html, format)
13 years, 6 months
1
0
0
0
← Newer
1
2
3
4
5
6
...
14
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Results per page:
10
25
50
100
200