Set Up Custom SQL Monitors
Write your own SQL scripts to set up tests specific to your needs.
Last updated
Write your own SQL scripts to set up tests specific to your needs.
Last updated
Custom SQL Monitor provides and easy and flexible interface for monitoring the database based on custom SQL filter. This feature takes in the select query provided by the user and wraps it in a subquery which does a row_count
on the result and record incident if row_count > 0
.
You can choose either to set up a Normal
Custom SQL monitor or one that has a Group-by
column selected as a segmentation.
How to Set Up a Custom SQL Monitor
Select the “Custom SQL” card from the Config module.
You’ll be directed to the “Create a New Monitor” form with Setup and Configure steps.
The form fields will become available as you select the mandatory options.
Select a Data Source.
Choose Monitor Mode (Scheduled or On-Demand).
If applicable you can set your monitor as Grouped by
, you can turn on the toggle
To set your monitor as grouped by you can refer to Grouped-By documentation.
Click “Proceed to Monitor Setup” to continue.
Once you proceed to setup, you’ll reach the “Configure” page, where you can review your previous selections.
Within the "Configure" popup, users must complete the necessary fields to save their preferences and successfully set up their Custom SQL monitor. These required fields include:
Can create multiple tests for each test type per column/table
Able to add a test name to differentiate monitors created
Monitor Name
Monitor Description is Optional.
Frequency
Add your Custom SQL query: Enter the query and Click on Validate, Once query is validated success message (Query successfully validated) will be displayed.
Note that if you modify the query after validating it, you will need to re-validate the query again.
To set custom alerts, you must first turn on the "Notify default channel"
toggle. Activating this will allow users to specify their desired alert channels, be it via emails or Slack channels.
You can select the desired alert channels in the dropdown.
Mention the address or channel name in the field.
At last select the Incident Levels
Click on Submit
and your monitor is created successfully.
Once you click on Submit
you’ll be redirected to All Monitor
tab.
Set-up
Select the data source
and Monitor Mode
If applicable you can set your monitor as Grouped by
, by turning on the toggle
Once you click on Proceed to monitor setup
,you will reach the next page (Configure).
Here, on the top you can see the previous page selection overview.
Within the "Configure" popup, users must complete the necessary fields to save their preferences and successfully set up their Custom SQL monitor. These required fields include:
Can create multiple tests for each test type per column/table
Able to add a test name to differentiate monitors created
Monitor Name
Monitor Description is Optional.
Add your Custom SQL query: Enter the query and Click on Validate, Once query is validated success message (Query successfully validated) will be displayed.
Custom Notifications: On the Configure Monitoring pop up for both On Demand and Scheduled monitors, can also toggle the notification settings as well as custom alerts for each monitor modes.
Upon completing the required fields to create an On Demand monitor for Custom SQL, users can complete the set up process by choosing either of the following confirmation buttons based on their preferred use case:
Save
: This is an applicable option for users who wish to set up an on demand monitor without running the monitor scan immediately after creation.
Save an run
: This option is applicable for users who wish to run the On Demand Monitor immediately upon creation. For the next time users wish to run the on demand monitor again, users can navigate to the All Monitor's.
After selecting the above option you will be redirected to ALL MONITORS tab.
Modify Monitoring
To modify an existing monitor:
Go to All Monitors.
Click the ellipsis (︙) and select View Monitor.
Click on Run once
to run the monitor manually.
For setting up On-demand Monitor/Schedule Grouped By you can refer to Configure: On-demand /Schedule Monitor Grouped By for Custom SQL
In this section, we will show a few ways you can configure the monitor using the power of SQL!
Filtering records with specified label to trigger an incident
Filtering sum of value over a threshold of a specified interval
The discrepancy between 2 tables