How to Monitor SQL Queries
- Updated On 06 Jun 2019
- 1 Minute To Read
Every app relies on a database to ensure the flow of information. SQL Monitors proactively keep tabs on data and database health. However, problems in the database often have a wide-reaching impact downstream. In this guide, learn how to make SQL monitors to effectively monitor query results.
Preparing for SQL Monitors
Set up the database information inside Retrace. If you have not done this process, first set up your database credentials and configure a database connection. Then create a reusable query. See the SQL Connections article to see how to set this up.
SQL Monitors Page
Click on the Monitoring tab and click on the SQL Queries link.
Click on the Add New button to configure a new monitor.
Select A Type Of Query To Monitor
You will be given the option to create new a monitor from an existing query or to create a new query to be monitored.
Retrace supports SQL Server, MySQL, Oracle, and PostgreSQL database types.
When creating a new query to be monitored, you will be asked to enter the database connection details for the query.
Select A Query And Connection
If you chose to use an existing query, you will select which query to use here. Next, you will choose an existing connection to run the query on. The query will be sent from an agent currently installed on one of your Active Devices.
Once you create the SQL connection and select the query, you can then add and configure monitors.
Configure the Monitor
Below is an example of some settings you could configure to monitor a SQL query.
Duration: Depending on how long the SQL statement takes to execute, an alert could be set up to provide the notification.
Record Count: This warning will occur every time a record count is 1 or greater. In this case, this would alert you every time a customer is missing an email address in the database.
Result Check: This setting will check the value of the query results. This is especially useful if you want an alert for unexpected query results.