Knowi Widget Alerts — Tutorial

Featured Img

Table of Contents

Introduction

Knowi’s Alerts allow you to stay on top of important changes in your business in a centralized location to drive actions. With Alerts, you can enhance data management by monitoring query execution, receive real-time notifications when certain thresholds and conditions are met, or when anomalies are detected within your data.

Widget Alerts enable you to set up alerts directly on a widget based on a threshold, anomaly detected, or custom condition in your data and have the alert along with results sent via email/webhook/Slack. 

In this blog, we will be learning the following topics:

Navigate to Knowi Widget Alerts
Navigate to Knowi Widget Alerts

Create a Threshold Widget Alert

  1. Navigate to the widget you want to create an alert for and click the Add/Remove Alert Icon.
    Alerts Blog2 New
  2. Select the Threshold tab.
  3. Give your Alert a name.
  4. In Alerts metric dropdown, select the field you want to set an alert on.
  5. Choose the threshold type (i.e. >, >=, =, <=, <).
  6. In the Threshold box, enter the value that will trigger the alert.
  7. See section below for Advanced Settings.
  8. Select a Send Alert action to configure alert to be sent via email/webhook/Slack.

Create an Anomaly Detection Widget Alert

Knowi Anomaly Detection on your time-series data is used to detect and report on anomalous behavior using unsupervised machine learning.  Anomaly Detection can be used across any use case with Time-Series data such as fraud detection, network security, equipment failure monitoring, etc. 

Machine Learning Anomaly Detection has been valuable in providing business value to your decision-making. Therefore, this feature now is available directly on the widget.

Time-series anomaly detection is used to identify unusual patterns that do not conform to expected behavior, called outliers. This alert notifies you when such anomalies are detected within your data.

  1. Select the Anomaly Detection (Beta) tab.
    Alerts Blog3
  2. Enter the Alert name.
  3. In Alerts metric dropdown, select the field you want to set an alert on.
  4. Set the Anomaly Detection Threshold (default: 50). The threshold/band width determines the range of expected values. Values outside of the threshold are considered anomalies. 
  5. From the drop-down, select the Date/Time Dimension – this is the time series feature of the selected dataset, typically used as the x-axis of time-series charts. Note: Anomaly detection algorithms work only with time series data at this time
  6. Select Dimension to detect anomalies across other fields in your dataset
  7. Use the Preview button to preview the anomaly detection model which is trained and applied to the data. The precision of the model increases over time as more data is made available.
  8. Select the type of dimension from Dimension drop-down to see the specific values.
  9. See section below for Advanced Settings
  10. Select a Send Alert action to configure alert to be sent via email/webhook/Slack
Anomaly Detection Alert
Anomaly Detection Alert

The anomaly detection visualization itself consists of a configurable pink band range of expected values (acceptable threshold limit) along with the actual metric data points. Any values outside of the pink band range are considered anomalies and will appear in red.

The width of the pink band of the expected values can be configured by setting the threshold attribute. This Anomaly detection threshold is the mean absolute percentage deviation from the expected value. The default threshold value set is 50% but this can be modified. Click Anomaly Forecasting algorithms to understand how each model is predicted. 

Create a Custom Widget Alert

  1. Navigate to the widget you want to create an alert for and click the Add/Remove Alert Icon
    Alerts Blog5 New
  2. Select the Custom tab
  3. Give your Alert a name. This is how it will be displayed in Alerts Management
  4. In the Cloud9QL condition editor, enter a custom alert condition syntax.
  5. The custom condition you’ve specified will trigger the alert
  6. See section for more information about Advanced Settings
  7. Select a Send Alert via action to configure alert to be sent via email/webhook/Slack

Advanced Settings

These are additional options to configure your Alert. Check the Advanced Settings box to expand the menu.

  • Generate Alert if no data is detected: Check this box to raise the alert if no data is returned from the alert condition
  • Attach conditional data as part of the alert: Check this box to attach the underlying dataset after the alert condition is applied as part of the alert
  • Attach another dataset on trigger: Check this box to attach a separate dataset when the condition is triggered. For example, if an alert is triggered for total Users crossing a threshold, but you need the data sent/attached to be from a list of Users from a separate dataset/query. Cloud9QL can be applied on that dataset to optionally manipulate the results
  • Enable realtime alerts: Check this box to trigger the alert every time the dataset is updated. Not available for direct datasets
  • Skip Alert if data is same as last alert: Check this box to skip this alert If the data is the same as the last alert. Useful to avoid repetitive alerts

Send Alerts

This section will walk you through setting up Alert notifications for Widget Alerts.

Email

Email Alerts allows you to send the alert via email along with a CSV attachment of results to a list of recipients.

