Notifications in AutoPatcher
This section describes how to configure notifications for your patching. Notifications are configured in patching groups. Each group may have several notification channels configured (e.g. slack, email, pager duty). This way one notification can be sent to several slack channels and teams, or pager duty accounts, or emails.
Creating notification group
First, create the notification group - https://autopatcher.nordcloudapp.com/notification_groups
Notification events
AutoPatcher sends notification about the following events:
Events | Severity Level | Description |
---|---|---|
event_new | INFO | AutoPatcher created new patching event |
error | ERROR | There was an error during patching |
incoming_patching | INFO | Incoming patching |
not_approved_patching | INFO | AutoPatcher created new patching event which requires approval (or will be approved later automatically in case of a pipeline event) |
plan_modification | DEBUG | Patching plan has been modified |
plan_new | DEBUG | New patching plan has been created |
plan_deleted | WARNING | Patching plan has been deleted |
pipeline_modification | DEBUG | Patching pipeline has been modified |
pipeline_new | DEBUG | New patching pipeline has been created |
pipeline_deleted | WARNING | Patching pipeline has been deleted |
patching_start | INFO | Patching has been stared |
patching_finish | SUCCESS or ERROR | Patching has been started |
partial_patching_start | INFO | Partial patching has been stared |
partial_patching_finish | SUCCESS or ERROR | Partial patching has been started |
machine_patching_start | INFO | Instance update has been started |
machine_patching_finish | SUCCESS or ERROR | Instance update has been finished |
machine_access_err | ERROR | Instance connection error |
machine_not_in_window | WARNING | Instance cannot be updated because it is not in the time window |
hook_start | INFO | Hook has been started |
hook_finish | SUCCESS or ERROR | Hook has been finished |
host_hook_start | INFO | Instance hook has been started |
host_hook_finish | SUCCESS or ERROR | Instance hook has been finished |
All finish notifications contain execution status (machine update status, hook result etc.).
An incoming_patching notification is sent by default 1 hour before the actual patching is started.
However your can change this time amount by setting upcoming_notification_time
field in your plan to a custom value in hours.
Notifications about dry run plans and events
AutoPatcher adds a [DRY RUN]
tag to the end of a title of every notification when plan or event is configured to scan for available patches. Example:
Notification channels
Slack
AutoPatcher can send the notifications to the slack channel. Every notification contains IDs and the links to the related objects so you can easily check its details.
Example notifications:
Pager Duty
AutoPatcher sends all the notifications to the Pager Duty service. Based on these notifications you can create a rule to generate an error alert in the PagerDuty configuration. Pager Duty example to generate an alert only on errors:
AutoPatcher can send notifications to configured email. Example:
Customer-friendly emails
For some types of events there's a possibility to send emails in different format which is more customer-friendly. For now the new format is defined only for the following types of events:
incoming_patching
patching_start
patching_finish
To use the new format you should check the Is external
checkbox when creating email notification:
Below are examples of customer-friendly emails:
Using CLI
Adding notification group:
nc-autopatcher-cli create notification_group --file notify.json
notify.json
example:
{name: "test-group",owner: "TEST",notifications: [{channel: "test-channel",type: "slack",web_hook_url: "webhookurl"},{type: "email",email: "x@y.com"},{type: "email",email_config: {address: "z@w.com",is_external: true}},{type: "pager duty",routing_key: "ct3h84ytc382ty947t4t7243y98bvt2y3vt",override_settings: true,levels: [],events: []}],events: [],levels: []}
- type - notification type: "slack","email", "pager duty"
- web_hook_url - slack web hook url
- channel - slack channel routing_key - Pager Duty key
- events - nofify about specified events. If events array is empty AP sends all notifications
- levels - notify about specified severity levels. If levels array is empty AP sends all notifications.
You can override Notification group filters (events & levels) by adding override_settings: true parameter and providing new settings in the channel configuration.
The full list of the events and severity levels can be found in the Notification events
section.
Adding notification groups to a plan
Add the created notification group into the schedule plan. You can add multiple groups:
nc-autopatcher-cli update plan --file plan.json --id $PLAN_ID
plan.json
example:
{"cron_window_start": "0 19 * * *","cron_window_end": "0 20 * * *","machines": [{"id": "XXX","order": 4},{"id": "YYY","order": 3}],"name": "TEST_PROD_ACCOUNT","owner": "nordcloud","parallel": 1,"notification_groups": ["34vc5-23v6fc-2v3c65-2c34","GROUP2"]}