当前位置: 首页>>代码示例>>Python>>正文


Python NSCP.log_debug函数代码示例

本文整理汇总了Python中NSCP.log_debug函数的典型用法代码示例。如果您正苦于以下问题:Python log_debug函数的具体用法?Python log_debug怎么用?Python log_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了log_debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: log

 def log(self, show_all = False, prefix = '', indent = 0):
     if self.status:
         if show_all:
             log('%s%s%s'%(prefix, ''.rjust(indent, ' '), self))
         log_debug('%s%s%s'%(prefix, ''.rjust(indent, ' '), self))
     else:
         log_error('%s%s%s'%(prefix, ''.rjust(indent, ' '), self))
开发者ID:mickem,项目名称:nscp,代码行数:7,代码来源:test_helper.py

示例2: log

	def log(self, prefix = '', indent = 0):
		start = '%s%s'%(prefix, ''.rjust(indent, ' '))
		if self.status:
			log_debug('%s%s'%(start, self))
		else:
			log_error('%s%s'%(start, self))
		for c in self.children:
			c.log(prefix, indent+1)
开发者ID:Fox-Alpha,项目名称:nscp,代码行数:8,代码来源:test_helper.py

示例3: serialize

	def serialize(self, string, filename):
		path = os.path.dirname(filename)
		if not os.path.exists(path):
			os.makedirs(path)
		f = open(filename,"w")
		f.write(string)
		f.close()
		log_debug('Writing file: %s'%filename)
开发者ID:borgified,项目名称:nscp,代码行数:8,代码来源:docs.py

示例4: log

 def log(self, prefix="", indent=0):
     start = "%s%s" % (prefix, "".rjust(indent, " "))
     if self.status:
         log_debug("%s%s" % (start, self))
     else:
         log_error("%s%s" % (start, self))
     for c in self.children:
         c.log(prefix, indent + 1)
开发者ID:jkells,项目名称:nscp,代码行数:8,代码来源:test_helper.py

示例5: return_nagios

 def return_nagios(self):
     (total, ok) = self.count()
     log_debug(" | Test result log (only summary will be returned to query)")
     self.log(" | ")
     if total == ok:
         return (status.OK, "OK: %d test(s) successfull" % (total))
     else:
         return (status.CRITICAL, "ERROR: %d/%d test(s) failed" % (total - ok, total))
开发者ID:jkells,项目名称:nscp,代码行数:8,代码来源:test_helper.py

示例6: generate_rst

	def generate_rst(self, input_dir, output_dir):
		root = self.get_info()
		i = 0
		
		env = Environment(extensions=["jinja2.ext.do",])
		env.filters['firstline'] = first_line
		env.filters['rst_link'] = make_rst_link
		env.filters['rst_table'] = render_rst_table
		env.filters['rst_csvtable'] = render_rst_csv_table
		env.filters['rst_heading'] = render_rst_heading
		env.filters['extract_value'] = extract_value
		env.filters['block_pad'] = block_pad
		env.filters['common_head'] = calculate_common_head
		env.filters['as_text'] = as_text
		
		for (module,minfo) in root.plugins.iteritems():
			out_base_path = '%s/reference/'%output_dir
			sample_base_path = '%s/samples/'%output_dir
			if minfo.namespace:
				out_base_path = '%s/reference/%s/'%(output_dir, minfo.namespace)
			hash = root.get_hash()
			minfo.key = module
			minfo.queries = {}
			for (c,cinfo) in sorted(root.commands.iteritems()):
				if module in cinfo.info.plugin:
					more_info = self.fetch_command(c,cinfo)
					if more_info:
						cinfo = more_info
					sfile = '%s%s_%s_samples.inc'%(sample_base_path, module, c)
					if os.path.exists(sfile):
						cinfo.sample = os.path.basename(sfile)
						#all_samples.append((module, command, sfile))
					cinfo.key = c
					minfo.queries[c] = cinfo
			minfo.aliases = {}
			for (c,cinfo) in sorted(root.aliases.iteritems()):
				if module in cinfo.info.plugin:
					cinfo.key = c
					minfo.aliases[c] = cinfo
					
			minfo.paths = {}
			for (c,cinfo) in sorted(root.paths.iteritems()):
				if module in cinfo.info.plugin:
					cinfo.key = c
					minfo.paths[c] = cinfo

			hash['module'] = minfo
			i=i+1
			log_debug('Processing module: %d of %d [%s]'%(i, len(root.plugins), module))

			template = env.from_string(module_template)
			render_template(hash, template, '%s/%s.rst'%(out_base_path, module))

		log_debug('%s/samples/index.rst'%output_dir)
		hash = root.get_hash()
		template = env.from_string(samples_template)
		render_template(hash, template, '%s/samples/index.rst'%output_dir)
开发者ID:0000-bigtree,项目名称:nscp,代码行数:57,代码来源:docs.py

示例7: get_keys

	def get_keys(self, path):
		(code, data) = self.conf.query(self.build_inventory_request(path, False, True))
		if code == 1:
			message = plugin_pb2.SettingsResponseMessage()
			message.ParseFromString(data)
			for payload in message.payload:
				if payload.inventory:
					log_debug('Found %d keys for %s'%(len(payload.inventory), path))
					return payload.inventory
		return []
开发者ID:ossmon,项目名称:nscp,代码行数:10,代码来源:docs.py

示例8: get_paths

	def get_paths(self):
		(code, data) = self.conf.query(self.build_inventory_request())
		if code == 1:
			message = plugin_pb2.SettingsResponseMessage()
			message.ParseFromString(data)
			for payload in message.payload:
				if payload.inventory:
					log_debug('Found %d paths'%len(payload.inventory))
					return payload.inventory
		return []
