• Beta
Alerts
  • 30 Oct 2020
  • 3 Minutes To Read
  • Contributors
  • Print
  • Share
  • Dark
    Light

Alerts

  • Print
  • Share
  • Dark
    Light

Under Development

Please note that the features described below—including the User Interface—are currently under development and will likely change over time.

The features described in this topic are only available to Alpha customers that accept the constraints and are willing to provide feedback. If you are interested in becoming an Alpha customer, please contact us at support@preset.io

Overview: How to Add an Alert

Preset users can create an alert that sends a chart via email to recipient(s) when a SQL-based trigger event occurs — this trigger occurs when a SQL statement returns a Not Null value or meets specific conditions.

For example, if a chart displays the current number of new Covid-19 cases in California, then trigger an alert when the number of new cases exceeds 3,000 in the last day.


Step 1: Add a New Record

In the Toolbar, select Settings and then, in the drop-down menu, select Alerts.

Select_Alerts@2x

The List Alert screen will appear.

In the top right corner, select the plus icon to add a new record.

Add_New_Record2@2x


Step 2: Configure the New Record

After you select the plus icon, the Add Alert form appears.

Alerts_Form

Complete all fields using the definitions below as a guide:

  • Label: Enter a brief description of the alert (e.g., New Cases Exceed 3k).
  • Database: Select the database containing the SQL Engine where the SQL will execute.
  • SQL: Enter the query to be executed — it should return one row and one column. It is common practice to wrap a query in SELECT COUNT(*)() a;
    • Note: Always validate the query in SQL Lab to ensure that it returns the expected results. It should return either a NULL or a number value.
  • Validator Type: Enter operator or not null control types. Note that the query needs to return 1 row and 1 column in order to perform the validation.
    • Not Null: Sends an email if the SQL Observer returns 1 or more rows. This is used when you want to see any type of observation; or,
    • Operator: Sends an email when you want to evaluate the result set. In this case, the result set needs to return a value that can be compared with a threshold. The operator validator works in conjunction with the config section to compare the SQL Evaluator with the Threshold.
  • Validator Config: If you enter operator in the Validator Type field, then you need to enter a JSON string in the Config field that contains values that the validator will compare against.
Example for Config Field

If you enter the following:

{
“op” : ”>=”,
“threshold” : 4
}

...then an email will be triggered if the result set of the SQL Observer is >= 4.

  • Active: Select the checkbox to enable this alert record.
  • Crontab: Enter a cron rule. You can use https://crontab.guru/ to define an existing rule. Some examples include:
    • 0 * * * * : Trigger SQL validator at every hour, send email only if meets validator;
    • 0 7 * * * : Trigger SQL validator once per day at 7:00 am; and,
    • 0 7 1 * *: Trigger SQL validator the first day of a month at 7:00 am.
  • Owners: Select the name of the alert's owner(s).
  • Recipients: Enter the email addresses of all recipients.
  • Slack Channel: This feature is not yet available in Preset.
  • Slice: Select the chart to monitor.
  • Log Retention (days): Enter the number of days that Preset should maintain activity logs for this alert record (defaults to 90 days).
  • Grace Period: Enter the number of seconds that should pass before Preset sends another alert reminder (defaults to 86400 seconds = 24 hours).

When done, select Save.


Step 3: Verify Alert Details

After saving, the alert's details will appear in the List Alert table:

List_Alert@2x

Was This Article Helpful?