Search in sources :

Example 1 with MonitorClient

use of co.cask.cdap.client.MonitorClient in project cdap by caskdata.

the class GenerateClientUsageExample method monitorClient.

public void monitorClient() throws Exception {
    // Construct the client used to interact with CDAP
    MonitorClient monitorClient = new MonitorClient(clientConfig);
    // Fetch the list of system services
    List<SystemServiceMeta> services = monitorClient.listSystemServices();
    // Fetch status of system transaction service
    String serviceStatus = monitorClient.getSystemServiceStatus("transaction");
    // Fetch the number of instances of the system transaction service
    int systemServiceInstances = monitorClient.getSystemServiceInstances("transaction");
    // Set the number of instances of the system transaction service
    monitorClient.setSystemServiceInstances("transaction", 1);
}
Also used : MonitorClient(co.cask.cdap.client.MonitorClient) SystemServiceMeta(co.cask.cdap.proto.SystemServiceMeta)

Aggregations

MonitorClient (co.cask.cdap.client.MonitorClient)1 SystemServiceMeta (co.cask.cdap.proto.SystemServiceMeta)1