示例#1
0
    def _get_cluster_info(self):
        rest_query = self._es_host.rest_query(
            "/_cluster/health"
        )

        if rest_query.success:
            data = rest_query.data
            self._name = data.get("cluster_name")
            self._status = data.get("status")
            self._nodes = data.get("number_of_nodes")
            self._data_nodes = data.get("number_of_data_nodes")
            self._active_primary_shards = data.get("active_primary_shards")
            self._active_shards = data.get("active_shards")
            self._relocating_shards = data.get("relocating_shards")
            self._initializing_shards = data.get("initializing_shards")
            self._unassigned_shards = data.get("unassigned_shards")
            self._delayed_unassigned_shards = data.get(
                "delayed_unassigned_shards")
            self._pending_tasks = data.get("number_of_pending_tasks")
            self._in_flight_fetch = data.get("number_of_in_flight_fetch")
        else:
            raise(ElasticSearchException(rest_query))

        self._get_node_names()