I have Solaris 10 + Zenoss 2.7.0 and I cannot upgrade it without Oracle licence, so I try to find workaround, that's why I ask for your help.
I need to prevent the movement of events into History Table, for any event from the same device recieved during the last 5 minutes and then drop event if the count is more then 5.
That's what I try to do (mapping is placed in /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'
And I have this error in 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)