diff --git a/docs/clmc-service.md b/docs/clmc-service.md index bc5d6723d7c32077334b07865661e8f7f80357cb..6d60e7c5878748c26589ed6db8a62e43af299d28 100644 --- a/docs/clmc-service.md +++ b/docs/clmc-service.md @@ -179,6 +179,56 @@ with **/clmc-service** so that the nginx reverse proxy server (listening on port } ``` +* **DELETE** ***/alerts*** + + This API method can be used to send an alert specification document, which is then used by the CLMC service to delete + alert tasks and deregister alert handlers in Kapacitor. Essentially, it is a clean-up endpoint for the alerts API. + For further information on the alert specification document, please check the [CLMC Alert Specification Documentation](AlertsSpecification.md). + + * Request: + + Expects a YAML-formatted file in the request referenced with ID ***alert-spec*** representing the TOSCA alert specification + document. The alert specification document is then parsed with the openstack TOSCA parser (https://github.com/openstack/tosca-parser/tree/master/toscaparser) + and validated against the CLMC alerts specification schema (again check [documentation](AlertsSpecification.md) for more info on this). + + * Example for sending a request with curl: + + `curl -X DELETE -F "alert-spec=@alert-specification.yaml" http://localhost:9080/alerts` + + where **alert-specification.yaml** is the path to the alerts specification file. + + * Response: + + The response of this request is a JSON-formatted content, which contains two lists - one for the alerts that were found in the TOSCA specification + and then deleted from Kapacitor, and one for the respective alert handlers that were deleted from Kapacitor. + + Returns a 400 Bad Request if the request does not contain a yaml file referenced with ID **alert-spec**. + + Returns a 400 Bad Request if the alert specification file is not a valid YAML file. + + Returns a 400 Bad Request if the alert specification file cannot be parsed with the TOSCA parser. + + Returns a 400 Bad Request if the alert specification file fails validation against the CLMC alerts specification schema. + + * Response Body Example: + + ```json + { + "deleted_alerts": [{"policy": "scale_nginx_policy", "trigger": "high_requests"}, + {"policy": "scale_nginx_policy", "trigger": "increase_in_active_requests"}, + {"policy": "scale_nginx_policy", "trigger": "increase_in_running_processes"}, + {"policy": "deadman_policy", "trigger": "no_measurements"}], + "deleted_handlers": [{"policy": "scale_nginx_policy", "trigger": "increase_in_active_requests", "handler": "flame_sfemc"}, + {"policy": "scale_nginx_policy", "trigger": "increase_in_running_processes", "handler": "flame_sfemc"}, + {"policy": "deadman_policy", "trigger": "no_measurements", "handler": "flame_sfemc"}, + {"policy": "scale_nginx_policy", "trigger": "high_requests", "handler": "http://172.40.231.200:9999/"}, + {"policy": "scale_nginx_policy", "trigger": "increase_in_active_requests", "handler": "http://172.40.231.200:9999/"}, + {"policy": "scale_nginx_policy", "trigger": "increase_in_running_processes", "handler": "http://172.40.231.200:9999/"}, + {"policy": "deadman_policy", "trigger": "no_measurements", "handler": "http://172.40.231.200:9999/"}] + } + ``` + + ## Graph API Endpoints * **Assumptions**