use of backtype.storm.utils.NimbusClient in project jstorm by alibaba.
the class ClusterAPIController method workers.
@RequestMapping("/supervisor/{host:.+}")
public Map workers(@PathVariable String clusterName, @PathVariable String host, @RequestParam(value = "window", required = false) String window) {
Map<String, Object> ret = new HashMap<>();
int win = UIUtils.parseWindow(window);
NimbusClient client = null;
try {
client = NimbusClientManager.getNimbusClient(clusterName);
SupervisorWorkers supervisorWorkers = client.getClient().getSupervisorWorkers(host);
ret.put("supervisor", new SupervisorEntity(supervisorWorkers.get_supervisor()));
// get worker summary
List<WorkerSummary> workerSummaries = supervisorWorkers.get_workers();
ret.put("workers", UIUtils.getWorkerEntities(workerSummaries));
Map<String, MetricInfo> workerMetricInfo = supervisorWorkers.get_workerMetric();
List<UIWorkerMetric> workerMetrics = UIMetricUtils.getWorkerMetrics(workerMetricInfo, workerSummaries, host, win);
ret.put("workerMetrics", workerMetrics);
} catch (Exception e) {
NimbusClientManager.removeClient(clusterName);
ret = UIUtils.exceptionJson(e);
LOG.error(e.getMessage(), e);
}
return ret;
}
use of backtype.storm.utils.NimbusClient in project jstorm by alibaba.
the class ClusterAPIController method nimbus.
@RequestMapping("/nimbus/summary")
public Map nimbus(@PathVariable String clusterName) {
Map ret;
NimbusClient client = null;
try {
client = NimbusClientManager.getNimbusClient(clusterName);
ClusterSummary clusterSummary = client.getClient().getClusterInfo();
ret = new HashMap<>();
ret.put("nimbus", UIUtils.getNimbusEntities(clusterSummary));
} catch (Exception e) {
NimbusClientManager.removeClient(clusterName);
ret = UIUtils.exceptionJson(e);
LOG.error(e.getMessage(), e);
}
return ret;
}
Aggregations