Esempio n. 1
0
 def __init__(self, script, plugin_config):
     """
         Init function
         Args:
             script - Health check script
         Return:
             None
         Raise:
             None
     """
     HealthCheck.__init__(self, script, plugin_config)
 def __init__(self, script, plugin_config):
     """
         Init function
         Args:
             script - Health check script
         Return:
             None
         Raise:
             None
     """
     HealthCheck.__init__(self, script, plugin_config)
Esempio n. 3
0
    def __init__(self, shell_script, plugin_config):
        """
            Init function for the KafkaHealthCheck class
            Args:
                shell_script - script that is used to check the health
                of the cluster
            Return:
                None
            Raise:
                None
        """
        HealthCheck.__init__(self, shell_script, plugin_config)
        self.config_file = plugin_config['topology_config']
        with open(self.config_file, 'r') as file_desc:
            doc = yaml.load(file_desc)

        # Declare the config variables
        self.zookeeper = None
        self.zookeeper_paths = None
        self.kafka_host_resolution = None

        for key, val in doc.iteritems():
            setattr(self, key, val)

        if self.zookeeper:
            zook = KazooClient(hosts=self.zookeeper.get("host"),
                               read_only=True)
            zook.start()

            # read ZK Paths into a dictionary
            zk_paths = {}
            if self.zookeeper_paths:
                for path_type, path in self.zookeeper_paths.items():
                    zk_paths[path_type] = path
                    # create zk_helper object
            helper = KafkaZkHelper(zook, zk_paths)
            self.helper = helper