rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
html.write('<div id="side_footer">' '<div id="slit_bottom"><img src=\"images/sidebar_unten.png\">') | html.write('<div id="side_footer">') | def sidebar_foot(): html.write('<div id="side_footer">' '<div id="slit_bottom"><img src=\"images/sidebar_unten.png\">') |
html.write('</div>') | def sidebar_foot(): html.write('<div id="side_footer">' '<div id="slit_bottom"><img src=\"images/sidebar_unten.png\">') | |
state = row.get("service_state", row.get("host_state", 0)) | state = row.get("service_state", None) if state == None: state = row.get("host_state", 0) if state > 0: state +=1 | def render_group(header, rows, paintheader): |
html.write("<td>%s</td>" % ipaddress) | tdclass = ' class="dnserror"' html.write("<td%s>%s</td>" % (tdclass, ipaddress)) | def mode_index(phase): if phase == "buttons": html.context_button("Create new host", make_link([("mode", "newhost")])) changelog_button() elif phase == "action": # Deletion of hosts delname = html.var("_delete") if delname and delname in g_hosts: return delete_host_after_confirm(delname) else: # Show table of hosts in... |
activate_configuration() | f = os.popen("check_mk -R 2>&1 >/dev/null") errors = f.read() exitcode = f.close() if exitcode: raise MKUserError(None, errors) else: log_commit_pending() log_audit(None, "activate-config", "Configuration activated, monitoring server restarted") return None, "The new configuration has been successfully activated." | def mode_changelog(phase): if phase == "buttons": html.context_button("Create new host", make_link([("mode", "newhost")])) html.context_button("Host list", make_link([("mode", "index")])) elif phase == "action": activate_configuration() else: def render_audit_log(log, what): htmlcode = '<table class="webconf auditlog... |
if html.var("delete"): | if not new and html.var("delete"): | def mode_edithost(phase, new): hostname = html.var("host") # may be empty in new/clone mode clonename = html.var("clone") if clonename and clonename not in g_hosts: raise MKGeneralException("You called this page with an invalid host name.") if clonename: title = "Create clone of %s" % clonename alias, ipaddress, tags... |
html.button("delete", "Delete host!", "submit") | if not new: html.button("delete", "Delete host!", "submit") | def mode_edithost(phase, new): hostname = html.var("host") # may be empty in new/clone mode clonename = html.var("clone") if clonename and clonename not in g_hosts: raise MKGeneralException("You called this page with an invalid host name.") if clonename: title = "Create clone of %s" % clonename alias, ipaddress, tags... |
def activate_configuration(): f = os.popen("check_mk -R 2>&1 >/dev/null") errors = f.read() exitcode = f.close() if exitcode: html.show_error(errors) else: html.message("The new configuration has been successfully activated.") log_commit_pending() log_audit(None, "activate-config", "Configuration activated, monitoring ... | def activate_configuration(): f = os.popen("check_mk -R 2>&1 >/dev/null") errors = f.read() exitcode = f.close() if exitcode: html.show_error(errors) else: html.message("The new configuration has been successfully activated.") log_commit_pending() # flush logfile with pending actions log_audit(None, "activate-config", ... | |
for dir in confdirs: if dir.endswith("/conf.d"): apache_confdir = dir | def scan_apacheconf(apache_conffile): | |
output += urlencode(str(value)) | output += urlencode(unicode(value)) | def urlencode_vars(vars): output = "" for varname, value in vars: if output != "": output += "&" output += varname output += "=" output += urlencode(str(value)) return output |
html.write("<table class=form id=filter %s>\n" % (not is_open and 'style="display: none"' or '')) | html.write("<table class=form id=table_filter %s>\n" % (not is_open and 'style="display: none"' or '')) | def show_filter_form(is_open, filters): html.begin_form("filter") html.write("<table class=form id=filter %s>\n" % (not is_open and 'style="display: none"' or '')) # sort filters according to title s = [(f.sort_index, f.title, f) for f in filters] s.sort() col = 0 for sort_index, title, f in s: if col == 0: html.write... |
toggle_button("filter", filter_isopen, "Show filter", "Hide filter", ["filter"]) | toggle_button("table_filter", filter_isopen, "Show filter", "Hide filter", ["filter"]) | def show_view(view, show_heading = False): # [1] Datasource datasource = multisite_datasources[view["datasource"]] tablename = datasource["table"] # [2] Layout layout = multisite_layouts[view["layout"]] # [3] Filters show_filters = [ multisite_filters[fn] for fn in view["show_filters"] ] hide_filters = [ multisite_fi... |
toggle_button("actions", actions_are_open, "Show commands", "hide commands") | toggle_button("table_actions", actions_are_open, "Show commands", "Hide commands") | def show_view(view, show_heading = False): # [1] Datasource datasource = multisite_datasources[view["datasource"]] tablename = datasource["table"] # [2] Layout layout = multisite_layouts[view["layout"]] # [3] Filters show_filters = [ multisite_filters[fn] for fn in view["show_filters"] ] hide_filters = [ multisite_fi... |
html.write("<table %s id=actions class=form id=actions>\n" % (is_open and " " or 'style="display: none"')) | html.write("<table %s id=table_actions class=form>\n" % (is_open and " " or 'style="display:none"')) | def show_action_form(is_open, datasource): if not config.may("act"): return html.begin_form("actions") html.hidden_field("_do_actions", "yes") html.hidden_field("actions", "yes") html.hidden_fields() # set all current variables, exception action vars html.write("<table %s id=actions class=form id=actions>\n" % (is_op... |
html.write("<input type=submit name=_resched_checks value=\"Reschedule next check now\"></td></tr>\n" | html.write("<input type=submit name=_resched_checks value=\"Reschedule next check now\">\n" | def show_action_form(is_open, datasource): if not config.may("act"): return html.begin_form("actions") html.hidden_field("_do_actions", "yes") html.hidden_field("actions", "yes") html.hidden_fields() # set all current variables, exception action vars html.write("<table %s id=actions class=form id=actions>\n" % (is_op... |
output += urlencode(unicode(value)) | output += value | def urlencode_vars(vars): output = "" for varname, value in vars: if output != "": output += "&" output += varname output += "=" output += urlencode(unicode(value)) return output |
rowinfo[0].startswith('No Such Object available')): | rowinfo[0].startswith('No Such Object available') or \ rowinfo[0].startswith('No Such Instance currently exists'): | def get_snmp_table(hostname, ip, community, oid_info): # oid_info is either ( oid, columns ) or # ( oid, suboids, columns ) # suboids is a list if OID-infixes that are put between baseoid # and the columns and also prefixed to the index column. This # allows to merge distinct SNMP subtrees with a similar structure # to... |
"refresh" : 1010, | "refresh" : 10, | def render_tactical_overview(): host_query = \ "GET hosts\n" \ "Stats: state >= 0\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "StatsAnd: 2\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "Stats: acknowledged = 0\n" \ "StatsAnd: 3\n" \ "Filter: custom_variable_names < _REA... |
show_list("datasource", "Datasource", multisite_datasources) | show_list("datasource", "1. Datasource", multisite_datasources) | def show_list(name, title, data): |
show_list("layout", "Layout", multisite_layouts) | show_list("layout", "2. Layout", multisite_layouts) | def show_list(name, title, data): |
html.write("<tr><td class=legend>Filters</td><td>") | html.write("<tr><td class=legend>3. Filters</td><td>") | def show_list(name, title, data): |
column_selection("Sorting", "sort_", max_sort_columns, multisite_sorters, True) | column_selection("4. Sorting", "sort_", max_sort_columns, multisite_sorters, True) | def column_selection(title, var_prefix, maxnum, data, order=False): |
column_selection("Group columns", "group_", max_group_columns, multisite_painters) | column_selection("5. Group by", "group_", max_group_columns, multisite_painters) | def column_selection(title, var_prefix, maxnum, data, order=False): |
column_selection("Display columns", "col_", max_display_columns, multisite_painters) | column_selection("6. Display columns", "col_", max_display_columns, multisite_painters) | def column_selection(title, var_prefix, maxnum, data, order=False): |
if html.var("show"): | if html.has_var("show") or html.has_var("filled_in"): | def column_selection(title, var_prefix, maxnum, data, order=False): |
"paint" : lambda row: paint_age(row("last_state_change"), row("has_been_checked") == "1") } | "paint" : lambda row: paint_age(row("last_state_change"), row("has_been_checked") == 1) } | def paint_service_state_short(row): if row("has_been_checked") == 1: state = row("state") name = nagios_short_state_names[row("state")] else: state = "p" name = "PEND" return "<td class=state%s>%s</td>" % (state, name) |
def show_filter_form(is_open, filters, colspan): | def show_filter_form(is_open, filters): | def show_filter_form(is_open, filters, colspan): # Table muss einen anderen Namen, als das Formular html.write("<tr class=form id=table_filter %s>\n" % (not is_open and 'style="display: none"' or '') ) html.write("<td colspan=%d>" % colspan) html.begin_form("filter") html.write("<div class=whiteborder>\n") html.write(... |
html.write("<td colspan=%d>" % colspan) | html.write("<td>") | def show_filter_form(is_open, filters, colspan): # Table muss einen anderen Namen, als das Formular html.write("<tr class=form id=table_filter %s>\n" % (not is_open and 'style="display: none"' or '') ) html.write("<td colspan=%d>" % colspan) html.begin_form("filter") html.write("<div class=whiteborder>\n") html.write(... |
def show_painter_options(painter_options, colspan): | def show_painter_options(painter_options): | def show_painter_options(painter_options, colspan): html.write('<tr class=form id=painter_options style="display: none">') html.write("<td colspan=%d>" % colspan) html.begin_form("painteroptions") html.write("<div class=whiteborder>\n") html.write("<table class=form>\n") for on in painter_options: opt = multisite_pain... |
html.write("<td colspan=%d>" % colspan) | html.write("<td>") | def show_painter_options(painter_options, colspan): html.write('<tr class=form id=painter_options style="display: none">') html.write("<td colspan=%d>" % colspan) html.begin_form("painteroptions") html.write("<div class=whiteborder>\n") html.write("<table class=form>\n") for on in painter_options: opt = multisite_pain... |
colspan = 0 | def show_view(view, show_heading = False, show_buttons = True, show_footer = True): # Parse display options display_options = html.var("display_options", "") # assume all missing options as active (upper case) for c in "HTBFCEOZRSIX": if c not in display_options and c.lower() not in display_options: display_options += ... | |
colspan += 2 | def show_view(view, show_heading = False, show_buttons = True, show_footer = True): # Parse display options display_options = html.var("display_options", "") # assume all missing options as active (upper case) for c in "HTBFCEOZRSIX": if c not in display_options and c.lower() not in display_options: display_options += ... | |
colspan += 2 html.write("<td class=gap></td>\n") colspan += 1 | html.write("<td class=gap> </td>\n") | def show_view(view, show_heading = False, show_buttons = True, show_footer = True): # Parse display options display_options = html.var("display_options", "") # assume all missing options as active (upper case) for c in "HTBFCEOZRSIX": if c not in display_options and c.lower() not in display_options: display_options += ... |
colspan += 1 | def show_view(view, show_heading = False, show_buttons = True, show_footer = True): # Parse display options display_options = html.var("display_options", "") # assume all missing options as active (upper case) for c in "HTBFCEOZRSIX": if c not in display_options and c.lower() not in display_options: display_options += ... | |
show_filter_form(filter_isopen, show_filters, colspan) | show_filter_form(filter_isopen, show_filters) | def show_view(view, show_heading = False, show_buttons = True, show_footer = True): # Parse display options display_options = html.var("display_options", "") # assume all missing options as active (upper case) for c in "HTBFCEOZRSIX": if c not in display_options and c.lower() not in display_options: display_options += ... |
html.write("<tr class=form><td class=whiteborder colspan=%d>" % colspan) | html.write("<tr class=form><td class=whiteborder>") | def show_view(view, show_heading = False, show_buttons = True, show_footer = True): # Parse display options display_options = html.var("display_options", "") # assume all missing options as active (upper case) for c in "HTBFCEOZRSIX": if c not in display_options and c.lower() not in display_options: display_options += ... |
show_action_form(True, datasource, colspan) | show_action_form(True, datasource) | def show_view(view, show_heading = False, show_buttons = True, show_footer = True): # Parse display options display_options = html.var("display_options", "") # assume all missing options as active (upper case) for c in "HTBFCEOZRSIX": if c not in display_options and c.lower() not in display_options: display_options += ... |
show_action_form(False, datasource, colspan) | show_action_form(False, datasource) | def show_view(view, show_heading = False, show_buttons = True, show_footer = True): # Parse display options display_options = html.var("display_options", "") # assume all missing options as active (upper case) for c in "HTBFCEOZRSIX": if c not in display_options and c.lower() not in display_options: display_options += ... |
show_painter_options(painter_options, colspan) | show_painter_options(painter_options) | def show_view(view, show_heading = False, show_buttons = True, show_footer = True): # Parse display options display_options = html.var("display_options", "") # assume all missing options as active (upper case) for c in "HTBFCEOZRSIX": if c not in display_options and c.lower() not in display_options: display_options += ... |
def show_action_form(is_open, datasource, colspan): | def show_action_form(is_open, datasource): | def show_action_form(is_open, datasource, colspan): if not config.may("act"): return # We take the first info to be the native data type of this table # and show actions useful for that what = datasource["infos"][0] # if what not in [ "host", "service", "comment", "downtime" ]: # return # no actions on others # Tab... |
html.write("<tr class=form id=table_actions %s><td colspan=%d>" % ((not is_open and 'style="display: none"' or ''), colspan) ) | html.write("<tr class=form id=table_actions %s><td>" % (not is_open and 'style="display: none"' or '') ) | def show_action_form(is_open, datasource, colspan): if not config.may("act"): return # We take the first info to be the native data type of this table # and show actions useful for that what = datasource["infos"][0] # if what not in [ "host", "service", "comment", "downtime" ]: # return # no actions on others # Tab... |
perfstring = str(row["service_perf_data"].strip()) | perfstring = unicode(row["service_perf_data"].strip()) | def paint_perfometer(row): perfstring = str(row["service_perf_data"].strip()) if not perfstring: return "", "" parts = perfstring.split() # Try if check command is appended to performance data # in a PNP like style if parts[-1].startswith("[") and parts[-1].endswith("]"): check_command = parts[-1][1:-1] del parts[-1] ... |
while i < len(value) and (str.isdigit(value[i]) or value[i] in ['.', ',', '-']): | while i < len(value) and (isdigit(value[i]) or value[i] in ['.', ',', '-']): | def paint_perfometer(row): perfstring = str(row["service_perf_data"].strip()) if not perfstring: return "", "" parts = perfstring.split() # Try if check command is appended to performance data # in a PNP like style if parts[-1].startswith("[") and parts[-1].endswith("]"): check_command = parts[-1][1:-1] del parts[-1] ... |
style = "host up" else: style = "host down" | style = None else: style = "hostdown" | def paint_host_black(row): state = row["host_state"] if state == 0: style = "host up" else: style = "host down" return style, row["host_name"] |
html.write('<div id="side_version"><a href="http://mathias-kettner.de/checkmk_download.html" target="main">v%s</a></div>\n' % defaults.check_mk_version) | html.write('<div id="side_version"><a href="http://mathias-kettner.de/check_mk_download.html" target="main">v%s</a></div>\n' % defaults.check_mk_version) | def sidebar_head(): html.write('<div id="side_header">' '<a class="logo" target="_blank" href="http://mathias-kettner.de"></a>' '</div>\n') html.write('<div id="side_version"><a href="http://mathias-kettner.de/checkmk_download.html" target="main">v%s</a></div>\n' % defaults.check_mk_version) |
gid = pwd.getpwnam(defaults.www_group).pw_gid | gid = grp.getgrnam(defaults.www_group).gr_gid | def make_nagios_directory(path): if not os.path.exists(path): os.mkdir(path) gid = pwd.getpwnam(defaults.www_group).pw_gid os.chown(path, -1, gid) os.chmod(path, 0770) |
return cluster_of(hostname) | cluster = cluster_of(hostname) if cluster: return cluster | def host_of_clustered_service(hostname, servicedesc): # 1. New style: explicitlely assigned services for cluster, conf in clustered_services_of.items(): if in_boolean_serviceconf_list(hostname, servicedesc, conf): return cluster # 1. Old style: clustered_services assumes that each host belong to # exactly on cluste... |
print "%s: Invalid output from agent or invalid configuration: %s" % (hostname, e) | sys.stderr.write("%s: Invalid output from agent or invalid configuration: %s\n" % (hostname, e)) | def make_inventory(checkname, hostnamelist, check_only=False): try: inventory_function = check_info[checkname][3] except KeyError: sys.stderr.write("No such check type '%s'. Try check_mk -I list.\n" % checkname) sys.exit(1) newchecks = [] count_new = 0 checked_hosts = [] # if no hostnamelist is specified, we use all ... |
import page_multiadmin pagehandlers = { "index" : page_index, "filter" : page_multiadmin.page} | import page_multiadmin pagehandlers = { "index" : page_index, "filter" : page_multiadmin.page,} | def handler(req): req.content_type = "text/html" req.header_sent = False # req.uriinfo = html.uriinfo(req) # Die Datei main.py wird mit beliebigen Namen aufgerufen, die # alle auf .py enden, und die es garnicht geben muss! req.myfile = req.uri.split("/")[-1][:-3] # Verzweigen je nach Name der Seite, 'main' ist Defa... |
path = user_confdir + "/siteconf.mk" | path = user_confdir + "/siteconfig.mk" | def read_site_config(): path = user_confdir + "/siteconf.mk" global user_siteconf if os.path.exists(path): user_siteconf = eval(file(path).read()) else: user_siteconf = {} |
commandargs = [] | def check_mk_automation(command, args=[], indata=""): # Gather the command to use for executing --automation calls to check_mk # - First try to use the check_mk_automation option from the defaults # - When not set try to detect the command for OMD or non OMD installations # - OMD 'own' apache mode or non OMD: check_m... | |
commandargs = [ 'sudo', '-u', omd_site, '/usr/bin/env', 'python', '/omd/sites/'+omd_site+'/share/check_mk/modules/check_mk.py', '--defaults', '/omd/sites/'+omd_site+'/etc/check_mk/defaults', '--automation' ] | commandargs = [ 'sudo', '/bin/su', '-', omd_site, '-c', 'check_mk --automation' ] cmd = commandargs cmd[-1] += ' ' + ' '.join([ command ] + args) | def check_mk_automation(command, args=[], indata=""): # Gather the command to use for executing --automation calls to check_mk # - First try to use the check_mk_automation option from the defaults # - When not set try to detect the command for OMD or non OMD installations # - OMD 'own' apache mode or non OMD: check_m... |
(apache_user, apache_user, omd_site, " ".join(commandargs[3:]))) cmd = commandargs + [ command ] + args | (apache_user, apache_user, omd_site, " ".join(commandargs[1:]))) | def check_mk_automation(command, args=[], indata=""): # Gather the command to use for executing --automation calls to check_mk # - First try to use the check_mk_automation option from the defaults # - When not set try to detect the command for OMD or non OMD installations # - OMD 'own' apache mode or non OMD: check_m... |
index_rows.append(x) | index_rows.append(("0.%d" % x,x)) | def get_snmp_table(hostname, ip, oid_info): # oid_info is either ( oid, columns ) or # ( oid, suboids, columns ) # suboids is a list if OID-infixes that are put between baseoid # and the columns and also prefixed to the index column. This # allows to merge distinct SNMP subtrees with a similar structure # to one virtua... |
entries = filter(lambda d: d[0] != '.', os.listdir(dir)) entries.sort() entries.reverse() for pattern in entries: if pattern[0] == '.': continue if fnmatch(item, pattern): matching.append(dir + "/" + pattern) | if os.path.isdir(dir): entries = filter(lambda d: d[0] != '.', os.listdir(dir)) entries.sort() entries.reverse() for pattern in entries: if pattern[0] == '.': continue if fnmatch(item, pattern): matching.append(dir + "/" + pattern) | def notes_matching_pattern_entries(dirs, item): from fnmatch import fnmatch matching = [] for dir in dirs: entries = filter(lambda d: d[0] != '.', os.listdir(dir)) entries.sort() entries.reverse() for pattern in entries: if pattern[0] == '.': continue if fnmatch(item, pattern): matching.append(dir + "/" + pattern) retu... |
style = "up" else: style = "down" return "host", row["host_name"] | style = "host up" else: style = "host down" return style, row["host_name"] | def paint_host_black(row): state = row["host_state"] if state == 0: style = "up" else: style = "down" return "host", row["host_name"] |
"Plublish views", | "Publish views", | def declare_permission_section(name, title): permission_sections[name] = title |
if in_boolean_serviceconf_list(hostname, servicedesc, conf): | if hostname in nodes_of(cluster) and \ in_boolean_serviceconf_list(hostname, servicedesc, conf): | def host_of_clustered_service(hostname, servicedesc): # 1. New style: explicitlely assigned services for cluster, conf in clustered_services_of.items(): if in_boolean_serviceconf_list(hostname, servicedesc, conf): return cluster # 1. Old style: clustered_services assumes that each host belong to # exactly on cluste... |
saved_user_config = eval(file(path).read()) | user_config = eval(file(path).read()) | def load_user_config(): path = config.user_confdir + "/sidebar.mk" try: saved_user_config = eval(file(path).read()) except: saved_user_config = config.sidebar # Now make sure that all snapins are listed in the config # even if turned off. user_config = copy.copy(saved_user_config) for name in sidebar_snapins.keys(): f... |
saved_user_config = config.sidebar user_config = copy.copy(saved_user_config) for name in sidebar_snapins.keys(): found = False for n, u in user_config: if n == name: found = True if not found: user_config.append((name, "off")) return [ entry for entry in user_config if config.may("sidesnap." + entry[0])] | user_config = config.sidebar return [ entry for entry in user_config if entry[1] != "off" and config.may("sidesnap." + entry[0])] | def load_user_config(): path = config.user_confdir + "/sidebar.mk" try: saved_user_config = eval(file(path).read()) except: saved_user_config = config.sidebar # Now make sure that all snapins are listed in the config # even if turned off. user_config = copy.copy(saved_user_config) for name in sidebar_snapins.keys(): f... |
new_config.append((name, usage)) | if usage != "off": new_config.append((name, usage)) | def ajax_openclose(h): global html html = h config = load_user_config() new_config = [] for name, usage in config: if html.var("name") == name: usage = html.var("state") new_config.append((name, usage)) save_user_config(new_config) |
used_snapins = [name for (name, state) in load_user_config() if state != "off"] | used_snapins = [name for (name, state) in load_user_config()] | def page_add_snapin(h): if not config.may("configure_sidebar"): raise MKGeneralException("You are not allowed to change the sidebar.") global html html = h html.header("Add Snapin") used_snapins = [name for (name, state) in load_user_config() if state != "off"] addname = html.var("name") if addname in sidebar_snapins... |
if check_only and str(e): | if check_only and not include_state and str(e): | def make_inventory(checkname, hostnamelist, check_only=False, include_state=False): try: inventory_function = check_info[checkname][3] except KeyError: sys.stderr.write("No such check type '%s'. Try check_mk -I list.\n" % checkname) sys.exit(1) is_snmp_check = check_uses_snmp(checkname) newchecks = [] newitems = [] ... |
elif str(e): | elif not include_state and str(e): | def make_inventory(checkname, hostnamelist, check_only=False, include_state=False): try: inventory_function = check_info[checkname][3] except KeyError: sys.stderr.write("No such check type '%s'. Try check_mk -I list.\n" % checkname) sys.exit(1) is_snmp_check = check_uses_snmp(checkname) newchecks = [] newitems = [] ... |
html.write("<a href=\"%s\" %s %s><img onmouseover=\"hilite_icon(this, 1)\" onmouseout=\"hilite_icon(this, 0)\" align=absmiddle src=\"%s/images/icon_%s14lo.png\"></a> " % (href, onclick, tg, check_mk.checkmk_web_uri, what)) | html.write("<a href=\"%s\" %s %s><img border=0 onmouseover=\"hilite_icon(this, 1)\" onmouseout=\"hilite_icon(this, 0)\" align=absmiddle src=\"%s/images/icon_%s14lo.png\"></a> " % (href, onclick, tg, check_mk.checkmk_web_uri, what)) | def iconbutton(what, url, target="side"): if target == "side": onclick = "onclick=\"get_url('%s')\"" % (check_mk.checkmk_web_uri + "/" + url) href = "" tg = "" else: onclick = "" href = "%s/%s" % (check_mk.checkmk_web_uri, url) tg = "target=%s" % target html.write("<a href=\"%s\" %s %s><img onmouseover=\"hilite_icon(th... |
html.write("<tr><td class=legend>Alias<br><i>(optional</i></td><td class=content>") | html.write("<tr><td class=legend>Alias<br><i>(optional)</i></td><td class=content>") | def mode_edithost(phase, new): hostname = html.var("host") # may be empty in new/clone mode clonename = html.var("clone") if clonename and clonename not in g_hosts: raise MKGeneralException("You called this page with an invalid host name.") if clonename: title = "Create clone of %s" % clonename alias, ipaddress, tags... |
html.write('<img src="images/%s">' % img) | html.write('<img src="images/%s" align="center" />' % img) | def render_list(ids, links): states = load_customlink_states() n = 0 for entry in links: n += 1 try: if type(entry[1]) == type(True): idss = ids + [str(n)] if states.get(''.join(idss), entry[1] and 'on' or 'off') == 'on': # open display = "" img = "link_folder_open.gif" else: display = "display: none; " img = "link_fol... |
div } | def render_list(ids, links): states = load_customlink_states() n = 0 for entry in links: n += 1 try: if type(entry[1]) == type(True): idss = ids + [str(n)] if states.get(''.join(idss), entry[1] and 'on' or 'off') == 'on': # open display = "" img = "link_folder_open.gif" else: display = "display: none; " img = "link_fol... | |
position: relative; top: 3px; | def render_list(ids, links): states = load_customlink_states() n = 0 for entry in links: n += 1 try: if type(entry[1]) == type(True): idss = ids + [str(n)] if states.get(''.join(idss), entry[1] and 'on' or 'off') == 'on': # open display = "" img = "link_folder_open.gif" else: display = "display: none; " img = "link_fol... | |
html.write("<div class=copyright>© <a href=\"http://mathias-kettner.de\">Mathias Kettner</a></div>\n") | html.write("<div class=copyright>© <a target=\"main\" href=\"http://mathias-kettner.de\">Mathias Kettner</a></div>\n") | def sidebar_foot(): html.write('<div id="side_footer">' '<div id="slit_bottom"><img src=\"images/sidebar_unten.png\">') |
html.write(req.myfile) | def handler(req): req.content_type = "text/html" req.header_sent = False # req.uriinfo = html.uriinfo(req) # Die Datei main.py wird mit beliebigen Namen aufgerufen, die # alle auf .py enden, und die es garnicht geben muss! req.myfile = req.uri.split("/")[-1][:-3] # Verzweigen je nach Name der Seite, 'main' ist Defa... | |
html.write("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN "http://www.w3.org/TR/html4/frameset.dtd"> | html.write("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | def page_side(h): if not config.may("see_sidebar"): return global html html = h html.write("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN "http://www.w3.org/TR/html4/frameset.dtd"> |
return [ [None] + line for line in data ] | return [ [''] + line for line in data ] | def query(self, query, add_headers = ""): |
elif hostname in g_hosts: | elif not new and hostname in g_hosts: | def mode_edithost(phase, new): hostname = html.var("host") # may be empty in new/clone mode clonename = html.var("clone") if clonename and clonename not in g_hosts: raise MKGeneralException("You called this page with an invalid host name.") if clonename: title = "Create clone of %s" % clonename alias, ipaddress, tags... |
html.write('<table class=hostmatrix style="%s"\n' % style) | html.write('<table class=hostmatrix style="%s">\n' % style) | def render_hostmatrix(): html.live.set_prepend_site(True) query = "GET hosts\nColumns: name state has_been_checked worst_service_state scheduled_downtime_depth\nFilter: custom_variable_names < _REALNAME\n" hosts = html.live.query(query) html.live.set_prepend_site(False) hosts.sort() # Choose smallest square number lar... |
table.hostmatrix { width: %dpx; cell-spacing: 1px; } | table.hostmatrix { width: %dpx; border-spacing: 1px; } | def render_hostmatrix(): html.live.set_prepend_site(True) query = "GET hosts\nColumns: name state has_been_checked worst_service_state scheduled_downtime_depth\nFilter: custom_variable_names < _REALNAME\n" hosts = html.live.query(query) html.live.set_prepend_site(False) hosts.sort() # Choose smallest square number lar... |
if persist: | if self.persist: | def send_query(self, query, add_headers = ""): if self.socket == None: self.connect() if not query.endswith("\n"): query += "\n" query += self.auth_header + self.add_headers query += "Localtime: %d\nOutputFormat: python\nKeepAlive: on\nResponseHeader: fixed16\n" % int(time.time()) query += add_headers if not query.ends... |
if persist: | if self.persist: | def recv_response(self, query = None, add_headers = ""): try: resp = self.receive_data(16) code = resp[0:3] length = int(resp[4:15].lstrip()) data = self.receive_data(length) if code == "200": try: return eval(data) except: raise MKLivestatusSocketError("Malformed output") else: raise MKLivestatusQueryError(code, data.... |
if persist: | if self.persist: | def do_command(self, command): if not command.endswith("\n"): command += "\n" try: self.socket.send("COMMAND " + command + "\n") except IOError, e: self.socket = None if persist: del persistent_connections[self.socketurl] raise MKLivestatusSocketError(str(e)) |
uri = html.makeuri_contextless([("view_name", linkview)] + filtervars) | uri = "view.py?" + htmllib.urlencode_vars([("view_name", linkview)] + filtervars) | def link_to_view(content, row, linkview): view = html.available_views.get(linkview) if view: filters = [ multisite_filters[fn] for fn in view["hide_filters"] ] filtervars = [] for filt in filters: filtervars += filt.variable_settings(row) uri = html.makeuri_contextless([("view_name", linkview)] + filtervars) content =... |
rowinfo[0].startswith('No Such Instance currently exists'): | rowinfo[0].startswith('No Such Instance currently exists')): | def get_snmp_table(hostname, ip, community, oid_info): # oid_info is either ( oid, columns ) or # ( oid, suboids, columns ) # suboids is a list if OID-infixes that are put between baseoid # and the columns and also prefixed to the index column. This # allows to merge distinct SNMP subtrees with a similar structure # to... |
html.write("var refresh_snapins = %r;\n" % refresh_snapins) | html.write("refresh_snapins = %r;\n" % refresh_snapins) | def page_sidebar(h): global html html = h if not config.may("see_sidebar"): return views.html = h views.load_views() html.write("<div class=header><table><tr>" "<td class=title><a target=\"main\" href=\"main.py\">Check_MK</a></td>" "<td class=logo><a target=\"_blank\" href=\"http://mathias-kettner.de\"><img border=0 s... |
xmlpath = basedir + "/" + row["service_description"].replace("/", "_").replace(" ", "_") + ".xml" | xmlpath = basedir + "/" + row["service_description"].replace("/", "_").replace(" ", "_").replace(":", "_") + ".xml" | def pnp_icon_link(row): a = "<a href=\"%s\"><img class=icon src=\"images/icon_pnp.gif\"></a>" % pnp_url(row) if config.site_is_local(row["site"]): # Where is our RRD? basedir = defaults.rrd_path + "/" + row["host_name"] xmlpath = basedir + "/" + row["service_description"].replace("/", "_").replace(" ", "_") + ".xml" i... |
new_config.insert(after_pos, cur_snapin) | if after_pos == -1: new_config.append(cur_snapin) else: new_config.insert(after_pos, cur_snapin) | def reposition_snapin(h): global html html = h snapname = html.var("name") aftername = html.var("after") new_config = [] after_pos = -1 cur_snapin = None for id, snapin in enumerate(load_user_config()): if aftername == snapin[0]: after_pos = id if snapname == snapin[0]: cur_snapin = snapin else: new_config.app... |
html.write("<table class=tacticaloverview cellspacing=0 cellpadding=0 border=0>\n") | html.write("<table class=tacticaloverview cellspacing=2 cellpadding=0 border=0>\n") | def render_tactical_overview(): host_query = \ "GET hosts\n" \ "Stats: state >= 0\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "StatsAnd: 2\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "Stats: acknowledged = 0\n" \ "StatsAnd: 3\n" \ "Filter: custom_variable_names < _REA... |
border-spacing: 5px 0px; | /*border-spacing: 5px 2px;*/ | def render_tactical_overview(): host_query = \ "GET hosts\n" \ "Stats: state >= 0\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "StatsAnd: 2\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "Stats: acknowledged = 0\n" \ "StatsAnd: 3\n" \ "Filter: custom_variable_names < _REA... |
position: relative; left: -4px; | def render_tactical_overview(): host_query = \ "GET hosts\n" \ "Stats: state >= 0\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "StatsAnd: 2\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "Stats: acknowledged = 0\n" \ "StatsAnd: 3\n" \ "Filter: custom_variable_names < _REA... | |
table.tacticaloverview td { text-align: right; border: 1px solid table.tacticaloverview td a { display: block; } """ % (snapin_width + 9) | table.tacticaloverview td { text-align: right; border: 1px solid table.tacticaloverview td a { display: block; margin-right: 2px; } """ % (snapin_width + 5) | def render_tactical_overview(): host_query = \ "GET hosts\n" \ "Stats: state >= 0\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "StatsAnd: 2\n" \ "Stats: state > 0\n" \ "Stats: scheduled_downtime_depth = 0\n" \ "Stats: acknowledged = 0\n" \ "StatsAnd: 3\n" \ "Filter: custom_variable_names < _REA... |
check_mk [-c] -I {tcp|snmp} [HOST1 ...] inventory - find new services check_mk -c, --cleanup-autochecks reorder autochecks files | check_mk [-u] -I {tcp|snmp} [HOST1 ...] inventory - find new services check_mk -u, --cleanup-autochecks reorder autochecks files | def usage(): print """WAYS TO CALL: check_mk [-n] [-v] [-p] HOST [IPADDRESS] check all services on HOST check_mk [-c] -I {tcp|snmp} [HOST1 ...] inventory - find new services check_mk -c, --cleanup-autochecks reorder autochecks files check_mk -S|-H|--timeperiods output Nagios configuration files ... |
for n in range(1, max_display_columns+1): | for n in range(1, 500): | def create_view(): name = html.var("view_name").strip() if name == "": raise MKUserError("view_name", "Please supply a unique name for the view, this will be used to specify that view in HTTP links.") if not re.match("^[a-zA-Z0-9_]+$", name): raise MKUserError("view_name", "The name of the view may only contain letters... |
%s host_name\t\t\ts | %s host_name\t\t\t%s | def create_nagios_servicedefs(outfile, hostname): # _____ # |___ / # |_ \ # ___) | # |____/ 3. Services host_checks = get_check_table(hostname).items() aggregated_services_conf = set([]) do_aggregation = host_is_aggregated(hostname) have_at_least_one_service = False for ((checkname, item), (params, descript... |
declare_filter(FilterText("host", "Hostname", "hosts", "name", "host", "~~")) | declare_filter(FilterText("hostregex", "Hostname", "hosts", "name", "hostregex", "~~"), "Search field with regular expressions, also allows partial matches") declare_filter(FilterText("host", "Hostname", "hosts", "name", "host", "="), "Exact match. Use this fo... | def heading_info(self, tablename): |
data = html.live.query("GET services\nColumns: name\n") | data = html.live.query("GET services\nColumns: description\n") | def render_searchform(): html.write('<div id="mk_side_search" onclick="mkSearchClose();">') html.write('<input id="mk_side_search_field" type="text" name="search" />') html.write('</div>') html.write("<script type='text/javascript' src='search.js'></script>\n") html.write("<script type='text/javascript'>\n") # Store (... |
print index_column | def get_snmp_table(hostname, ip, oid_info): # oid_info is either ( oid, columns ) or # ( oid, suboids, columns ) # suboids is a list if OID-infixes that are put between baseoid # and the columns and also prefixed to the index column. This # allows to merge distinct SNMP subtrees with a similar structure # to one virtua... | |
if state == 0: style = "host up" else: style = "host down" return style, row["host_name"] | if state != 0: return None, "<div class=hostdown>%s</div>" % row["host_name"] else: return None, row["host_name"] | def paint_host_black(row): state = row["host_state"] if state == 0: style = "host up" else: style = "host down" return style, row["host_name"] |
html.write('<div class=button><a target="main" href="sidebar_add_snapin.py">Add snapin</a></div>') | html.write('<div class=button>\n') html.write('<a target="main" href="sidebar_add_snapin.py"') html.write('>Add snapin</a></div>') | def sidebar_foot(): html.write('<div id="side_footer">') if config.may("configure_sidebar"): html.write('<div class=button><a target="main" href="sidebar_add_snapin.py">Add snapin</a></div>') html.write("<div class=copyright>© <a target=\"main\" href=\"http://mathias-kettner.de\">Mathias Kettner</a></div>\n") html... |
cmd = commandargs cmd[-1] += ' ' + ' '.join([ command ] + args) | cmd = commandargs[:-1] + [ commandargs[-1] + ' ' + ' '.join([ command ] + args) ] | def check_mk_automation(command, args=[], indata=""): # Gather the command to use for executing --automation calls to check_mk # - First try to use the check_mk_automation option from the defaults # - When not set try to detect the command for OMD or non OMD installations # - OMD 'own' apache mode or non OMD: check_m... |
"%s ALL = (%s) NOPASSWD: %s *\n" | "%s ALL = (root) NOPASSWD: %s\ *\n" | def check_mk_automation(command, args=[], indata=""): # Gather the command to use for executing --automation calls to check_mk # - First try to use the check_mk_automation option from the defaults # - When not set try to detect the command for OMD or non OMD installations # - OMD 'own' apache mode or non OMD: check_m... |
(apache_user, apache_user, omd_site, " ".join(commandargs[1:]))) | (apache_user, apache_user, " ".join(commandargs[1:-1] + [ commandargs[-1].replace(' ', '\ ')]))) | def check_mk_automation(command, args=[], indata=""): # Gather the command to use for executing --automation calls to check_mk # - First try to use the check_mk_automation option from the defaults # - When not set try to detect the command for OMD or non OMD installations # - OMD 'own' apache mode or non OMD: check_m... |
display = "none" | display = "display: none; " | def render_list(ids, links): states = load_customlink_states() n = 0 for entry in links: n += 1 try: if type(entry[1]) == type(True): idss = ids + [str(n)] if states.get(''.join(idss), entry[1] and 'on' or 'off') == 'on': # open display = "" img = "link_folder_open.gif" else: display = "none" img = "link_folder.gif" ht... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.