Вот очень простой пример использования Java-клиента Cloudera Manager (https://cloudera.github.io/cm_api/docs/java-client-swagger/)
package cloudera.kudu_example;
import java.io.IOException;
import com.cloudera.api.swagger.HostsResourceApi;
import com.cloudera.api.swagger.ServicesResourceApi;
import com.cloudera.api.swagger.client.ApiClient;
import com.cloudera.api.swagger.client.ApiException;
import com.cloudera.api.swagger.client.Configuration;
import com.cloudera.api.swagger.model.ApiHost;
import com.cloudera.api.swagger.model.ApiRole;
import com.cloudera.api.swagger.model.ApiRoleList;
public class App {
public static void main( String[] args ) throws IOException {
ApiClient cmClient = Configuration.getDefaultApiClient();
cmClient.setBasePath(args[0]);
cmClient.setUsername(args[1]);
cmClient.setPassword(args[2]);
cmClient.setVerifyingSsl(false);
HostsResourceApi hostsApiInstance = new HostsResourceApi();
ServicesResourceApi servicesApiInstance = new ServicesResourceApi();
try {
ApiRoleList apiRoles = servicesApiInstance.readRoles("Cluster 1", "KUDU-1");
for(ApiRole role : apiRoles.getItems()) {
if(role.getType().equalsIgnoreCase("KUDU_MASTER")) {
ApiHost host = hostsApiInstance.readHost(role.getHostRef().getHostId(), "full");
System.out.printf("Kudu master runs at %s. IP: %s, status %s", host.getHostname(), host.getIpAddress(), host.getEntityStatus());
}
}
} catch (ApiException e) {
System.err.println("Exception when calling ClustersResourceApi#readClusters");
e.printStackTrace();
}
}
}