Data Update Alerts

For datasets that use the ElasticStore to track results, use Data Update Alerts to raise alerts when the data is not updated upon an expected interval. For example, if a query didn't execute as scheduled, this will trigger an alert that can be sent via email/webhook/Slack.


Sections


Creating a Data Update Alert

This outlines initial steps to create the alert.


  1. From any dashboard, click the Alerts icon on the left sidebar
  2. In the Alerts Management screen, Click Add Data Update Alerts +
  3. This opens the Alerts Options window
  4. Give your Alert a name. This is how it will be displayed in Alerts Management
  5. In the Dataset dropdown, select the dataset to create an alert for
  6. Adding Filters: Users can add filters to the query. Click + to add a filter and - to remove. There are two modes to choose from: Query Parameter and Filter on Query Results.
    • Query Parameter - Applicable for "Direct Query" modes, the parameters selected will be automatically passed on to this user. The field name must be in the format $c9_XXX$ or $c9_XXX(defaultVal)$, where the default value will be passed at runtime if the value is empty. To add multiple values, add the value and hit enter.
    • Filter on Query Results - Applies the filter on top of the query results to limit the data. The field name is the field name to filter by (without $c9_). Enter the value, data type, and operation type.
  7. In the Run Every section, schedule the alert to run at a chosen interval
  8. 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
  9. Select an Alert Action to configure alert to be sent via email/webhook/Slack

Creating a Query Error Alert

Follow these steps to notify users of a query failure.

  1. Click Queries from the left sidebar.
  2. Click Query Details from any of the queries.
  3. On the query's dataset management page, click More...
  4. Click Add Query Error Alert.
  5. On the Create Alert page, give the alert a name, and choose the dataset.
  6. Adding Filters: Users can add filters to the query. Click + to add a filter and - to remove. There are two modes to choose from: Query Parameter and Filter on Query Results.
    • Query Parameter - Applicable for "Direct Query" modes, the parameters selected will be automatically passed on to this user. The field name must be in the format $c9_XXX$ or $c9_XXX(defaultVal)$, where the default value will be passed at runtime if the value is empty. To add multiple values, add the value and hit enter.
    • Filter on Query Results - Applies the filter on top of the query results to limit the data. The field name is the field name to filter by (without $c9_). Enter the value, data type, and operation type.
  7. Set up the alert notification to receive an alert whenever the query fails.
  8. In addition, you can add tokens that would help provide better context on the query failure.

Tokens:

%QUERY_ERROR_MESSAGE%: Returns the query error message %QUERY_ERROR_STACK_TRACE%: returns the query error stack trace as a string.

Note: This is available for non-direct queries only


Alert Actions


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 Alert Actions, select the Email tab
  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
  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 Test Run (optional) to send a test email alert to the chosen recipient(s)
  9. Once configuration is complete, click Save


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 Alert Actions, select the Webhook tab Click + New Webhook. This opens up the Add Webhook window
  2. 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
  3. 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
  4. 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. For example:
    • Authorization: Bearer {access token}
  5. Under Headers, enter any optional authentication related headers. One header per line. For example:
  6. Under Auth Headers, enter any optional authentication related headers. One header per line. For example:
  7. Use Full Dataset into the POST (optional): If checked, the whole underlying dataset is used to post data. If unchecked, then the results after Cloud9QL which triggered the data will be used
  8. Cloud9QL filter before POST (optional): 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;
  9. Click Save
  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


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.

To set up a Slack Alert:

  1. Under Alert Actions, select the Slack tab
  2. If this is your first time connecting Knowi to Slack, click the New Team icon. Follow the prompts to give Knowi access to your Slack account
  3. Click + Add Slack. 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
  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