rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
elif isinstance(value, bool): val_type = 'bool' | def getTypeStr(self, value): val_type = 'str' if isinstance(value, list): val_type = 'list' elif isinstance(value, int): val_type = 'int' elif isinstance(value, bool): val_type = 'bool' return val_type | |
output.write( ' output.write( ' | output.write( '#ifndef has_formulation_'+f_name+'\n' ) | |
lst = [ 'set','set title', 'set xlabel', 'set ylabel', 'set_terminal', 'set_terminal_epslatex', 'set_output' ] | lst = [ 'set','set title', 'unset', 'set xlabel', 'set ylabel', 'set terminal', 'set terminal epslatex', 'set output', 'set xrange', 'set label' ] | #ifndef LMT_gnuplot_HEADER |
local_res = os.system( self.command + filename + " > " + filename[:-4] + ".log 2> " + filename[:-4] + ".log_cerr" ) | filename_log = filename[:-4] + ".log" filename_log_cerr = filename[:-4] + ".log_cerr" local_res = os.system( self.command + filename + " > " + filename_log + " 2> " + filename_log_cerr ) | def find_and_exec( self, directory ): for filename_ in os.listdir( directory ): filename = directory + "/" + filename_ if stat.S_ISDIR( os.stat( filename )[ stat.ST_MODE ] ): self.find_and_exec( filename ) elif filename[-4:] == ".cpp": local_res = os.system( self.command + filename + " > " + filename[:-4] + ".log 2> " ... |
filename_log = filename[:-4] + ".log" filename_log_cerr = filename[:-4] + ".log_cerr" | def find_and_exec( self, directory ): for filename_ in os.listdir( directory ): filename = directory + "/" + filename_ if stat.S_ISDIR( os.stat( filename )[ stat.ST_MODE ] ): self.find_and_exec( filename ) elif filename[-4:] == ".cpp": local_res = os.system( self.command + filename + " > " + filename[:-4] + ".log 2> " ... | |
sys.exit( t.res == 0 ) | exit( t.res == 0 ) | def run( self, directory ): self.html.write('\n\n<table border=1>\n\t<caption> Results </caption>\n\t<tr>\n\t\t<th> Source File Test </th> <th> Compilation </th> <th> Test </th> <th> Result </th> <th> Log File </th> <th> Log Cerr File </th>\n\t</tr>\n' ) self.find_and_exec( directory ) self.html.write('</table>\n<br>\n... |
print " Unit tests Succeeded :-) so i do git pull at romanee" | print " Unit tests Succeeded :-)" | def run( self, directory ): self.html.write('\n\n<table border=1>\n\t<caption> Results </caption>\n\t<tr>\n\t\t<th> Source File Test </th> <th> Compilation </th> <th> Test </th> <th> Result </th> <th> Log File </th> <th> Log Cerr File </th>\n\t</tr>\n' ) self.find_and_exec( directory ) self.html.write('</table>\n<br>\n... |
base = 0 | def dumpIDB(path, tablename): db = databaseServer(path) createSchema(db, tablename) import idautils, idc | |
for x in database.Functions(): | for x in database.functions(): | def dumpIDB(path, tablename): db = databaseServer(path) createSchema(db, tablename) import idautils, idc |
if len(rows) > 0 and config.may("act"): actions_are_open = html.do_actions() toggle_button("table_actions", actions_are_open, "Show commands", "Hide commands") else: actions_are_open = False | if len(rows) > 0 and config.may("act") and not html.do_actions(): toggle_button("table_actions", False, "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... |
show_action_form(actions_are_open, datasource) | show_action_form(False, datasource) | 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... |
template = ",check_mk_perf" | template = "check_mk_perf," | def create_nagios_servicedefs(outfile, hostname): # _____ # |___ / # |_ \ # ___) | # |____/ 3. Services host_checks = get_check_table(hostname).items() host_checks.sort() # Create deterministic order aggregated_services_conf = set([]) do_aggregation = host_is_aggregated(hostname) have_at_least_one_service =... |
use\t\t\t\tcheck_mk_default%s | use\t\t\t\t%scheck_mk_default | def create_nagios_servicedefs(outfile, hostname): # _____ # |___ / # |_ \ # ___) | # |____/ 3. Services host_checks = get_check_table(hostname).items() host_checks.sort() # Create deterministic order aggregated_services_conf = set([]) do_aggregation = host_is_aggregated(hostname) have_at_least_one_service =... |
new_first_column.append((oid, str(suboid) + "." + str(x))) | new_first_column.append((oid, str(suboid) + "." + str(val))) | 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... |
elif line.startswith("$conf['base_url']") and line.endswith(";"): | elif (line.startswith("$conf['base_url']") or line.startswith("$conf['pnp_base']")) \ and line.endswith(";"): | def func(arg, dirname, names): if 'templates' in names and 'templates.dist' in names: found.append(dirname + "/templates") |
endoid = o.rsplit('.', 1)[-1] | endoid = int(o.rsplit('.', 1)[-1]) | 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... |
endoids.sort() | 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... | |
g_counters[line[0]] = ( int(line[1]), int(line[2]) ) | g_counters[' '.join(line[0:-2])] = ( int(line[-2]), int(line[-1]) ) | def load_counters(hostname): global g_counters try: lines = file(counters_directory + "/" + hostname).readlines() for line in lines: line = line.split() g_counters[line[0]] = ( int(line[1]), int(line[2]) ) except: g_counters = {} |
date, time, level = line[3:-3].split(' ') | date, logtime, level = line[3:-3].split(' ') | def parse_file(host, file, hidecontext = "no"): filePath = defaults.logwatch_dir + '/' + host + '/' + file try: f = open(filePath, 'r') except: raise MKFileNotFoundException('The log file "%s" on host "%s" is empty or does not exist.' % \ (htmllib.attrencode(form_file_to_ext(file)), htmllib.attrenco... |
log['datetime'] = datetime.datetime(*time.strptime(date + ' ' + time, "%Y-%m-%d %H:%M:%S")[0:5]) | log['datetime'] = datetime.datetime(*time.strptime(date + ' ' + logtime, "%Y-%m-%d %H:%M:%S")[0:5]) | def parse_file(host, file, hidecontext = "no"): filePath = defaults.logwatch_dir + '/' + host + '/' + file try: f = open(filePath, 'r') except: raise MKFileNotFoundException('The log file "%s" on host "%s" is empty or does not exist.' % \ (htmllib.attrencode(form_file_to_ext(file)), htmllib.attrenco... |
style = 'height: %d; ' % (snapin_width) | style = 'height: %dpx; ' % (snapin_width) | 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: %d; cell-spacing: 1px; } | table.hostmatrix { width: %dpx; cell-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... |
width: %d; | width: %dpx; | def render_performance(): data = html.live.query("GET status\nColumns: service_checks_rate host_checks_rate external_commands_rate connections_rate forks_rate log_messages_rate cached_log_messages\n") html.write("<table class=performance>\n") for what, col, format in \ [("Service checks", 0, "%.2f/s"), ("Host checks", ... |
width: %d | width: %dpx; | def render_current_time(): import time html.write("<div class=time>%s</div>" % time.strftime("%H:%M")) |
width: %d; | width: %dpx; | def render_master_control(): items = [ ( "enable_notifications", "Notifications", ), ( "execute_service_checks", "Service checks" ), ( "execute_host_checks", "Host checks" ), ( "enable_event_handlers", "Event handlers" ), ( "process_performance_data", "Performance data"), ] html.live.set_prepend_site(Tru... |
if is_hex_string(v): | if len(v) > 2 and is_hex_string(v): | def strip_snmp_value(value): v = value.strip() if v.startswith('"'): v = v[1:-1] if is_hex_string(v): return convert_from_hex(v) else: return v.strip() else: return v.strip() |
if sys.argv[1] == '--defaults': | if len(sys.argv) >= 2 and sys.argv[1] == '--defaults': | def verbose(t): if opt_verbose: sys.stderr.write(t) sys.stderr.flush() |
(apache_user, apache_user, omd_site, " ".join(commandargs[2:]))) | (apache_user, apache_user, omd_site, " ".join(commandargs[3:]))) | 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... |
if newstatus > status: | if status_worse(newstatus, status): | def store_aggregated_service_result(hostname, detaildesc, aggrdesc, newstatus, newoutput): global g_aggregated_service_results count, status, outputlist = g_aggregated_service_results.get(aggrdesc, (0, 0, [])) if newstatus > status: status = newstatus if newstatus > 0: outputlist.append( (detaildesc, newoutput) ) g_agg... |
def status_worse(newstatus, status): if status == 2: return False elif newstatus == 2: return True else: return newstatus > status | def store_aggregated_service_result(hostname, detaildesc, aggrdesc, newstatus, newoutput): global g_aggregated_service_results count, status, outputlist = g_aggregated_service_results.get(aggrdesc, (0, 0, [])) if newstatus > status: status = newstatus if newstatus > 0: outputlist.append( (detaildesc, newoutput) ) g_agg... | |
'src="images/icon_reload.gif"></a>' % (what, row["site"], row["host_name"], name2, what) | 'src="images/icon_reload.gif" /></a>' % (what, row["site"], row["host_name"], name2, what) | def paint_icons(what, row): # what is "host" or "service" output = "" if what == "host": prefix = "host_" else: prefix = "service_" custom_vars = dict(zip(row[prefix + "custom_variable_names"], row[prefix + "custom_variable_values"])) # Icons configured in Nagios via icon_image if row[prefix + "icon_image"]: image = r... |
if html.var("save"): | if html.var("save") and html.check_transaction(): | def page_edit_bookmark(h): global html html = h html.header("Edit Bookmark") html.begin_form("edit_bookmark") n = int(html.var("num")) bookmarks = load_bookmarks() if html.var("save"): title = html.var("title") url = html.var("url") bookmarks[n] = (title, url) save_bookmarks(bookmarks) html.reload_sidebar() else: title... |
-d does not work not clusters (such defined in main.mk) but only on | -d does not work on clusters (such defined in main.mk) but only on | def usage(): print """WAYS TO CALL: check_mk [-n] [-v] [-p] HOST [IPADDRESS] check all services on HOST check_mk [-u] -I {tcp|snmp} [HOST1 ...] inventory - find new services check_mk -u, --cleanup-autochecks reorder autochecks files check_mk -N [HOSTS...] output Nagios configuration check_... |
varname = "_%s_%s" % (ct, item) | varname = ("_%s_%s" % (ct, item)).replace(' ', '+') | def mode_inventory(phase, firsttime): hostname = html.var("host") if hostname not in g_hosts: raise MKGeneralException("You called this page for a non-existing host.") if phase == "title": return "Services of host %s" % hostname elif phase == "action": if html.check_transaction(): table = check_mk_automation("try-inv... |
else: | elif 'idle' in check_mk.multiadmin_sounds: | def show_search_results(html, services, hosts): sortorder = html.var("sortorder", "0") sortcmp = sort_options[0][2] sortname = sort_options[0][1] for idname, description, comp in sort_options: if idname == sortorder: sortcmp = comp sortname = description break html.write("%d matching services on %d hosts, sort order: ... |
if check_mk.is_allowed_to_act(html.req.user) and (check_mk.is_unrestricted_action_user(html.req.user) or host in all_hosts()): | if not check_mk.is_allowed_to_act(html.req.user) and not (check_mk.is_unrestricted_action_user(html.req.user) or host in all_hosts()): | def do_log_ack(html): show_tabs(html, tabs, "log") host = html.var('host') file = form_file_to_int(html.var('file')) fileDisplay = form_file_to_ext(file) ack = html.var('ack') # check_mk.is_allowed_to_act: Does the user have the permission to act in multiadmin? # check_mk.is_unrestricted_action_user: Is the user all... |
if value.startswith('"'): | if value.strip().startswith('"'): | def do_snmpwalk_on(hostname, filename): if opt_verbose: sys.stdout.write("%s:\n" % hostname) ip = lookup_ipaddress(hostname) cmd = snmp_walk_command(hostname) + " -Ob -OQ %s " % ip out = file(filename, "w") for oid in [ "", "enterprises" ]: oids = [] values = [] if opt_verbose: sys.stdout.write("%s..." % (cmd + oid)) s... |
html.write('<script type="text/javascript" src="%s/search.js"></script>' % defaults.checkmk_web_uri) | def render_searchform(): html.write('<script type="text/javascript" src="%s/search.js"></script>' % defaults.checkmk_web_uri) html.write('<div id="mk_side_search">') html.write('<input id="mk_side_search_field" type="text" name="search" />') html.write('</div>') html.write('<script type="text/javascript">') # Store (u... | |
html.write('var aSearchHosts = %s;' % data) html.write('mkSearchAddField("mk_side_search_field", "main", "%s");</script>' % defaults.checkmk_web_uri) | html.write("aSearchHosts = %s;\n" % data) html.write('</script>') | def render_searchform(): html.write('<script type="text/javascript" src="%s/search.js"></script>' % defaults.checkmk_web_uri) html.write('<div id="mk_side_search">') html.write('<input id="mk_side_search_field" type="text" name="search" />') html.write('</div>') html.write('<script type="text/javascript">') # Store (u... |
class MKAuthException(Exception): def __init__(self, reason): self.reason = reason def __str__(self): return self.reason | def __str__(self): return self.reason | |
query = query + "OutputFormat: json\n" try: s.send(query) s.shutdown(socket.SHUT_WR) answer = "" while True: r = s.recv(65536) if r != "": answer += r else: break try: result = eval(answer) except: raise MKGeneralException("Invalid JSON output from Livestatus. " "Query was: <pre>%s</pre>. Result was: %s" % (query, answ... | query += "OutputFormat: json\nResponseHeader: fixed16\n" try: s.settimeout(2) s.send(query) s.shutdown(socket.SHUT_WR) | def query_livestatus_socket(s, query): query = query + "OutputFormat: json\n" try: s.send(query) s.shutdown(socket.SHUT_WR) answer = "" while True: r = s.recv(65536) if r != "": answer += r else: break try: result = eval(answer) except: raise MKGeneralException("Invalid JSON output from Livestatus. " "Query was: <pre>%... |
except MKGeneralException: raise | resp = receive_data(s, 16) code = resp[0:3] | def query_livestatus_socket(s, query): query = query + "OutputFormat: json\n" try: s.send(query) s.shutdown(socket.SHUT_WR) answer = "" while True: r = s.recv(65536) if r != "": answer += r else: break try: result = eval(answer) except: raise MKGeneralException("Invalid JSON output from Livestatus. " "Query was: <pre>%... |
except Exception, e: raise MKGeneralException("Cannot connect to %s: Please check if Livestatus module is correctly loaded and socket path is correct (Error: %s)" % (socket_path, e)) | if code == '200': length = int(resp[4:15].lstrip()) answer = receive_data(s, length) try: result = eval(answer) except: raise MKGeneralException("Invalid JSON output from Livestatus. " "Query was: <pre>%s</pre>. Result was: %s" % (query, answer)) elif code == '401': raise MKAuthException("Unauthorized. Invalid userna... | def query_livestatus_socket(s, query): query = query + "OutputFormat: json\n" try: s.send(query) s.shutdown(socket.SHUT_WR) answer = "" while True: r = s.recv(65536) if r != "": answer += r else: break try: result = eval(answer) except: raise MKGeneralException("Invalid JSON output from Livestatus. " "Query was: <pre>%... |
if hx != '00': r += chr(int(hx, 16)) | r += chr(int(hx, 16)) | def convert_from_hex(value): hexparts = value.split() r = "" for hx in hexparts: # Remove 0 bytes from strings. They lead to problems e.g. here: # On windows hosts the labels of network interfaces in oid # iso.3.6.1.2.1.2.2.1.2.1 are given as hex strings with tailing # 0 byte. When this string is part of the data which... |
if config.is_multisite(): sidebar_snapins["sitestatus"] = { "title" : "Site status", "render" : render_sitestatus, "allowed" : [ "user", "admin" ], "styles" : """ | sidebar_snapins["sitestatus"] = { "title" : "Site status", "render" : render_sitestatus, "allowed" : [ "user", "admin" ], "styles" : """ | def render_sitestatus(): if config.is_multisite(): html.write("<table cellspacing=0 class=sitestate>") for sitename in config.allsites(): site = config.site(sitename) state = html.site_status[sitename]["state"] if state == "disabled": switch = "on" text = site["alias"] else: switch = "off" text = link(site["alias"], "v... |
table.tacticaloverview { width: 100%; margin-top: 0px;} | table.tacticaloverview { border-collapse: separate; border-spacing: 3px; width: 100%; margin-top: 0px;} | def render_tactical_overview(): headers = \ "Stats: state >= 0\n" \ "Stats: state > 0\n" \ "Stats: state > 0\n" \ "Stats: acknowledged = 0\n" \ "StatsAnd: 2\n" try: svcdata = html.live.query_summed_stats("GET services\n" + headers) hstdata = html.live.query_summed_stats("GET hosts\n" + headers) except livestatus.MKLiv... |
length = int(resp[4:15].lstrip()) | try: length = int(resp[4:15].lstrip()) except: raise MKLivestatusSocketError("Malformed output. Livestatus TCP socket might be unreachable.") | 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.... |
except 1: | except Exception, e: | def handler(req): req.content_type = "text/html" req.header_sent = False # 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 Default html = htmllib.html(req) req.... |
html.write("<table><tr class=groupheader>") | html.write("<table class=groupheader><tr class=groupheader>") | def render_group(header, rows, paintheader): html.write("<table><tr class=groupheader>") |
html.write("<tr><td><table><tr class=groupheader>") | html.write("<tr><td><table class=groupheader><tr class=groupheader>") | def render_tiled(data, view, group_columns, group_painters, painters, _ignore_num_columns): columns, rows = data html.write("<table class=\"services tiled\">\n") last_group = None group_open = False for row in rows: # Show group header if len(group_painters) > 0: this_group = [ row[c] for c in group_columns ] if this_... |
html.write("<td class=groupheader colspan=%d><table><tr>" % (num_painters * (num_columns + 2) + (num_columns - 1))) | html.write("<td class=groupheader colspan=%d><table class=groupheader><tr>" % (num_painters * (num_columns + 2) + (num_columns - 1))) | def count_group_members(row, rows): |
for site_name in check_mk.sites(): | for site_name in configured_sites: | def enabled_sites(html): sites = [] for site_name in check_mk.sites(): if html.var("site_%s" % site_name) == "on": sites.append(site_name) return sites |
"columns" : ["contacts"], | "columns" : ["service_contacts"], | def paint_host_state_short(row): |
rowinfo = get_stored_snmpwalk(hostname, fetchoid + "." + str(column)) | rowinfo = get_stored_snmpwalk(hostname, fetchoid) | 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... |
rowinfo = snmpwalk_on_suboid(hostname, ip, fetchoid + "." + str(column)) | rowinfo = snmpwalk_on_suboid(hostname, ip, fetchoid) | 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... |
for oid, value in columns[max_len_col]: index_rows.append((oid, oid.split('.')[-1])) | for o, value in columns[max_len_col]: index_rows.append((o, o.split('.')[-1])) | 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... |
for oid, val in first_column: new_first_column.append((oid, str(suboid) + "." + str(val))) | for o, val in first_column: new_first_column.append((o, str(suboid) + "." + str(val))) | 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... |
for oid, value in column: endoid = oid.rsplit('.', 1)[-1] | for o, value in column: endoid = o.rsplit('.', 1)[-1] | 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... |
for oid, value in column: beginoid, endoid = oid.rsplit('.', 1) | for o, value in column: beginoid, endoid = o.rsplit('.', 1) | 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... |
ajax_url = site["url_prefix"] + "check_mk/ajax_wato_files.py?site=" + sitename | ajax_url = site["url_prefix"] + "check_mk/ajax_wato_files.py" | def render_wato_files(): if not config.may("use_wato"): html.write("You are not allowed to use Check_MK's web configuration GUI.") elif len(config.config_files)== 0: html.write("No configuration files are defined.<br>" "Please set the variable <tt>config_files</tt><br>" "in <tt>multisite.mk</tt>.") else: if config.is_... |
sitename = html.var('site', '') | def ajax_wato_files(h): global html html = h sitename = html.var('site', '') if config.may("use_wato"): for filename, title, roles in config.config_files: if config.role in roles: if sitename: bulletlink(title, "/%s/check_mk/wato.py?filename=%s" % (sitename, filename)) else: bulletlink(title, "wato.py?filename=%s" % fi... | |
if sitename: bulletlink(title, "/%s/check_mk/wato.py?filename=%s" % (sitename, filename)) else: bulletlink(title, "wato.py?filename=%s" % filename) | bulletlink(title, "wato.py?filename=%s" % filename) | def ajax_wato_files(h): global html html = h sitename = html.var('site', '') if config.may("use_wato"): for filename, title, roles in config.config_files: if config.role in roles: if sitename: bulletlink(title, "/%s/check_mk/wato.py?filename=%s" % (sitename, filename)) else: bulletlink(title, "wato.py?filename=%s" % fi... |
if len(rowinfo) > 0: | if len(rowinfo) > 0 or True: | 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... |
for col in columns: if len(col) > 0: break for oid, value in col: | for oid, value in columns[max_len_col]: | 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... |
state = "hhstatep" | sclass = "hhstatep" | def render_tiled(data, view, group_painters, painters, _ignore_num_columns): columns, rows = data html.write("<table class=\"services tiled\">\n") last_group = None group_open = False for row in rows: # Show group header if len(group_painters) > 0: this_group = group_value(row, group_painters) if this_group != last_gr... |
"%s ALL = (root) NOPASSWD: %s\ *\n" | "%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... |
(html.apache_user(), html.apache_user(), " ".join(commandargs[1:-1] + [ commandargs[-1].replace(' ', '\ ')]))) | (html.apache_user(), sudoline)) | 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... |
if not target.startswith("http:") and target[0] != '/': | if not (":" in target[:10]) and target[0] != '/': | def link(text, target): if not target.startswith("http:") and target[0] != '/': target = defaults.checkmk_web_uri + "/" + target return "<a target=\"main\" class=link href=\"%s\">%s</a>" % (target, htmllib.attrencode(text)) |
elif hidecontext: | elif not hidecontext: | def parse_file(host, file, hidecontext = False): logs = [] try: file_path = defaults.logwatch_dir + '/' + host + '/' + file if not os.path.exists(file_path): return [] f = open(file_path, 'r') chunk_open = False log = None for line in f.readlines(): line = line.strip() if line == '': continue if line[:3] == '<<<': # n... |
outfile.write(" use\t\t\t\t%s\n" % host_template) | outfile.write(" use\t\t\t\t%s\n" % (is_clust and cluster_template or host_template)) | def create_nagios_hostdefs(outfile, hostname): is_clust = is_cluster(hostname) # Determine IP address. For cluster hosts this is optional. # A cluster might have or not have a service ip address. try: ip = lookup_ipaddress(hostname) except: if not is_cluster(hostname): raise MKGeneralException("Cannot determine ip add... |
def __init__(self, countername): self.reason = countername | def __init__(self, countername, reason): self.name = countername self.reason = reason | def __init__(self, countername): self.reason = countername |
return self.reason | return '%s: %s' % (self.name, self.reason) | def __str__(self): return self.reason |
raise MKCounterWrapped(countername) | raise MKCounterWrapped(countername, 'Counter initialization') | def get_counter(countername, this_time, this_val): global g_counters # First time we see this counter? Do not return # any data! if not countername in g_counters: g_counters[countername] = (this_time, this_val) # Do not suppress this check on check_mk -nv if opt_dont_submit: return 1.0, 0.0 raise MKCounterWrapped(coun... |
raise MKCounterWrapped(countername) | raise MKCounterWrapped(countername, 'No time difference') | def get_counter(countername, this_time, this_val): global g_counters # First time we see this counter? Do not return # any data! if not countername in g_counters: g_counters[countername] = (this_time, this_val) # Do not suppress this check on check_mk -nv if opt_dont_submit: return 1.0, 0.0 raise MKCounterWrapped(coun... |
raise MKCounterWrapped(countername) | raise MKCounterWrapped(countername, 'Value overflow') | def get_counter(countername, this_time, this_val): global g_counters # First time we see this counter? Do not return # any data! if not countername in g_counters: g_counters[countername] = (this_time, this_val) # Do not suppress this check on check_mk -nv if opt_dont_submit: return 1.0, 0.0 raise MKCounterWrapped(coun... |
except MKCounterWrapped: | except MKCounterWrapped, e: | def do_all_checks_on_host(hostname, ipaddress): global g_aggregated_service_results g_aggregated_service_results = {} global g_hostname g_hostname = hostname num_success = 0 num_errors = 0 check_table = get_sorted_check_table(hostname) for checkname, item, params, description, info in check_table: # In case of a precom... |
print "Counter wrapped, not handled by check, ignoring this check result" | print "Counter wrapped, not handled by check, ignoring this check result: %s" % e | def do_all_checks_on_host(hostname, ipaddress): global g_aggregated_service_results g_aggregated_service_results = {} global g_hostname g_hostname = hostname num_success = 0 num_errors = 0 check_table = get_sorted_check_table(hostname) for checkname, item, params, description, info in check_table: # In case of a precom... |
end = int(time.time()) start = end - (24 * 60 * 60) | def paint_pnpgraph(sitename, host, service = "_HOST_"): site = html.site_status[sitename]["site"] pnpurl = site["pnp_url"] end = int(time.time()) start = end - (24 * 60 * 60) htmlcode = "" for source in [ 1, 2, 3, 4, 5, 6, 7 ]: urlvars = 'start=%d&end=%d&host=%s&srv=%s&source=%d' % (start, end, htmllib.urlencode(host),... | |
urlvars = 'start=%d&end=%d&host=%s&srv=%s&source=%d' % (start, end, htmllib.urlencode(host), htmllib.urlencode(service), source) htmlcode += '<div class=pnpgraph><a href="%s/graph?%s"><img src="%s/image?%s&view=0"></a></div>' % \ | urlvars = '&host=%s&srv=%s&source=%d' % ( htmllib.urlencode(host), htmllib.urlencode(service), source) htmlcode += '<div class=pnpgraph><a href="%s/index.php/graph?%s"><img src="%s/image?%s&view=0"></a></div>' % \ | def paint_pnpgraph(sitename, host, service = "_HOST_"): site = html.site_status[sitename]["site"] pnpurl = site["pnp_url"] end = int(time.time()) start = end - (24 * 60 * 60) htmlcode = "" for source in [ 1, 2, 3, 4, 5, 6, 7 ]: urlvars = 'start=%d&end=%d&host=%s&srv=%s&source=%d' % (start, end, htmllib.urlencode(host),... |
url = site["pnp_url"] + ("graph?host=%s&srv=%s" % (htmllib.urlencode(host), htmllib.urlencode(svc))) | url = site["pnp_url"] + ("index.php/graph?host=%s&srv=%s" % (htmllib.urlencode(host), htmllib.urlencode(svc))) | def pnp_url(row): sitename = row["site"] host = row["host_name"] svc = row["service_description"] svc = svc.replace(":", "_").replace("\\", "_") site = html.site_status[sitename]["site"] url = site["pnp_url"] + ("graph?host=%s&srv=%s" % (htmllib.urlencode(host), htmllib.urlencode(svc))) return url |
<body class="side"> | <body class="side" onload="initScrollPos()" onunload="storeScrollPos()"> | 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 len(sites) > 1 | if len(sites) > 1: return True sitename = sites.keys()[0] return not site_is_local(sitename) | def is_multisite(): return len(sites) > 1 |
html.live = livestatus.SingleSiteConnection("unix:" + config.defaults["livestatus_unix_socket"]) | html.live = livestatus.SingleSiteConnection("unix:" + defaults.livestatus_unix_socket) | def connect_to_livestatus(html): html.site_status = {} # site_status keeps a dictionary for each site with the following # keys: # "state" --> "online", "offline", "disabled" # "exception" --> An error exception in case of "offline" # "livestatus_version" --> Version of sites livestatus if "online... |
out.write("\n out.write(extra_nagios_conf) | outfile.write("\n outfile.write(extra_nagios_conf) | def create_nagios_config(outfile = sys.stdout, hostnames = None): global hostgroups_to_define hostgroups_to_define = set([]) global servicegroups_to_define servicegroups_to_define = set([]) global contactgroups_to_define contactgroups_to_define = set([]) global checknames_to_define checknames_to_define = set([]) if ho... |
has_done_actions = do_actions(datasource["infos"][0], rows) | html.write("<tr class=form><td class=whiteborder colspan=%d>" % colspan) has_done_actions = do_actions(datasource["infos"][0], rows, html.makeuri([])) html.write("</td></tr>") | def show_view(view, show_heading = False, show_buttons = True): # [1] Datasource datasource = multisite_datasources[view["datasource"]] tablename = datasource["table"] # [2] Layout layout = multisite_layouts[view["layout"]] # User can override the layout settings via HTML variables (buttons) # which are safed persist... |
html.write("</table>\n") if has_done_actions: html.write("<a href=\"%s\">Back to search results</a>" % html.makeuri([])) else: | html.write("</table>\n") if not has_done_actions: | def show_view(view, show_heading = False, show_buttons = True): # [1] Datasource datasource = multisite_datasources[view["datasource"]] tablename = datasource["table"] # [2] Layout layout = multisite_layouts[view["layout"]] # User can override the layout settings via HTML variables (buttons) # which are safed persist... |
def do_actions(what, rows): | def do_actions(what, rows, backurl): | def do_actions(what, rows): if not config.may("act"): html.show_error("You are not allowed to perform actions. If you think this is an error, " "please ask your administrator grant you the permission to do so.") return False # no actions done command = None title = nagios_action_command(what, rows[0])[0] # just get th... |
html.message("Successfully sent %d commands to Nagios. The last one was: <pre>%s</pre>" % (count, command)) | message = "Successfully sent %d commands to Nagios." % count if config.debug: message += "The last one was: <pre>%s</pre>" % command message += '<br><a href="%s">Back to view</a>' % backurl html.message(message) | def do_actions(what, rows): if not config.may("act"): html.show_error("You are not allowed to perform actions. If you think this is an error, " "please ask your administrator grant you the permission to do so.") return False # no actions done command = None title = nagios_action_command(what, rows[0])[0] # just get th... |
outfile.write(" use\t\t\t\t%s-summary\n" % host_template) | outfile.write(" use\t\t\t\t%s-summary\n" % (is_clust and cluster_template or host_template)) | def create_nagios_hostdefs(outfile, hostname): is_clust = is_cluster(hostname) # Determine IP address. For cluster hosts this is optional. # A cluster might have or not have a service ip address. try: ip = lookup_ipaddress(hostname) except: if not is_cluster(hostname): raise MKGeneralException("Cannot determine ip add... |
return "count hstate hstate%s" % id, str(count) | if id != None: return "count hstate hstate%s" % id, str(count) else: return "count hstate hstatep", str(count) | def paint_host_count(id, count): if count > 0: return "count hstate hstate%s" % id, str(count) else: return "count hstate hstatex", "0" |
"paint" : lambda row: paint_host_count(0, row["hostgroup_num_hosts_down"]) | "paint" : lambda row: paint_host_count(1, row["hostgroup_num_hosts_down"]) | def paint_host_list(row): h = "<div class=objectlist>" for host, state, checked in row["hostgroup_members_with_state"]: link = "view.py?view_name=host&site=%s&host=%s" % ( htmllib.urlencode(row["site"]), htmllib.urlencode(host)) if checked: css = "hstate%d" % state else: css = "hstatep" h += "<div class=\"%s\"><a href=... |
"paint" : lambda row: paint_host_count(0, row["hostgroup_num_hosts_unreach"]) | "paint" : lambda row: paint_host_count(2, row["hostgroup_num_hosts_unreach"]) | def paint_host_list(row): h = "<div class=objectlist>" for host, state, checked in row["hostgroup_members_with_state"]: link = "view.py?view_name=host&site=%s&host=%s" % ( htmllib.urlencode(row["site"]), htmllib.urlencode(host)) if checked: css = "hstate%d" % state else: css = "hstatep" h += "<div class=\"%s\"><a href=... |
"short" : "Un", | "short" : "Pd", | def paint_host_list(row): h = "<div class=objectlist>" for host, state, checked in row["hostgroup_members_with_state"]: link = "view.py?view_name=host&site=%s&host=%s" % ( htmllib.urlencode(row["site"]), htmllib.urlencode(host)) if checked: css = "hstate%d" % state else: css = "hstatep" h += "<div class=\"%s\"><a href=... |
"paint" : lambda row: paint_host_count(0, row["hostgroup_num_hosts_pending"]) | "paint" : lambda row: paint_host_count(None, row["hostgroup_num_hosts_pending"]) | def paint_host_list(row): h = "<div class=objectlist>" for host, state, checked in row["hostgroup_members_with_state"]: link = "view.py?view_name=host&site=%s&host=%s" % ( htmllib.urlencode(row["site"]), htmllib.urlencode(host)) if checked: css = "hstate%d" % state else: css = "hstatep" h += "<div class=\"%s\"><a href=... |
"See all objects regardless of contacts and contact groups. If combined with 'perform commands' then commands may be done on all objects.", | "See all objects regardless of contacts and contact groups. If combined<br>with 'perform commands' then commands may be done on all objects.", | def declare_permission_section(name, title): permission_sections[name] = title |
"Interactively change the number of columns being displayed by a view (does not edit or customize the view)", | "Interactively change the number of columns being displayed by a view<br>(does not edit or customize the view)", | def declare_permission_section(name, title): permission_sections[name] = title |
"Interactively change the automatic browser reload of a view being displayed (does not edit or customize the view)", | "Interactively change the automatic browser reload of a view being displayed<br>(does not edit or customize the view)", | def declare_permission_section(name, title): permission_sections[name] = title |
"Allows users to perform Nagios commands. If now futher permissions are granted, actions can only be done one objects one is a contact for", | "Allows users to perform Nagios commands. If now futher permissions are granted,<br>actions can only be done one objects one is a contact for", | def declare_permission_section(name, title): permission_sections[name] = title |
(self.what, current_value)) | (self.what, current_value), current_value) | def heading_info(self, infoname): current_value = self.current_value(infoname) if current_value: alias = html.live.query_value("GET %sgroups\nColumns: alias\nFilter: name = %s\n" % (self.what, current_value)) return alias |
html.write('<div id="side_header" style="margin-top: 0px;">' '<div class="logo"><a target="_blank" href="http://mathias-kettner.de">' '<img border=0 src="images/sidebar_oben.png"></a></div>' | html.write('<div id="side_header">' '<a class="logo" target="_blank" href="http://mathias-kettner.de"></a>' | def sidebar_head(): html.write('<div id="side_header" style="margin-top: 0px;">' '<div class="logo"><a target="_blank" href="http://mathias-kettner.de">' '<img border=0 src="images/sidebar_oben.png"></a></div>' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.