Package Products :: Package ZenEvents :: Module MySqlEventManager
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenEvents.MySqlEventManager

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 or (at your 
 8  # option) any later version as published by the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  import logging 
15  log = logging.getLogger("zen.Events") 
16   
17  from Globals import InitializeClass 
18  from Globals import DTMLFile 
19  from AccessControl import ClassSecurityInfo 
20   
21  from EventManagerBase import EventManagerBase 
22  from MySqlSendEvent import MySqlSendEventMixin 
23   
24 -def manage_addMySqlEventManager(context, id=None, evthost="localhost", 25 evtuser="root", evtpass="", evtdb="events", 26 evtport=3306, 27 history=False, REQUEST=None):
28 '''make an MySqlEventManager''' 29 if not id: 30 id = "ZenEventManager" 31 if history: id = "ZenEventHistory" 32 evtmgr = MySqlEventManager(id, hostname=evthost, username=evtuser, 33 password=evtpass, database=evtdb, 34 port=evtport) 35 context._setObject(id, evtmgr) 36 evtmgr = context._getOb(id) 37 evtmgr.buildRelations() 38 if history: 39 evtmgr.defaultOrderby="%s desc" % evtmgr.lastTimeField 40 evtmgr.timeout = 300 41 evtmgr.statusTable = "history" 42 evtmgr.installIntoPortal() 43 if REQUEST: 44 REQUEST['RESPONSE'].redirect(context.absolute_url()+'/manage_main')
45 46
47 -class MySqlEventManager(MySqlSendEventMixin, EventManagerBase):
48 49 portal_type = meta_type = 'MySqlEventManager' 50 51 backend = "mysql" 52 53 security = ClassSecurityInfo()
54 55 InitializeClass(MySqlEventManager) 56