use of com.sequenceiq.periscope.api.endpoint.v1.AlertEndpoint in project cloudbreak by hortonworks.
the class AutoscalingUtil method deletePrometheusAlert.
static void deletePrometheusAlert(AutoscaleClient autoscaleClient, Long clusterId, Long alertId) {
AlertEndpoint alertEndpoint = autoscaleClient.alertEndpoint();
alertEndpoint.deletePrometheusAlarm(clusterId, alertId);
}
use of com.sequenceiq.periscope.api.endpoint.v1.AlertEndpoint in project cloudbreak by hortonworks.
the class AutoscalingUtil method getAlertId.
static Long getAlertId(AutoscaleClient autoscaleClient, Long clusterId, String alertName) {
Long alertId = null;
AlertEndpoint alertEndpoint = autoscaleClient.alertEndpoint();
List<PrometheusAlertResponse> prometheusAlertResponses = alertEndpoint.getPrometheusAlerts(clusterId);
for (PrometheusAlertResponse entry : prometheusAlertResponses) {
if (entry.getAlertName().equals(alertName)) {
alertId = entry.getId();
}
}
Assert.assertNotNull(alertId);
return alertId;
}
use of com.sequenceiq.periscope.api.endpoint.v1.AlertEndpoint in project cloudbreak by hortonworks.
the class AutoscalingUtil method createPrometheusAlert.
static void createPrometheusAlert(AutoscaleClient autoscaleClient, Long clusterId, String alertName, String alertOperator, String alertRuleName, int period, Double threshold) {
PrometheusAlertRequest prometheusAlertRequest = new PrometheusAlertRequest();
prometheusAlertRequest.setAlertName(alertName);
if ("more".equals(alertOperator)) {
prometheusAlertRequest.setAlertOperator(AlertOperator.MORE_THAN);
} else {
prometheusAlertRequest.setAlertOperator(AlertOperator.LESS_THAN);
}
prometheusAlertRequest.setAlertRuleName(alertRuleName);
prometheusAlertRequest.setAlertState(AlertState.OK);
prometheusAlertRequest.setPeriod(period);
prometheusAlertRequest.setThreshold(threshold);
AlertEndpoint alertEndpoint = autoscaleClient.alertEndpoint();
alertEndpoint.createPrometheusAlert(clusterId, prometheusAlertRequest);
}
Aggregations