def getParams(self, context):
        """Returns extra parameters needed for collecting this datasource."""
        if not self.plugin_classname:
            return {}

        from ZenPacks.zenoss.PythonCollector.services.PythonConfig \
            import load_plugin_class

        plugin_class = load_plugin_class(self.plugin_classname)
        return plugin_class.params(self, context)
    def getPluginClass(self):
        """Return plugin class referred to by self.plugin_classname."""
        plugin_class = getattr(aq_base(self), '_v_pluginClass', None)
        if not plugin_class:
            from ZenPacks.zenoss.PythonCollector.services.PythonConfig \
                import load_plugin_class

            self._v_pluginClass = load_plugin_class(self.plugin_classname)

        return self._v_pluginClass
    def getPluginClass(self):
        """Return plugin class referred to by self.plugin_classname."""
        plugin_class = getattr(aq_base(self), '_v_pluginClass', None)
        if not plugin_class:
            from ZenPacks.zenoss.PythonCollector.services.PythonConfig \
                import load_plugin_class

            self._v_pluginClass = load_plugin_class(self.plugin_classname)

        return self._v_pluginClass
    def getConfigKey(self, context):
        """Returns a tuple to be used to split configs at the collector."""
        if not self.plugin_classname:
            return [context.id]

        from ZenPacks.zenoss.PythonCollector.services.PythonConfig \
            import load_plugin_class

        plugin_class = load_plugin_class(self.plugin_classname)
        return plugin_class.config_key(self, context)
Ejemplo n.º 5
0
    def getParams(self, context):
        """Returns extra parameters needed for collecting this datasource."""
        if not self.plugin_classname:
            return {}

        from ZenPacks.zenoss.PythonCollector.services.PythonConfig \
            import load_plugin_class

        plugin_class = load_plugin_class(self.plugin_classname)
        return plugin_class.params(self, context)
Ejemplo n.º 6
0
    def getConfigKey(self, context):
        """Returns a tuple to be used to split configs at the collector."""
        if not self.plugin_classname:
            return [context.id]

        from ZenPacks.zenoss.PythonCollector.services.PythonConfig \
            import load_plugin_class

        plugin_class = load_plugin_class(self.plugin_classname)
        return plugin_class.config_key(self, context)
    def __init__(self, taskName, configId, scheduleIntervalSeconds, taskConfig):
        super(PythonCollectionTask, self).__init__(
            taskName, configId, scheduleIntervalSeconds, taskConfig)

        # Needed for interface.
        self.name = taskName
        self.configId = configId
        self.state = TaskStates.STATE_IDLE
        self.interval = scheduleIntervalSeconds
        self.config = taskConfig

        self._collector = zope.component.queryUtility(ICollector)
        self._dataService = zope.component.queryUtility(IDataService)
        self._eventService = zope.component.queryUtility(IEventService)
        self._preferences = zope.component.queryUtility(
            ICollectorPreferences, 'zenpython')

        self.cycling = self._preferences.options.cycle

        from ZenPacks.zenoss.PythonCollector.services.PythonConfig import load_plugin_class
        plugin_class = load_plugin_class(
            self.config.datasources[0].plugin_classname)

        # New in 1.3: Added passing of config to plugin constructor.
        if 'config' in inspect.getargspec(plugin_class.__init__).args:
            self.plugin = plugin_class(config=self.config)
        else:
            self.plugin = plugin_class()

        # Provide access to getService, without providing access
        # to other parts of self, or encouraging the use of
        # self._collector, which you totally did not see.   Nothing
        # to see here.  Move along.
        @inlineCallbacks
        def _getServiceFromCollector(service_name):
            service = yield self._collector.getService(service_name)
            returnValue(service)

        self.plugin.getService = _getServiceFromCollector

        # New in 1.6: Support writeMetricWithMetadata().
        self.writeMetricWithMetadata = hasattr(
            self._dataService, 'writeMetricWithMetadata')
Ejemplo n.º 8
0
    def __init__(self, taskName, configId, scheduleIntervalSeconds,
                 taskConfig):
        super(PythonCollectionTask,
              self).__init__(taskName, configId, scheduleIntervalSeconds,
                             taskConfig)

        # Needed for interface.
        self.name = taskName
        self.configId = configId
        self.state = TaskStates.STATE_IDLE
        self.interval = scheduleIntervalSeconds
        self.config = taskConfig

        self._collector = zope.component.queryUtility(ICollector)
        self._dataService = zope.component.queryUtility(IDataService)
        self._eventService = zope.component.queryUtility(IEventService)

        from ZenPacks.zenoss.PythonCollector.services.PythonConfig import load_plugin_class
        plugin_class = load_plugin_class(
            self.config.datasources[0].plugin_classname)

        self.plugin = plugin_class()
    def initializePlugin(self):
        """Return initialized PythonDataSourcePlugin for this task."""
        from ZenPacks.zenoss.PythonCollector.services.PythonConfig import load_plugin_class
        plugin_class = load_plugin_class(
            self.config.datasources[0].plugin_classname)

        # New in 1.3: Added passing of config to plugin constructor.
        if 'config' in inspect.getargspec(plugin_class.__init__).args:
            plugin = plugin_class(config=self.config)
        else:
            plugin = plugin_class()

        # Provide access to getService, without providing access
        # to other parts of self, or encouraging the use of
        # self._collector, which you totally did not see.   Nothing
        # to see here.  Move along.
        @inlineCallbacks
        def _getServiceFromCollector(service_name):
            service = yield self._collector.getService(service_name)
            returnValue(service)

        plugin.getService = _getServiceFromCollector

        return plugin
    def __init__(self, taskName, configId, scheduleIntervalSeconds, taskConfig):
        super(PythonCollectionTask, self).__init__(
            taskName, configId, scheduleIntervalSeconds, taskConfig)

        # Needed for interface.
        self.name = taskName
        self.configId = configId
        self.state = TaskStates.STATE_IDLE
        self.interval = scheduleIntervalSeconds
        self.config = taskConfig

        self._collector = zope.component.queryUtility(ICollector)
        self._dataService = zope.component.queryUtility(IDataService)
        self._eventService = zope.component.queryUtility(IEventService)

        from ZenPacks.zenoss.PythonCollector.services.PythonConfig import load_plugin_class
        plugin_class = load_plugin_class(
            self.config.datasources[0].plugin_classname)

        # New in 1.3: Added passing of config to plugin constructor.
        if 'config' in inspect.getargspec(plugin_class.__init__).args:
            self.plugin = plugin_class(config=self.config)
        else:
            self.plugin = plugin_class()
    def initializePlugin(self):
        """Return initialized PythonDataSourcePlugin for this task."""
        from ZenPacks.zenoss.PythonCollector.services.PythonConfig import load_plugin_class
        plugin_class = load_plugin_class(
            self.config.datasources[0].plugin_classname)

        # New in 1.3: Added passing of config to plugin constructor.
        if 'config' in inspect.getargspec(plugin_class.__init__).args:
            plugin = plugin_class(config=self.config)
        else:
            plugin = plugin_class()

        # Provide access to getService, without providing access
        # to other parts of self, or encouraging the use of
        # self._collector, which you totally did not see.   Nothing
        # to see here.  Move along.
        @inlineCallbacks
        def _getServiceFromCollector(service_name):
            service = yield self._collector.getService(service_name)
            returnValue(service)

        plugin.getService = _getServiceFromCollector

        return plugin