Package Products :: Package ZenHub :: Package services :: Module SyslogConfig |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenHub.services.SyslogConfig

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2011 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  __doc__ = '''SyslogConfig
    15
    16  Provides configuration for syslog message to Zenoss event conversions.
    17  '''
    18
    19  import logging
    20  log = logging.getLogger('zen.HubService.SyslogConfig')
    21
    22  import Globals
    23
    24  from Products.ZenCollector.services.config import CollectorConfigService
    25  from Products.ZenHub.zodb import onUpdate, onDelete
    26
    27
    28 -class FakeDevice(object):
    29      id = 'Syslog payload'
    30
    31
    32 -class SyslogConfig(CollectorConfigService):
    33 -    def _filterDevices(self, deviceList):
    34          return [ FakeDevice() ]
    35
    36 -    def _createDeviceProxy(self, device):
    37          proxy = CollectorConfigService._createDeviceProxy(self, device)
    38          proxy.configCycleInterval = 3600
    39          proxy.name = "Syslog Configuration"
    40          proxy.device = device.id
    41
    42          proxy.defaultPriority = self.zem.defaultPriority
    43          return proxy
    44
    45
    46  if __name__ == '__main__':
    47      from Products.ZenHub.ServiceTester import ServiceTester
    48      tester = ServiceTester(SyslogConfig)
    49 -    def printer(config):
    50          print "Default syslog priority = ", config.defaultPriority
    51      tester.printDeviceProxy = printer
    52      tester.showDeviceInfo()
    53