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

# Source Code for Module Products.ZenEvents.MySqlEventManager

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  import logging
    12  log = logging.getLogger("zen.Events")
    13
    14  from Globals import InitializeClass
    15  from Globals import DTMLFile
    16  from AccessControl import ClassSecurityInfo
    17
    18  from EventManagerBase import EventManagerBase
    19  from MySqlSendEvent import MySqlSendEventMixin
    20
    21 -def manage_addMySqlEventManager(context, id=None, evthost="localhost",
    22                                  evtuser="root", evtpass="", evtdb="events",
    23                                  evtport=3306,
    24                                  history=False, REQUEST=None):
    25      '''make an MySqlEventManager'''
    26      if not id:
    27          id = "ZenEventManager"
    28          if history: id = "ZenEventHistory"
    29      evtmgr = MySqlEventManager(id, hostname=evthost, username=evtuser,
    30                                 password=evtpass, database=evtdb,
    31                                 port=evtport)
    32      context._setObject(id, evtmgr)
    33      evtmgr = context._getOb(id)
    34      evtmgr.buildRelations()
    35      if history:
    36          evtmgr.defaultOrderby="%s desc" % evtmgr.lastTimeField
    37          evtmgr.timeout = 300
    38          evtmgr.statusTable = "history"
    39      evtmgr.installIntoPortal()
    40      if REQUEST:
    41          REQUEST['RESPONSE'].redirect(context.absolute_url()+'/manage_main')
    42
    43
    44 -class MySqlEventManager(MySqlSendEventMixin, EventManagerBase):
    45
    46      portal_type = meta_type = 'MySqlEventManager'
    47
    48      backend = "mysql"
    49
    50      security = ClassSecurityInfo()
    51
    52  InitializeClass(MySqlEventManager)
    53