use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class AlertService method deletePrometheusAlert.
public void deletePrometheusAlert(Long clusterId, Long alertId) {
PrometheusAlert alert = prometheusAlertRepository.findByCluster(alertId, clusterId);
Cluster cluster = clusterRepository.findById(clusterId);
consulKeyValueService.deleteAlert(cluster, alert);
Set<PrometheusAlert> alerts = cluster.getPrometheusAlerts().stream().filter(a -> a.getId() != alertId).collect(Collectors.toSet());
cluster.setPrometheusAlerts(alerts);
prometheusAlertRepository.delete(alertId);
clusterRepository.save(cluster);
LOGGER.info("Prometheus alert '{}' has been deleted for cluster 'ID:{}'", alert.getName(), cluster.getId());
}
use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class AlertService method deleteMetricAlert.
public void deleteMetricAlert(Long clusterId, Long alertId) {
metricAlertRepository.findByCluster(alertId, clusterId);
Cluster cluster = clusterRepository.findById(clusterId);
cluster.setMetricAlerts(removeMetricAlert(cluster, alertId));
metricAlertRepository.delete(alertId);
clusterRepository.save(cluster);
}
use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class AlertService method createTimeAlert.
public TimeAlert createTimeAlert(Long clusterId, TimeAlert alert) {
Cluster cluster = clusterService.findOneById(clusterId);
alert.setCluster(cluster);
alert = (TimeAlert) save(alert);
cluster.addTimeAlert(alert);
clusterRepository.save(cluster);
return alert;
}
use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class ClusterService method updateScalingConfiguration.
public Cluster updateScalingConfiguration(Long clusterId, ScalingConfigurationRequest scalingConfiguration) {
Cluster cluster = findOneById(clusterId);
cluster.setMinSize(scalingConfiguration.getMinSize());
cluster.setMaxSize(scalingConfiguration.getMaxSize());
cluster.setCoolDown(scalingConfiguration.getCoolDown());
return save(cluster);
}
use of com.sequenceiq.periscope.domain.Cluster in project cloudbreak by hortonworks.
the class ClusterService method getScalingConfiguration.
public ScalingConfigurationRequest getScalingConfiguration(Long clusterId) {
Cluster cluster = findOneById(clusterId);
ScalingConfigurationRequest configuration = new ScalingConfigurationRequest();
configuration.setCoolDown(cluster.getCoolDown());
configuration.setMaxSize(cluster.getMaxSize());
configuration.setMinSize(cluster.getMinSize());
return configuration;
}
Aggregations