If your app relies on a database, you know that problems in the database often have wide-reaching impact downstream. In this section, you will learn how to make SQL monitors to effectively monitor query results. SQL Monitors are a great way to more proactively keep tabs on data and database health.
Preparing for SQL Monitors
If you haven't already set up the database information within Retrace, you should setup your database credentials, configure a database connection, and then create a reusable query. See the SQL Connections article to see how to set this up.
SQL Monitors Page
To begin, go to the Monitoring page and find the SQL Queries tab. Select "Add New" 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 notify you about it. In the example above, alerts will occur at 1, 2, or 3 seconds.
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.