def __init__(self, as_child=False, *args, **kw): if as_child: signal.signal(signal.SIGTERM, self.terminate) for _class in handlers.list_classes(): __class = _class() __class.register(callback=self.register_handler) self.handler_modules[_class] = __class for _class in inputs.list_classes(): __class = _class() __class.register(callback=self.register_input) self.input_modules[_class] = __class output_modules = [x.strip() for x in conf.get('worker', 'output_modules', '').split(',')] for _class in outputs.list_classes(): _output = _class() if _output.name() in output_modules: _output.register(callback=self.register_output) self.output_modules[_class] = _output storage_modules = [x.strip() for x in conf.get('worker', 'storage_modules', '').split(',')] for _class in storage.list_classes(): _storage = _class() if _storage.name() in storage_modules: _storage.register(callback=self.register_storage) self.storage_modules[_class] = _storage self.storage = _storage output_exclude_events = conf.get('worker', 'output_exclude_events', '') self.output_exclude_events = [x.strip() for x in output_exclude_events.split(',')]
def run(self): for _class in inputs.list_classes(): module = _class() module.register(callback=self.register_input) self.input_modules[_class] = module for _class in handlers.list_classes(): handler = _class() handler.register(callback=self.register_handler) input_modules = conf.get('collector', 'input_modules') if input_modules == None: input_modules = "" input_modules = [x.strip() for x in input_modules.split(',')] for _input in self.input_modules.values(): if _input.name() in input_modules: _input.run(callback=self.execute, interests=self.handler_interests.keys())