本文整理汇总了Python中shinken.basemodule.BaseModule.manage_brok方法的典型用法代码示例。如果您正苦于以下问题:Python BaseModule.manage_brok方法的具体用法?Python BaseModule.manage_brok怎么用?Python BaseModule.manage_brok使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shinken.basemodule.BaseModule
的用法示例。
在下文中一共展示了BaseModule.manage_brok方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: manage_brok
# 需要导入模块: from shinken.basemodule import BaseModule [as 别名]
# 或者: from shinken.basemodule.BaseModule import manage_brok [as 别名]
def manage_brok(self, b):
# We need to do some brok mod, so we copy it
new_b = copy.deepcopy(b)
# If we synchronize, must look for id change
if self.synchronize_database_id != 0 and 'instance_id' in new_b.data:
# If we use database sync, we have to synchronize database id
# so we wait for the instance name
brok_id = new_b.data['instance_id']
converted_instance_id = self.convert_id(brok_id)
if converted_instance_id is not None:
new_b.data['instance_id'] = converted_instance_id
queries = BaseModule.manage_brok(self, new_b)
if queries is not None:
for q in queries:
self.db.execute_query(q)
if converted_instance_id is None:
if brok_id in self.todo:
self.todo[brok_id].append(new_b)
else:
self.todo[brok_id] = [new_b]
if converted_instance_id is None and 'instance_name' in new_b.data:
converted_brok_id = self.get_instance_id(new_b.data['instance_name'])
self.database_id_cache[brok_id] = converted_brok_id
# We have to put the good instance ID to all brok waiting
# in the list then execute the query
for brok in self.todo[brok_id]:
brok.data['instance_id'] = converted_brok_id
queries = BaseModule.manage_brok(self, brok)
if queries is not None:
for q in queries:
self.db.execute_query(q)
# We've finished to manage the todo, so we empty it
self.todo[brok_id] = []
return
# Executed if we don't synchronize or there is no instance_id
queries = BaseModule.manage_brok(self, new_b)
if queries is not None:
for q in queries:
self.db.execute_query(q)
return
示例2: manage_brok
# 需要导入模块: from shinken.basemodule import BaseModule [as 别名]
# 或者: from shinken.basemodule.BaseModule import manage_brok [as 别名]
def manage_brok(self, b):
# We've got problem with instance_id == 0 so we add 1 every where
if "instance_id" in b.data:
b.data["instance_id"] = b.data["instance_id"] + 1
# print "(Ndo) I search manager:", manager
queries = BaseModule.manage_brok(self, b)
if queries is not None:
for q in queries:
self.db.execute_query(q)
return
示例3: manage_brok
# 需要导入模块: from shinken.basemodule import BaseModule [as 别名]
# 或者: from shinken.basemodule.BaseModule import manage_brok [as 别名]
def manage_brok(self, b):
# We need to do some brok mod, so we copy it
new_b = copy.deepcopy(b)
# If we synchronize, must look for id change
if self.synchronize_database_id != '0' and 'instance_id' in new_b.data:
# If we use database sync, we have to synchronize database id
# so we wait for the instance name
if 'instance_name' not in new_b.data:
self.todo.append(new_b)
return
# We convert the id to write properly in the base using the
# instance_name to reuse the instance_id in the base.
else:
new_b.data['instance_id'] = self.convert_id(
new_b.data['instance_id'], new_b.data['instance_name']
)
self.todo.append(new_b)
for brok in self.todo:
# We have to put the good instance ID to all brok waiting
# in the list then execute the query
brok.data['instance_id'] = new_b.data['instance_id']
queries = BaseModule.manage_brok(self, brok)
if queries is not None:
for q in queries:
self.db.execute_query(q)
# We've finished to manage the todo, so we empty it
self.todo = []
return
# Executed if we don't synchronize or there is no instance_id
queries = BaseModule.manage_brok(self, new_b)
if queries is not None:
for q in queries:
self.db.execute_query(q)
return
示例4: manage_brok
# 需要导入模块: from shinken.basemodule import BaseModule [as 别名]
# 或者: from shinken.basemodule.BaseModule import manage_brok [as 别名]
def manage_brok(self, b):
# We need to do some brok mod, so we copy it
new_b = copy.deepcopy(b)
# We've got problem with instance_id == 0 so we add 1 every where
if "instance_id" in new_b.data:
# For nagios mix install, move more than 1
if self.nagios_mix_offset != 0:
new_b.data["instance_id"] = new_b.data["instance_id"] + self.nagios_mix_offset
else:
new_b.data["instance_id"] = new_b.data["instance_id"] + 1
queries = BaseModule.manage_brok(self, new_b)
if queries is not None:
for q in queries:
self.db.execute_query(q)
return
示例5: manage_brok
# 需要导入模块: from shinken.basemodule import BaseModule [as 别名]
# 或者: from shinken.basemodule.BaseModule import manage_brok [as 别名]
def manage_brok(self, b):
if self.process_performance_data or b.type in ('program_status', 'update_program_status'):
BaseModule.manage_brok(self, b)
示例6: manage_brok
# 需要导入模块: from shinken.basemodule import BaseModule [as 别名]
# 或者: from shinken.basemodule.BaseModule import manage_brok [as 别名]
def manage_brok(self, b):
logger.info("[mongodb_broker] %s" % self.pp.pformat(b.type))
return BaseModule.manage_brok(self, b)
示例7: manage_brok
# 需要导入模块: from shinken.basemodule import BaseModule [as 别名]
# 或者: from shinken.basemodule.BaseModule import manage_brok [as 别名]
def manage_brok(self, b):
# We will transform data of b, so copy it
return BaseModule.manage_brok(self, copy.deepcopy(b))
示例8: manage_brok
# 需要导入模块: from shinken.basemodule import BaseModule [as 别名]
# 或者: from shinken.basemodule.BaseModule import manage_brok [as 别名]
def manage_brok(self, b):
if b.type in ('initial_host_status', 'initial_service_status', 'service_check_result', 'host_check_result'):
BaseModule.manage_brok(self, b)