本文整理汇总了Python中Products.ZenCollector.daemon.CollectorDaemon.run方法的典型用法代码示例。如果您正苦于以下问题:Python CollectorDaemon.run方法的具体用法?Python CollectorDaemon.run怎么用?Python CollectorDaemon.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.ZenCollector.daemon.CollectorDaemon
的用法示例。
在下文中一共展示了CollectorDaemon.run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from Products.ZenCollector.daemon import CollectorDaemon [as 别名]
# 或者: from Products.ZenCollector.daemon.CollectorDaemon import run [as 别名]
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()
示例2: run
# 需要导入模块: from Products.ZenCollector.daemon import CollectorDaemon [as 别名]
# 或者: from Products.ZenCollector.daemon.CollectorDaemon import run [as 别名]
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()
示例3: displayStatistics
# 需要导入模块: from Products.ZenCollector.daemon import CollectorDaemon [as 别名]
# 或者: from Products.ZenCollector.daemon.CollectorDaemon import run [as 别名]
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()
示例4: main
# 需要导入模块: from Products.ZenCollector.daemon import CollectorDaemon [as 别名]
# 或者: from Products.ZenCollector.daemon.CollectorDaemon import run [as 别名]
def main():
preferences = Preferences()
task_factory = SimpleTaskFactory(PythonCollectionTask)
task_splitter = PerDataSourceInstanceTaskSplitter(task_factory)
daemon = CollectorDaemon(preferences, task_splitter)
daemon.run()