Ejemplo n.º 1
0
    def __init__(self, agent_config, emitter, checksd=None):
        super(Collector, self).__init__(agent_config)
        self.agent_config = agent_config
        self.os = util.get_os()
        self.plugins = None
        self.emitter = emitter
        socket.setdefaulttimeout(15)
        self.run_count = 0
        self.continue_running = True
        self.initialized_checks_d = []
        self.init_failed_checks_d = []

        # add windows system checks
        if self.os == 'windows':
            self._checks = [w32.Disk(log),
                            w32.IO(log),
                            w32.Processes(log),
                            w32.Memory(log),
                            w32.Network(log),
                            w32.Cpu(log)]
        else:
            self._checks = []

        if checksd:
            # is of type {check_name: check}
            self.initialized_checks_d = checksd['initialized_checks']
            # is of type {check_name: {error, traceback}}
            self.init_failed_checks_d = checksd['init_failed_checks']
Ejemplo n.º 2
0
    def __init__(self, agent_config, emitter, checksd=None):
        self.emit_duration = None
        self.agent_config = agent_config
        self.os = monagent.common.util.get_os()
        self.plugins = None
        self.emitter = emitter
        socket.setdefaulttimeout(15)
        self.run_count = 0
        self.continue_running = True
        self.initialized_checks_d = []
        self.init_failed_checks_d = []

        self._checks = []
        self._legacy_checks = [
            # todo dogstreams should be removed or moved over to a standard output type
            # Dogstreams.init(log, self.agent_config)  # dogstreams
        ]

        # add system checks
        # todo all these (legacy and system) should be moved to the newer
        # AgentCheck class rather than check
        if self.os == 'windows':
            legacy_checks = [
                w32.Disk(log),
                w32.IO(log),
                w32.Processes(log),
                w32.Memory(log),
                w32.Network(log),
                w32.Cpu(log)
            ]
            system_checks = []
        else:
            system_checks = [u.Disk(log, agent_config), u.IO(log)]
            legacy_checks = [
                u.Load(log, agent_config),
                u.Memory(log),
                u.Cpu(log, agent_config)
            ]
        self._checks.extend(system_checks)
        self._legacy_checks.extend(legacy_checks)

        if checksd:
            # is of type {check_name: check}
            self.initialized_checks_d = checksd['initialized_checks']
            # is of type {check_name: {error, traceback}}
            self.init_failed_checks_d = checksd['init_failed_checks']