本文整理汇总了Python中Output.Output.event方法的典型用法代码示例。如果您正苦于以下问题:Python Output.event方法的具体用法?Python Output.event怎么用?Python Output.event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output.Output
的用法示例。
在下文中一共展示了Output.event方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_message
# 需要导入模块: from Output import Output [as 别名]
# 或者: from Output.Output import event [as 别名]
def send_message(self, event):
if self._event_os_cached(event):
return
if self._exclude_event(event):
return
# use default values for some empty attributes
event = self._plugin_defaults(event)
Output.event(event)
Stats.new_event(event)
return
# check for consolidation
if self.conn is not None:
try:
self.conn.send(str(event))
except:
id = self._plugin.get("config", "plugin_id")
c = ServerConnPro(self._conf, id)
self.conn = c.connect(0, 10)
try:
self.conn.send(str(event))
except:
return
logger.info(str(event).rstrip())
elif not self.consolidation.insert(event):
Output.event(event)
Stats.new_event(event)
示例2: send_message
# 需要导入模块: from Output import Output [as 别名]
# 或者: from Output.Output import event [as 别名]
def send_message(self, event):
if self._event_os_cached(event):
return
if self._exclude_event(event):
return
# use default values for some empty attributes
event = self._plugin_defaults(event)
Output.event(event)
Stats.new_event(event)
return
示例3: clear
# 需要导入模块: from Output import Output [as 别名]
# 或者: from Output.Output import event [as 别名]
def clear(self):
events_to_remove = []
for event in self.__event_list:
Output.event(event)
events_to_remove.append(event)
Stats.consolidation['consolidated'] += 1
for e in events_to_remove:
self.__event_list.removeRule(e)
del events_to_remove
示例4: send_message
# 需要导入模块: from Output import Output [as 别名]
# 或者: from Output.Output import event [as 别名]
def send_message(self, event):
if self._event_os_cached(event):
return
if self._exclude_event(event):
return
# use default values for some empty attributes
# check_data =True
# if event["event_type"] != EventIdm.EVENT_TYPE:
# check_data =False
event = self._plugin_defaults(event)
Output.event(event)
Stats.new_event(event)
return
示例5: evaluate
# 需要导入模块: from Output import Output [as 别名]
# 或者: from Output.Output import event [as 别名]
def evaluate(self, rule_name):
if self.first_value is None:
logger.debug("Can not extract value (arg1) from monitor response or no initial value to compare with")
return True
value = None
monitor_response = self.get_data(rule_name)
if not monitor_response:
logger.warning("No data received from monitor")
return True
else:
value = self.get_value(monitor_response, rule_name)
if value is None:
return True
#if not value:
# continue
if self.eval_condition(cond=self.watch_rule["condition"],
arg1=self.first_value,
arg2=value,
value=int(self.watch_rule["value"])):
self.watch_rule["type"] = "monitor"
try:
cond = self.watch_rule["condition"]
arg1 = self.first_value
arg2 = value
value = int(self.watch_rule["value"])
comm = self.queries
log = "Monitor Command: %s , Monitor expresion evaluation: %s(arg2) <%s> %s(arg1) + %s(value)? , Command Response: %s" % (str(comm), str(arg2), str(cond), str(arg1), str(value), monitor_response.replace("\n", "\r"))
except:
log = "Monitor Exception"
self.watch_rule = self._plugin_defaults(self.watch_rule, log)
Output.event(self.watch_rule)
Stats.new_event(self.watch_rule)
return True
logger.debug("No data matching the watch-rule received from monitor")
return False
示例6: send_message
# 需要导入模块: from Output import Output [as 别名]
# 或者: from Output.Output import event [as 别名]
def send_message(self,data):
event = self._setdefaults(data)
Output.event(event)