To set up an Email Alert:

  1. Under Send alert via, select the Email tab, then click Setup
  2. Enter the Email Subject that will be displayed
  3. In the Email From section, enter the email address that the email will be sent from (support@knowi.com by default). This address will appear as the sender of the email when received in your inbox
  4. Enter the email address of the recipient(s). Comma separated for multiple recipients
  5. Enter the Email Body. (Optional) Write custom HTML to customize the email template
  6. Attach Full Dataset as CSV (optional): Check this box to attach the full underlying dataset as a CSV to the email
    Alerts Blog6
  7. Attach Results after Cloud9QL as CSV (optional): Check this box to attach the results after the trigger condition as a CSV to the email
  8. Click Save Settings
  9. Click Test Run (optional) to send a test email alert to the chosen recipient(s)
  10. Once configuration is complete, click Save Alert
  11. You can add a new Alert or edit an existing one by clicking the Alert Icon in the widget

Webhook

Webhook Alerts allow you to send an alert directly to your application (or third party applications). When the condition is triggered, we’ll send a POST request with a JSON payload of the data, which you can use to drive actions within your application. 

The data in the POST will be a JSON formatted dataset of either the full raw dataset for which the alert is generated, or the dataset after Cloud9QL which triggered the alert. Additionally, you can use Cloud9QL to make any adjustments to the data before posting.

To set up a Webhook Alert:

  1. Under Send alert via, select the Webhook tab, then click Setup
  2. Click Add New Webhook. This opens up the Create new webhook sidebar
    Alerts Blog7
  3. Under URL to Invoke, enter the endpoint in your application that can accept a post request with JSON (Array of Objects). For example: https://somehost.com/someEndpoint
  4. Enter an Authentication URL, In cases where you need to call an authentication endpoint first to obtain a token, which is then passed into the actual POST request, use the Authentication URL along with any Authentication headers. This will invoke a separate POST call to obtain an auth token first, which can be subsequently passed as a token into the Headers section:
    • Authorization: Bearer {access token}
  5. Under Headers, enter any optional authentication related headers. One header per line. 
  6. Under AuthHeaders, enter any optional authentication related headers. One header per line.
  7. Under Cloud9QL filter before POST, leave empty if you want to send the full results of the Alert. Otherwise, enter any additional manipulation to the data using C9QL before sending to the endpoint. For example, if you only want to send a subset of the most recent close prices which are over 160 and order them by date descending, enter:
    • select * where close > 160 order by date desc limit 10;
  8. Check the box Use full dataset into POST to send the whole dataset. If left unchecked, then the results after Cloud9QL which triggered data will be used
  9. Click Save Settings
  10. Click Test Run (optional) to send a test webhook alert to the chosen application. Here’s an example of the results in JSON form:
  11. Once configuration is complete, click Save Alert
  12. You can add a new Alert or edit an existing one by clicking the Alert Icon in the widget

Slack

Slack integration allows you to trigger actions in your Slack channel(s) for a given condition triggered by an alert. When the condition is triggered, we’ll send a message to a predefined channel(s) including the attachment of full data or conditional data depending on the options selected.

  1. Under Send alert via, select the Slack tab, then click Setup
    Alerts Blog8
  2. If this is your first time connecting Knowi to Slack, click Add new Slack team. Follow the prompts to give Knowi access to your Slack account
  3. Click Add New Slack Account. This opens up the Add Slack sidebar
  4. Give your Alert a name
  5. Under Alert Message, enter a user defined message that will show up when the Alert is received in Slack. If left blank, it will send a default message
  6. In the Alert Team dropdown, choose the Slack workspace to send the Alert to
  7. In the Alert Channels dropdown, choose the Slack channel to publish the Alert notifications to
  8. In Cloud9QL filter before POST text box, enter any additional manipulation to the data that will be sent to Slack 
  9. Attach Full Dataset as CSV (optional): Check this box to attach the full underlying dataset as a CSV to the Slack Alert
  10. Attach Results after Cloud9QL as CSV (optional):Check this box to attach the results after the Alert condition as a CSV to the email
  11. Click Save Settings
  12. Click Test Run (optional) to send a test Slack alert to the chosen channel(s). Here’s how the Alert will show up in you Slack channel
  13. Once configuration is complete, click Save Alert
  14. You can add a new Alert or edit an existing one by clicking the Alert Icon in the widget

Summary

To review, we started off by understanding what Knowi’s Alerts are, and how to add a new alert. We understood that there are three types which are Threshold, Anomaly Detection, and Custom Alerts. Time-series anomaly detection is used to identify unusual patterns that do not conform to expected behavior, called outliers. This alert notifies you when such anomalies are detected within your data. Afterwards, we learned how to create a custom widget alert by entering a Cloud9QL condition in the editor. Finally we also learned how to set up Alert notifications for Widget Alerts.

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email
Written by

More To Explore