Deleting an alarm from EPL

from EPL I would like to delete an alarm when a condition happens, based on a quick search it is not easy to delete an alarm just like how it is easy to create it and it seems that some HTTP request is needed from the EPL code:

// Delete the alarm using HTTPRequest
            HTTPRequest deleteReq := new HTTPRequest;
            deleteReq.method := "DELETE";
            deleteReq.resource := "/alarm/alarms/" + alarm.id;
            deleteReq.headers := {"Accept": "application/json"};
            send deleteReq;

what do I need in the “using com.apama.cumulocity” statement to be able to use “HTTPRequest”? It seems to be complex and some that some YAML microservice is needed which we currently don’t have in our microservices: “Make sure your microservice YAML configuration includes the HTTP client connectivity plug-in and defines the appropriate chain (usually named GenericHTTPClient)”

conclusion: is there an easy way to delete an alarm from EPL that we still don’t know?

First, are you sure you want to delete the alarm and just clearing it is not sufficient?

If you really need to clear the alarm, have a look at the “Call another microservice” example and adopt it. You should also be able to use it to call the Cumulocity API:

As per the Cumulocity OpenAPI Docs, deleting a single alarm is not supported.

However I would re-iterate what @Harald_Meyer said. Ideally you should be just marking the alarm as “CLEARED” rather than deleting it.

2 Likes