From 69decfa8c873764724bd0df21ddd0094c41ad3ac Mon Sep 17 00:00:00 2001 From: Niv Oppenhaim Date: Wed, 3 Jan 2018 14:38:41 +0000 Subject: [PATCH] Webhook doc fix and move to implemented Change-Id: Ie6f0bfc3131ed0024aa75f96a1e8f8739e7e0e71 Depends-On: I0c808c5e44f9d6092d113bb277c8ab8cf0d69716 --- .../pike/approved/httppost-notifications.rst | 158 ---------------- specs/pike/approved/httppost-registration.rst | 178 ------------------ specs/queens/implemented/webhooks.rst | 146 ++++++++++++++ 3 files changed, 146 insertions(+), 336 deletions(-) delete mode 100644 specs/pike/approved/httppost-notifications.rst delete mode 100644 specs/pike/approved/httppost-registration.rst create mode 100644 specs/queens/implemented/webhooks.rst diff --git a/specs/pike/approved/httppost-notifications.rst b/specs/pike/approved/httppost-notifications.rst deleted file mode 100644 index 7aa3502..0000000 --- a/specs/pike/approved/httppost-notifications.rst +++ /dev/null @@ -1,158 +0,0 @@ -.. - This work is licensed under a Creative Commons Attribution 3.0 Unported - License. - - http://creativecommons.org/licenses/by/3.0/legalcode - -====================== -httppost Notifications -====================== - -launchpad blueprint: -https://blueprints.launchpad.net/vitrage/+spec/httppost-notifications - -The Evaluator performs root cause analysis on the Vitrage Graph and may -determine that an alarm should be created, deleted or otherwise updated. -Other components are notified of such changes by the Vitrage Notifier service. -Among others, Vitrage Notifier is responsible for sending http post -notifications on Vitrage deduced alarms. - -This blueprint describes the implementation of Vitrage Notifier for -http post notifications on Vitrage deduced alarms. - - -Problem description -=================== - -Vitrage should support registering for http post notifications, and sending them -on raised alarms, deactivated alarms, state changes, RCA or other to any -registered targets. -Furthermore any registered recipient should supply a regex to filter the alarms -sent to that recipient. - - -Proposed change -=============== - -Needed definitions in Vitrage config file:: - - [DEFAULT] - notifiers = httppost - -SSL Client certificate file for REST notifier. (string value) : - rest_notifier_certificate_file = - -SSL Client private key file for REST notifier. (string value) - rest_notifier_certificate_key = - -SSL CA_BUNDLE certificate for REST notifier (string value) - rest_notifier_ca_bundle_certificate_path = - -Whether to verify the SSL Server certificate when calling alarm action (boolean value) - rest_notifier_ssl_verify = true - -Number of retries for REST notifier (integer value) - rest_notifier_max_retries = 0 - -Timeout seconds for HTTP requests. Set it to None to disable timeout (integer value) - http_timeout = 600 - -Vitrage listener will get the alarm events from the message bus and the http post -notifier will send http post notifications on raised deduced alarms and deleted deduced alarms. - -The filtered notifications will be sent to destinations specified in registered yaml file or -other (for now, only one option will be developed), which can be updated manually or via -API requests. - -The notifications will be sent only on alarms which meet the regex filter specified in the -yaml file / via registration. This section will be specified in a different spec. - -The format of sent notifications will be hard coded. - -The http post notifier is pluggable, you can implement your own http post sender and use -it (it must inherit from the base class), when there is a default implementation. - -Alternatives ------------- - -None - -Data model impact ------------------ - -None - -REST API impact ---------------- - -None - -Versioning impact ------------------ - -None - -Other end user impact ---------------------- - -None - -Deployer impact ---------------- - -To use http post notifier one needs to define it in the Vitrage config -file, and in addition create additional yaml files and define them in Vitrage config file. - -Developer impact ----------------- - -None - -Horizon impact --------------- - -None - -Implementation -============== - -Assignee(s) ------------ - -Primary assignee: - danoffek - -Work Items ----------- - -- Create http post notifier - - - Create http post sender - -- Create unit test for http post sender - - - test http post notifier - - test http post sender - - test http post regex filtering - -Dependencies -============ - -None - -Testing -======= - -This blueprint requires unit tests. - -Documentation Impact -==================== - -The usage of the http post notifier will be documented - - -References -========== - -Example on http post notifications in AODH -`http post request `_ diff --git a/specs/pike/approved/httppost-registration.rst b/specs/pike/approved/httppost-registration.rst deleted file mode 100644 index f659eac..0000000 --- a/specs/pike/approved/httppost-registration.rst +++ /dev/null @@ -1,178 +0,0 @@ -.. - This work is licensed under a Creative Commons Attribution 3.0 Unported - License. - - http://creativecommons.org/licenses/by/3.0/legalcode - -===================== -httppost Registration -===================== - -launchpad blueprint: -https://blueprints.launchpad.net/vitrage/+spec/httppost-notifications - -The Evaluator performs root cause analysis on the Vitrage Graph and may -determine that an alarm should be created, deleted or otherwise updated. -Other components are notified of such changes by the Vitrage Notifier service. -To regirster to the httppost notifications, one needs to supply the details -of the registration, and a regex for the wanted alarms. - -This blueprint describes the implementation of registering for httppost -notifications on Vitrage. - - -Problem description -=================== - -Vitrage should support registering for httppost notifications with a regex -to support tailored notifications per target. - - -Proposed change -=============== - -Vitrage evaluator may perform raise alarm or set state actions, and the -httppost notifier will send notifications on any changes / alarms. - -The notifications will be sent to all destinations specified in the DB. - -We will add an httppost registration API which will handle the following : - -- Address : HTTP post recipient address - -- (optional) Certification properties : Used for headers purpose - example: User, password ....... The registered can specify any properties - he wants to see in the notification header. - -- Regex : A set of properties / values to filter the relevant data. Example : - - - vitrage_type : nova.instance, nova.host - - - aggregated_state :..... - - - category : alarm, resource - - - name : "%kinori%" - -Each registration will be saved in a different row in the DB. - -There can be multiple registrations with the same address and different regex(es) - -Validation will be made, during registration that same recipient + regex -do not exist. - -First stage will only support Add and Delete. - -We will also add UI to enable manually adding registration requests. - -Alternatives ------------- - -None - -Data model impact ------------------ - -New table in the DB - -REST API impact ---------------- - -`http post notification `_ - - -Versioning impact ------------------ - -None - -Other end user impact ---------------------- - -None - -Deployer impact ---------------- - -We need a new DB table, to represent registration details -Preliminary columns : - -- ID - -- Date - -- Address - -- Certificate data - -- Filter properties - - -Developer impact ----------------- - -We need to implement a DB an infrastructure for working with database. -For example sqlalchemy. The spec for this will be written in a different -document. - -Horizon impact --------------- - -New Vitrage Configuration Tab : - -Will currently only have a list of registrations, with options to delete and add. - -Implementation -============== - -Assignee(s) ------------ - -Primary assignee: - danoffek - -Work Items ----------- - -- Create new table - -- Create registraion add / delete api - -- Create filtering in httppost notifications - -- Create unit test for registration - - - test that the registration works - - - test filter works properly by creating alarms - -- Create tempest tests for registration - - - test registration success: url matches, properties match, filter matches - - - test additional, same and different registration - - - test delete registration success - -Dependencies -============ - -None - -Testing -======= - -This blueprint requires both unit tests and tempest tests. -Test Add, Remove registrations, and test that they have the same address, -properties, and filters, - -Documentation Impact -==================== - -The usage of notifier registration will be documented - - -References -========== - -`http post registration request `_ diff --git a/specs/queens/implemented/webhooks.rst b/specs/queens/implemented/webhooks.rst new file mode 100644 index 0000000..8dedd9c --- /dev/null +++ b/specs/queens/implemented/webhooks.rst @@ -0,0 +1,146 @@ +.. + This work is licensed under a Creative Commons Attribution 3.0 Unported + License. + + http://creativecommons.org/licenses/by/3.0/legalcode + +======== +Webhooks +======== + +launchpad blueprint: +https://blueprints.launchpad.net/vitrage/+spec/configurable-notifications + +The Evaluator performs root cause analysis on the Vitrage Graph and may +determine that an alarm should be created, deleted or otherwise updated. +Other components are notified of such changes by the Vitrage Notifier service. +Among others, Vitrage Notifier is responsible for sending http post +notifications on Vitrage deduced alarms. + +This blueprint describes the implementation of Vitrage Notifier for +webhooks on Vitrage alarms and state changes. + + +Problem description +=================== + +Vitrage should support webhooks for notfications, which are sent on raised +alarms, deactivated alarms, state changes, RCA or other to any +registered targets. +Furthermore any registered recipient should supply a regex to filter the alarms +sent to that recipient. + + +Proposed change +=============== + +Needed definitions in Vitrage config file:: + + [DEFAULT] + notifiers = webhook + +Vitrage listener will get the alarm events from the message bus and the webhook +notifier will send http post notifications on raised deduced alarms and deleted deduced alarms. + +The filtered notifications will be sent to the destinations that are written in +the database, as configured via API requests. + +The notifications will be sent only on alarms which meet the regex filter specified in the +webhook specification. + +The format of sent notifications will be hard coded. + +As Vitrage notifiers are pluggable, you can write your own notifier and use it. +Specifically in this case, you can inherit the webhook base class and implement your own webhook notifier. + + + +Alternatives +------------ + +None + +Data model impact +----------------- + +New DB table, to represent registration details +Preliminary columns : + +- ID + +- Date + +- Address + +- Headers + +- Filter + +REST API impact +--------------- + +An API which supports adding, removing and listing webhooks + +Versioning impact +----------------- + +None + +Other end user impact +--------------------- + +None + +Deployer impact +--------------- + +To use webhooks one needs to define it in the Vitrage config file. + +Developer impact +---------------- + +None + +Horizon impact +-------------- + +Future support for webhooks in Horizon + +Implementation +============== + +Assignee(s) +----------- + +Primary assignee: + nivo + +Work Items +---------- +- Add DB table +- Add API +- Implement notifier +- Update docs +- Tests + +Dependencies +============ + +None + +Testing +======= + +This blueprint requires tempest tests and unit tests. + +Documentation Impact +==================== + +The usage of webhooks will be documented + + +References +========== + +Example on http post notifications in AODH +`http post request `_