Example #1
0
    def _get_auto_config(self, image_name):
        from jmxfetch import get_jmx_checks

        jmx_checknames = get_jmx_checks(auto_conf=True)

        ident = self._get_image_ident(image_name)
        templates = []
        if ident in self.auto_conf_images:
            check_names = self.auto_conf_images[ident]

            for check_name in check_names:
                # get the check class to verify it matches
                check = get_check_class(
                    self.agentConfig,
                    check_name) if check_name not in jmx_checknames else True
                if check is None:
                    log.info("Failed auto configuring check %s for %s." %
                             (check_name, image_name))
                    continue
                auto_conf = get_auto_conf(check_name)
                init_config, instances = auto_conf.get('init_config',
                                                       {}), auto_conf.get(
                                                           'instances', [])
                for instance in instances:
                    templates.append((check_name, init_config, instance or {}))

        return templates
    def _get_auto_config(self, image_name):
        if image_name in self.auto_conf_images:
            check_name = self.auto_conf_images[image_name]

            # get the check class to verify it matches
            check = get_check_class(self.agentConfig, check_name)
            if check is None:
                log.info("Could not find an auto configuration template for %s."
                         " Leaving it unconfigured." % image_name)
                return None

            auto_conf = get_auto_conf(self.agentConfig, check_name)
            init_config, instances = auto_conf.get('init_config', {}), auto_conf.get('instances', [])
            return (check_name, init_config, instances[0] or {})

        return None
    def _get_auto_config(self, image_name):
        ident = self._get_image_ident(image_name)
        if ident in self.auto_conf_images:
            check_name = self.auto_conf_images[ident]

            # get the check class to verify it matches
            check = get_check_class(self.agentConfig, check_name)
            if check is None:
                log.info("Could not find an auto configuration template for %s."
                         " Leaving it unconfigured." % image_name)
                return None

            auto_conf = get_auto_conf(self.agentConfig, check_name)
            init_config, instances = auto_conf.get('init_config', {}), auto_conf.get('instances', [])
            return (check_name, init_config, instances[0] or {})

        return None
    def _get_auto_config(self, image_name):
        from jmxfetch import JMX_CHECKS

        ident = self._get_image_ident(image_name)
        if ident in self.auto_conf_images:
            check_name = self.auto_conf_images[ident]

            # get the check class to verify it matches
            check = get_check_class(self.agentConfig, check_name) if check_name not in JMX_CHECKS else True
            if check is None:
                log.info("Could not find an auto configuration template for %s."
                         " Leaving it unconfigured." % image_name)
                return None

            auto_conf = get_auto_conf(self.agentConfig, check_name)
            init_config, instances = auto_conf.get('init_config', {}), auto_conf.get('instances', [])
            return (check_name, init_config, instances[0] or {})

        return None
    def _get_auto_config(self, image_name):
        from jmxfetch import get_jmx_checks

        jmx_checknames = get_jmx_checks(auto_conf=True)

        ident = self._get_image_ident(image_name)
        templates = []
        if ident in self.auto_conf_images:
            check_names = self.auto_conf_images[ident]

            for check_name in check_names:
                # get the check class to verify it matches
                check = get_check_class(self.agentConfig, check_name) if check_name not in jmx_checknames else True
                if check is None:
                    log.info("Failed auto configuring check %s for %s." % (check_name, image_name))
                    continue
                auto_conf = get_auto_conf(check_name)
                init_config, instances = auto_conf.get('init_config', {}), auto_conf.get('instances', [])
                templates.append((check_name, init_config, instances[0] or {}))

        return templates