本文整理汇总了Python中Products.ZenCollector.daemon.CollectorDaemon类的典型用法代码示例。如果您正苦于以下问题:Python CollectorDaemon类的具体用法?Python CollectorDaemon怎么用?Python CollectorDaemon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CollectorDaemon类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runPostConfigTasks
def runPostConfigTasks(self, result=None):
# 1) super sets self._prefs.task with the call to postStartupTasks
# 2) call remote createAllUsers
# 3) service in turn walks DeviceClass tree and returns users
CollectorDaemon.runPostConfigTasks(self, result)
if not isinstance(result, Failure) and self._prefs.task is not None:
service = self.getRemoteConfigServiceProxy()
log.debug('TrapDaemon.runPostConfigTasks callRemote createAllUsers')
d = service.callRemote("createAllUsers")
d.addCallback(self._createUsers)
示例2: main
def main():
preferences = Preferences()
task_factory = SimpleTaskFactory(PythonCollectionTask)
task_splitter = PerDataSourceInstanceTaskSplitter(task_factory)
daemon = CollectorDaemon(preferences, task_splitter)
pool_size = preferences.options.threadPoolSize
# The Twisted version shipped with Zenoss 4.1 doesn't have this.
if hasattr(reactor, 'suggestThreadPoolSize'):
reactor.suggestThreadPoolSize(pool_size)
daemon.run()
示例3: run
def run(self):
if "--worker" in sys.argv:
executor = zope.component.getUtility(IWorkerExecutor)
executor.setWorkerClass(self.workerClass)
executor.run()
else:
myPreferences = self.prefsClass()
myTaskFactory = zope.component.getUtility(IWorkerTaskFactory)
myTaskFactory.setWorkerClass(self.workerClass)
myTaskSplitter = SimpleTaskSplitter(myTaskFactory)
daemon = CollectorDaemon(myPreferences, myTaskSplitter)
myTaskFactory.postInitialization()
self.log = daemon.log
daemon.run()
示例4: displayStatistics
self._snmpProxy = None
def displayStatistics(self):
"""
Called by the collector framework scheduler, and allows us to
see how each task is doing.
"""
display = "%s using SNMP %s\n" % (self.name, self._snmpConnInfo.zSnmpVer)
display += "%s Cycles Exceeded: %s; V3 Error Count: %s; Stopped Task Count: %s\n" % (
self.name, self._cycleExceededCount, self._snmpV3ErrorCount, self._stoppedTaskCount)
display += "%s OIDs configured: %d \n" % (
self.name, len(self._oids.keys()))
display += "%s Good OIDs: %d - %s\n" % (
self.name, len(self._good_oids), self._good_oids)
display += "%s Bad OIDs: %d - %s\n" % (
self.name, len(self._bad_oids), self._bad_oids)
if self._lastErrorMsg:
display += "%s\n" % self._lastErrorMsg
return display
if __name__ == '__main__':
myPreferences = SnmpPerformanceCollectionPreferences()
myTaskFactory = SimpleTaskFactory(SnmpPerformanceCollectionTask)
myTaskSplitter = SimpleTaskSplitter(myTaskFactory)
daemon = CollectorDaemon(myPreferences, myTaskSplitter)
daemon.run()
示例5: main
def main():
preferences = Preferences()
task_factory = SimpleTaskFactory(PythonCollectionTask)
task_splitter = PerDataSourceInstanceTaskSplitter(task_factory)
daemon = CollectorDaemon(preferences, task_splitter)
daemon.run()