use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class AlertService method createPrometheusAlert.
public PrometheusAlert createPrometheusAlert(Long clusterId, PrometheusAlert alert) {
Cluster cluster = clusterService.findOneById(clusterId);
alert.setCluster(cluster);
PrometheusAlert savedAlert = (PrometheusAlert) save(alert);
cluster.addPrometheusAlert(savedAlert);
clusterRepository.save(cluster);
consulKeyValueService.addAlert(cluster, savedAlert);
LOGGER.info("Prometheus alert '{}' has been created for cluster 'ID:{}'", alert.getName(), cluster.getId());
return savedAlert;
}
use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class ClusterService method removeById.
public void removeById(Long clusterId) {
Cluster cluster = find(clusterId);
clusterRepository.delete(cluster);
}
use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class ClusterService method removeOne.
public void removeOne(Long clusterId) {
Cluster cluster = findOneById(clusterId);
clusterRepository.delete(cluster);
}
use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class ClusterService method setState.
public Cluster setState(Long clusterId, ClusterState state) {
Cluster cluster = findOneById(clusterId);
cluster.setState(state);
addPrometheusAlertsToConsul(cluster);
return clusterRepository.save(cluster);
}
use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class ClusterCreationEvaluator method createOrUpdateCluster.
private void createOrUpdateCluster(AutoscaleStackResponse stack, Optional<Cluster> clusterOptional) {
AmbariStack resolvedAmbari = createAmbariStack(stack);
Cluster cluster;
boolean sendNotification = false;
if (clusterOptional.isPresent()) {
cluster = clusterOptional.get();
MDCBuilder.buildMdcContext(cluster);
if (PENDING.equals(cluster.getState()) || SUSPENDED.equals(cluster.getState())) {
ambariHealthCheck(cluster.getUser(), resolvedAmbari);
LOGGER.info("Update cluster and set it's state to 'RUNNING' for Ambari host: {}", resolvedAmbari.getAmbari().getHost());
cluster = clusterService.update(cluster.getId(), resolvedAmbari, false, RUNNING, cluster.isAutoscalingEnabled());
sendNotification = true;
}
} else {
PeriscopeUser user = new PeriscopeUser(stack.getOwner(), null, stack.getAccount());
MDCBuilder.buildMdcContext(user, stack.getStackId(), null);
LOGGER.info("Creating cluster for Ambari host: {}", resolvedAmbari.getAmbari().getHost());
ambariHealthCheck(user, resolvedAmbari);
cluster = clusterService.create(user, resolvedAmbari, null);
sendNotification = true;
}
if (sendNotification) {
History history = historyService.createEntry(ScalingStatus.ENABLED, "Autoscaling has been enabled for the cluster.", 0, cluster);
notificationSender.send(history);
}
}
Aggregations