开发者ID:ossmon,项目名称:nscp,代码行数:10,代码来源:docs.py

示例9: simple_inbox_handler_wrapped

	def simple_inbox_handler_wrapped(self, channel, source, command, status, message, perf):
		log_debug('Got message %s on %s'%(command, channel))
		msg = NSCAMessage(command)
		msg.source = source
		msg.status = status
		msg.message = message
		msg.perfdata = perf
		msg.got_simple_response = True
		self.set_response(msg)
		return True
开发者ID:0000-bigtree,项目名称:nscp,代码行数:10,代码来源:test_nsca.py

示例10: get_plugins

	def get_plugins(self):
		(code, data) = self.registry.query(self.build_command_request(4))
		if code == 1:
			message = plugin_pb2.RegistryResponseMessage()
			message.ParseFromString(data)
			for payload in message.payload:
				if payload.inventory:
					log_debug('Found %d plugins'%len(payload.inventory))
					return payload.inventory
		log_error('No plugins')
		return []
开发者ID:borgified,项目名称:nscp,代码行数:11,代码来源:docs.py

示例11: setup

 def setup(self, plugin_id, prefix):
     t = datetime.datetime.fromtimestamp(time.mktime(time.localtime()))
     t = t + datetime.timedelta(seconds=60)
     tm = time.strftime("%H:%M", t.timetuple())
     folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
     log("Adding scheduled tasks")
     for state in ['OK', 'WARN', 'CRIT', 'LONG']:
         cmd = "schtasks.exe /Create /SC DAILY /TN NSCPSample_%s /TR \"%s\\check_test.bat %s\" /ST %s /F"%(state, folder, state, tm)
         log_debug(cmd)
         check_output(cmd)
     log("Waiting 1 minute (for tasks to run)")
     time.sleep(60)
开发者ID:mickem,项目名称:nscp,代码行数:12,代码来源:test_w32_schetask.py

示例12: get_query_aliases

	def get_query_aliases(self):
		log_debug('Fetching aliases...')
		(code, data) = self.registry.query(self.build_command_request(5))
		if code == 1:
			message = plugin_pb2.RegistryResponseMessage()
			message.ParseFromString(data)
			for payload in message.payload:
				if payload.inventory:
					log_debug('Found %d aliases'%len(payload.inventory))
					return payload.inventory
		log_error('No aliases found')
		return []
开发者ID:ossmon,项目名称:nscp,代码行数:12,代码来源:docs.py

示例13: inbox_handler_wrapped

	def inbox_handler_wrapped(self, channel, request):
		message = plugin_pb2.SubmitRequestMessage()
		message.ParseFromString(request)
		if len(message.payload) != 1:
			log_error("Got invalid message on channel: %s"%channel)
			return None
		command = message.payload[0].command
		log_debug('Got message %s on %s'%(command, channel))
		
		msg = NSCAMessage(command)
		msg.got_response = True
		self.set_response(msg)
		return None
开发者ID:0000-bigtree,项目名称:nscp,代码行数:13,代码来源:test_nsca.py

示例14: wait_and_validate

	def wait_and_validate(self, uuid, result, msg, perf, tag):
		found = False
		for i in range(0,10):
			if not self.has_response(uuid):
				log_debug('Waiting for %s (%d/10)'%(uuid, i+1))
				sleep(200)
			else:
				log_debug('Got response %s'%uuid)
				found = True
				break
		if not found:
			result.add_message(False, 'Failed to recieve message %s using %s'%(uuid, tag))
			return False
		
		for i in range(0,10):
			rmsg = self.get_response(uuid)
			if not rmsg.got_simple_response or not rmsg.got_response:
				log_debug('Waiting for delayed response %s s/m: %s/%s - (%d/10)'%(uuid, rmsg.got_simple_response, rmsg.got_response, i+1))
				sleep(500)
			else:
				log_debug('Got delayed response %s'%uuid)
				break
		
		result.add_message(rmsg.got_response, 'Testing to recieve message using %s'%tag)
		result.add_message(rmsg.got_simple_response, 'Testing to recieve simple message using %s'%tag)
		result.assert_equals(rmsg.command, uuid, 'Verify that command is sent through using %s'%tag)
		result.assert_contains(rmsg.message, msg, 'Verify that message is sent through using %s'%tag)
		
		#result.assert_equals(rmsg.last_source, source, 'Verify that source is sent through')
		#result.assert_equals(rmsg.perfdata, perf, 'Verify that performance data is sent through using %s'%tag)
		self.del_response(uuid)
		return True
开发者ID:0000-bigtree,项目名称:nscp,代码行数:32,代码来源:test_nsca.py

示例15: check_ts_query

 def check_ts_query(self, task, code):
     result = TestResult('Checking task %s'%task)
     for i in [0, 1, 2, 3, 4]:
         # check_tasksched "filter=title = 'NSCPSample_CRIT'" "warn=exit_code != 3"
         args = ["filter=title = 'NSCPSample_%s'"%task, 
             "warn=exit_code = %d"%i]
         log_debug(', '.join(args))
         (ret, msg, perf) = self.core.simple_query('check_tasksched', args)
         
         if i == code:
             result.assert_equals(ret, status.WARNING, 'Verify WARN result: %s'%msg)
         else:
             result.assert_equals(ret, status.OK, 'Verify OK result: %s'%msg)
         
     return result
开发者ID:mickem,项目名称:nscp,代码行数:15,代码来源:test_w32_schetask.py


注:本文中的NSCP.log_debug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。