我有 Solaris 10 + Zenoss 2.7.0,如果没有 Oracle 许可证,我无法升级它,所以我试图找到解决方法,这就是我寻求你帮助的原因。
对于过去 5 分钟内收到的来自同一设备的任何事件,我需要防止将事件移动到History Table中,如果计数超过 5,则删除事件。
这就是我尝试做的(映射放在/Unknown/linkUp中)
try:
import Globals
import sys
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
except Exception as error:
logging.error('ApplyTestZSB. Cannot import ZenScriptBase: %s\n' % error)
sys.exit(1)
dmd = None
try:
dmd = ZenScriptBase(connect=True).dmd
except Exception as error:
logging.error(
'ApplyTestDMD. Connection to zenoss dmd failed: %s\n' % error)
sys.exit(1)
ourMessage = str(getattr(evt, "message"))
ourDevice = str(evt.device)
ourLastTime = float(evt.lastTime)
old_elements = 0
if evt.device and evt.component and evt.eventClass and evt.eventKey:
ourDedupId = '|'.join(
[evt.device, evt.component, evt.eventClass, evt.eventKey, ''])
for event in dmd.ZenEventManager.getEventList():
if (event.lastTime > ourLastTime - 301) and \
((ourDedupId in str(event.dedupid) and event.severity > 0) or
(ourMessage == event.message and ourDevice == event.device)):
old_elements += event.count
if old_elements > 4:
evt._action = 'drop'
我在 zenhub.log 中有这个错误:
2013-06-15 21:21:11 ERROR zen.Events: Error transforming EventClassInst linkUp (1)
2013-06-15 21:21:20 ERROR root: ApplyTestDMD. Connection to zenoss dmd failed: 2
2013-06-15 21:21:20 ERROR zen.Events: Error transforming EventClassInst linkUp (1)
2013-06-15 21:21:24 ERROR root: ApplyTestDMD. Connection to zenoss dmd failed: 2
2013-06-15 21:21:24 ERROR zen.Events: Error transforming EventClassInst linkUp (1)
2013-06-15 21:21:28 ERROR root: ApplyTestDMD. Connection to zenoss dmd failed: 2
2013-06-15 21:21:28 ERROR zen.Events: Error transforming EventClassInst linkUp (1)