::: {.index} pair: Notify Slack when Alerts Arrive; Labs :::
2020 Notify Slack when Alerts Arrive¶
Overview¶
- Id: 2020
- Time: 10 Minutes
- Enabled: Yes
- Difficulty: intermediate
- Tags: slack, orchestration, integration, triggers
* Concepts: alerts, triggers, blueprints .. youtube:: VBnGduQdrnE :privacy_mode: Video Link
Objective¶
Integrate Digital Rebar Provision events and alerts into Slack notifications
In this lab, the User will explore how to orchestrate the delivery of Slack notifications on events and alerts.
Business ROI: Improved visibility into operational status improves system uptime and maintenance
Prerequisites¶
Required Labs:
- 2000
- 2010
Addtional Checklist Items:
- Must have authority to create a webhook application in Slack see
-
A Slack Messaging Application URL
Per the Slack Documentation, the URL will need appropriate tokens to access slack.
Notify Slack when Alerts Arrive¶
Build orchestration¶
Choose a path to setup the orchestration. Both paths can be done without resetting anything.
::: {.tabs} ::: {.tab} UX :::
-
Setup Slack Service Integration
- Navigate to the global profile
-
Add Parameter by clicking
Add Params
Search and select
slack/service-url
Click
Decrypt Secure Param
Enter the URL for Slack Messaging Application URL
Click outside of the text box to save the value
-
Setup a Blueprint
- Navigate to the Blueprints view
-
Click the
Add
buttonSet
Name
tolab2020
Click
Save
-
Add a Task by selecting
slack-app-webhook
-
Create a Trigger to Run the Blueprint
- Go to the Triggers view
-
Click the
Add
buttonSet
Name
tolab2020
Set
Provider
toevent-trigger
Set
Blueprint
tolab2020
Set
Filter
toLocal Self Runner
Add a Param
event-trigger/event-match
with a value ofalerts.create.*
Click
Save
-
Create an Alert to Test the Process
- Go to the Alerts view
-
Click the
Add
buttonSet
Name
tolab2020
Set
Level
toINFO
Click
Save
-
Check Slack for a message from that alert.
-
Observe Work Orders
- Go to Work Orders view
- Notice the
lab2020
Blueprint WorkOrder
-
Customize the message
- Go to the lab2020 trigger
- Click the
Merge Data
toggle totrue
-
Add a WorkOrder Parameter
slack/message
The value should be set to:
-
Create an Alert to Test the Custom Message
- Go to the Alerts view
-
Click the
Add
buttonSet
Name
tolab2020
Set
Level
toINFO
Click
Save
-
Check Slack for a message from that alert.
::: {.tab} CLI :::
- Using the Shell from Lab
2000
- Bring up the shell
-
Setup Slack Service Integration
-
Set the Slack URL in the global profile
Returns the URL on success. It will automatically be encrypted on the server as a secure parameter.
-
-
Setup a Blueprint
-
Create a blueprint to do slack notifications
Returns the JSON object of the new blueprint on success.
-
-
Create a Trigger to Run the Blueprint
-
Create a trigger to run the blueprint
drpcli triggers create - <<EOF Name: lab2020-cli Blueprint: lab2020-cli Description: 'Notify Slack on new Alerts' Enabled: true Filter: Params.machine-self-runner=true Endpoint= FilterCount: 1 MergeDataIntoParams: true Params: event-trigger/event-match: alerts.create.* TriggerProvider: event-trigger WorkOrderParams: slack/message: >- {"text":"{{.Param "Level"}} {{.Param "Name"}} Alert from Digital Rebar at {{.ApiURL }}"} EOF
Returns the JSON object of the new trigger on success.
-
-
Create an Alert to Test the Process
-
Post the alert
Returns the JSON object of the alert.
-
-
Observe Work Orders
- Go to Work Orders view
- Notice the
lab2020-cli
Blueprint WorkOrder :::