Package Products :: Package ZenStatus :: Module PingCollectionPreferences
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenStatus.PingCollectionPreferences

 1  ############################################################################## 
 2  #  
 3  # Copyright (C) Zenoss, Inc. 2011, 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.zenping.pingcollectionprefs") 
13   
14  import Globals 
15  import zope.interface 
16  import zope.component 
17   
18  from Products.ZenCollector import daemon  
19  from Products.ZenCollector import interfaces  
20  from Products.ZenCollector import tasks  
21  from Products.ZenUtils import IpUtil 
22  import Products.ZenStatus.interfaces 
23   
24  # perform some imports to allow twisted's PB to serialize these objects 
25  from Products.ZenUtils.Utils import unused 
26  from Products.ZenCollector.services.config import DeviceProxy 
27  from Products.ZenHub.services.PingPerformanceConfig import PingPerformanceConfig 
28  unused(DeviceProxy) 
29  unused(PingPerformanceConfig) 
30   
31  # define some constants strings 
32  COLLECTOR_NAME = "zenping" 
33  CONFIG_SERVICE = 'Products.ZenHub.services.PingPerformanceConfig' 
34   
35   
36 -class PingCollectionPreferences(object):
37 zope.interface.implements(interfaces.ICollectorPreferences) 38
39 - def __init__(self):
40 """ 41 Constructs a new PingCollectionPreferences instance and 42 provides default values for needed attributes. 43 """ 44 self.collectorName = COLLECTOR_NAME 45 self.defaultRRDCreateCommand = None 46 self.configCycleInterval = 20 # minutes 47 self.cycleInterval = 60 * 5 # seconds 48 49 # do not pause our tasks, when devices are determined down 50 self.pauseUnreachableDevices = False 51 52 # The configurationService attribute is the fully qualified class-name 53 # of our configuration service that runs within ZenHub 54 self.configurationService = CONFIG_SERVICE 55 56 # Will be filled in based on buildOptions 57 self.options = None 58 59 self.pingTimeOut = 1.5 60 self.pingTries = 2 61 self.pingChunk = 75 62 self.pingCycleInterval = 60
63
64 - def buildOptions(self, parser):
65 parser.add_option('--disable-correlator', 66 dest='correlator', 67 default=True, 68 action="store_false", 69 help="Disable the correlator.") 70 71 parser.add_option('--traceroute-interval', 72 dest='tracerouteInterval', 73 default=5, 74 type='int', 75 help="Traceroute every N ping intervals; default is 5, traceroute every time" \ 76 " a ping is performed.") 77 78 # look up possible ping backends 79 pingBackends = [] 80 for pingBackend, _ in zope.component.getUtilitiesFor( 81 Products.ZenStatus.interfaces.IPingTaskFactory): 82 pingBackends.append(pingBackend) 83 backendsHelp = "ping backend to use (%s)" % ", ".join(pingBackends) 84 parser.add_option('--ping-backend', 85 dest='pingBackend', 86 default='nmap', 87 help=backendsHelp + " default: %default")
88
89 - def postStartup(self):
90 pass
91
92 - def preShutdown(self):
93 pass
94