How to get information about cluster's node status?

I want to get information about node status using Java API. But I only found method getAvailableServers() in CouchbaseClient class. It's not quite what I need because this method considers the node available if its condition is not down (red status). But I can't work in normal mode with Couchbase client, even if the status of the node is unhealthy (yellow status). Is there a method that provides detailed information about node's status, something like this comand of curl curl -u admin:password 10.4.2.4:8091/pools/nodes

1 Answer

« Back to question.

This seems to be enough for our purposes:

CouchbaseConnectionFactoryBuilder builder = new CouchbaseConnectionFactoryBuilder();

List<ConnectionObserver> observers = (List<ConnectionObserver>)builder.getInitialObservers();
 
observers.add(new ConnectionObserver() {
    void connectionEstablished(SocketAddress sa, int reconnectCount) {
        //do the white magic
    }
    void connectionLost(SocketAddress sa) {
        //do the black magic
    }
});

PS: Big brother is watching you :)