Search in sources :

Example 11 with Cluster

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;
}
Also used : PrometheusAlert(com.sequenceiq.periscope.domain.PrometheusAlert) Cluster(com.sequenceiq.periscope.domain.Cluster)

Example 12 with Cluster

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);
}
Also used : Cluster(com.sequenceiq.periscope.domain.Cluster)

Example 13 with 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);
}
Also used : Cluster(com.sequenceiq.periscope.domain.Cluster)

Example 14 with 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);
}
Also used : Cluster(com.sequenceiq.periscope.domain.Cluster)

Example 15 with 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);
    }
}
Also used : AmbariStack(com.sequenceiq.periscope.model.AmbariStack) PeriscopeUser(com.sequenceiq.periscope.domain.PeriscopeUser) Cluster(com.sequenceiq.periscope.domain.Cluster) History(com.sequenceiq.periscope.domain.History)

Aggregations

Cluster (com.sequenceiq.periscope.domain.Cluster)34 Map (java.util.Map)6 PrometheusAlert (com.sequenceiq.periscope.domain.PrometheusAlert)5 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)4 CloudbreakClient (com.sequenceiq.cloudbreak.client.CloudbreakClient)4 MetricAlert (com.sequenceiq.periscope.domain.MetricAlert)4 PeriscopeUser (com.sequenceiq.periscope.domain.PeriscopeUser)4 UpdateFailedEvent (com.sequenceiq.periscope.monitor.event.UpdateFailedEvent)4 TimeAlert (com.sequenceiq.periscope.domain.TimeAlert)3 ScalingEvent (com.sequenceiq.periscope.monitor.event.ScalingEvent)3 Collections (java.util.Collections)3 List (java.util.List)3 Set (java.util.Set)3 Inject (javax.inject.Inject)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 Component (org.springframework.stereotype.Component)3 AutoscaleStackResponse (com.sequenceiq.cloudbreak.api.model.AutoscaleStackResponse)2 FailureReport (com.sequenceiq.cloudbreak.api.model.FailureReport)2 StackResponse (com.sequenceiq.cloudbreak.api.model.StackResponse)2