Search in sources :

Example 1 with AlertManagerServerException

use of io.hops.hopsworks.alerting.exceptions.AlertManagerServerException in project hopsworks by logicalclocks.

the class AlertManagerClient method sendRequest.

private Response sendRequest(Invocation.Builder invocationBuilder, RequestMethod method, Entity<String> entity) throws AlertManagerServerException, AlertManagerResponseException {
    Response response = null;
    try {
        switch(method) {
            case GET:
                response = invocationBuilder.get();
                break;
            case POST:
                response = invocationBuilder.post(entity);
                break;
            case DELETE:
                response = invocationBuilder.delete();
                break;
        }
    } catch (Exception e) {
        throw new AlertManagerServerException(e.getMessage());
    }
    checkResponse(response);
    return response;
}
Also used : Response(javax.ws.rs.core.Response) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException) AlertManagerResponseException(io.hops.hopsworks.alerting.exceptions.AlertManagerResponseException) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) ServiceDiscoveryException(com.logicalclocks.servicediscoverclient.exceptions.ServiceDiscoveryException)

Example 2 with AlertManagerServerException

use of io.hops.hopsworks.alerting.exceptions.AlertManagerServerException in project hopsworks by logicalclocks.

the class AlertManager method healthy.

public Response healthy() throws AlertManagerClientCreateException, AlertManagerResponseException, AlertManagerUnreachableException {
    doClientSanityCheck();
    try {
        Response response = client.healthy();
        registerSuccess();
        return response;
    } catch (AlertManagerServerException e) {
        registerServerError();
        throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
    }
}
Also used : Response(javax.ws.rs.core.Response) AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException)

Example 3 with AlertManagerServerException

use of io.hops.hopsworks.alerting.exceptions.AlertManagerServerException in project hopsworks by logicalclocks.

the class AlertManager method getAlerts.

public List<Alert> getAlerts() throws AlertManagerResponseException, AlertManagerClientCreateException, AlertManagerUnreachableException {
    doClientSanityCheck();
    try {
        List<Alert> response = client.getAlerts();
        registerSuccess();
        return response;
    } catch (AlertManagerServerException e) {
        registerServerError();
        throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
    }
}
Also used : AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) Alert(io.hops.hopsworks.alerting.api.alert.dto.Alert) PostableAlert(io.hops.hopsworks.alerting.api.alert.dto.PostableAlert) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException)

Example 4 with AlertManagerServerException

use of io.hops.hopsworks.alerting.exceptions.AlertManagerServerException in project hopsworks by logicalclocks.

the class AlertManager method postSilences.

/**
 * Post a new silence or update an existing one
 * @param postableSilence
 * @return
 * @throws AlertManagerResponseException
 * @throws AlertManagerClientCreateException
 * @throws AlertManagerUnreachableException
 */
public SilenceID postSilences(PostableSilence postableSilence) throws AlertManagerResponseException, AlertManagerClientCreateException, AlertManagerUnreachableException {
    doClientSanityCheck();
    try {
        SilenceID response = client.postSilences(postableSilence);
        registerSuccess();
        return response;
    } catch (AlertManagerServerException e) {
        registerServerError();
        throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
    }
}
Also used : AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException) SilenceID(io.hops.hopsworks.alerting.api.alert.dto.SilenceID)

Example 5 with AlertManagerServerException

use of io.hops.hopsworks.alerting.exceptions.AlertManagerServerException in project hopsworks by logicalclocks.

the class AlertManager method getAlertGroups.

public List<AlertGroup> getAlertGroups(Boolean active, Boolean silenced, Boolean inhibited, Set<String> filters, String receiver) throws AlertManagerResponseException, AlertManagerClientCreateException, AlertManagerUnreachableException {
    doClientSanityCheck();
    try {
        List<AlertGroup> response = client.getAlertGroups(active, silenced, inhibited, filters, receiver);
        registerSuccess();
        return response;
    } catch (AlertManagerServerException e) {
        registerServerError();
        throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
    }
}
Also used : AlertGroup(io.hops.hopsworks.alerting.api.alert.dto.AlertGroup) AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException)

Aggregations

AlertManagerServerException (io.hops.hopsworks.alerting.exceptions.AlertManagerServerException)17 AlertManagerUnreachableException (io.hops.hopsworks.alert.exception.AlertManagerUnreachableException)13 Response (javax.ws.rs.core.Response)6 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 AlertManagerConfigUpdateException (io.hops.hopsworks.alerting.exceptions.AlertManagerConfigUpdateException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Alert (io.hops.hopsworks.alerting.api.alert.dto.Alert)2 PostableAlert (io.hops.hopsworks.alerting.api.alert.dto.PostableAlert)2 PostableSilence (io.hops.hopsworks.alerting.api.alert.dto.PostableSilence)2 Silence (io.hops.hopsworks.alerting.api.alert.dto.Silence)2 AlertManagerResponseException (io.hops.hopsworks.alerting.exceptions.AlertManagerResponseException)2 JSONObject (org.json.JSONObject)2 ServiceDiscoveryException (com.logicalclocks.servicediscoverclient.exceptions.ServiceDiscoveryException)1 AlertGroup (io.hops.hopsworks.alerting.api.alert.dto.AlertGroup)1 AlertmanagerStatus (io.hops.hopsworks.alerting.api.alert.dto.AlertmanagerStatus)1 ReceiverName (io.hops.hopsworks.alerting.api.alert.dto.ReceiverName)1 SilenceID (io.hops.hopsworks.alerting.api.alert.dto.SilenceID)1 AlertManagerConfig (io.hops.hopsworks.alerting.config.dto.AlertManagerConfig)1 IOException (java.io.IOException)1