Using custom SQL queries
PATROL for Sybase includes custom SQL queries that you can configure to monitor the health of a database.
The following KM attributes can be used to generate events:
- Number of records–number of rows returned by the query
- Query status–success status of the query
- Response time–time (ms) of the custom query response time
- Value–value of a specific cell
You can use the events generated by these attributes to determine how efficiently the SQL queries are handled in the Database. While configuring a policy in the TrueSight console, you add a custom query to the environment configuration through the Custom SQL queries panel.
Number of records
Set a threshold for this attribute to get a notification if the query returns a high number of records (rows) that exceed the threshold. By default, this attribute does not generate an alarm or warning event. For more information about setting an alarm or warning event for this attribute, or changing the default attribute range, see Defining-a-monitoring-policy. To see more information about this attribute, see the Number Of Records.
Query status
Set a threshold for this attribute to get a notification if the query was successful or unsuccessful. By default, this attribute will not generate an alarm or warning event as the threshold is not set. For more information about setting an alarm or warning event for this attribute, or changing the default attribute range, see Defining-a-monitoring-policy.
To see more information about this attribute, see the Query status.
Suggested action
If an SQL query fails because of a bad SQL query definition, revise your query and correct the configuration in the TrueSight console.
Response time
Set a threshold for this attribute to monitor the response time, in milliseconds, required by a query to retrieve data. By default, this attribute will not generate an alarm or warning event. For more information about setting an alarm or warning event for this attribute, or changing the default attribute range, see Defining-a-monitoring-policy. To see more information about this attribute, see the Response time.
Suggested action
A high response time value can indicate delays occurring in the Sybase Database, check your database performance.
Value
This attribute is used to return a numeric value. If the query result is a string which can be converted to a numeric value, the Value attribute displays the converted value else the attribute will stay offline.
If the query result is an output of multiple rows, the Value attribute will be in the offline state. By default, this attribute will not generate an alarm or warning event. For more information about this attribute, see the Value attribute.
For more information about setting an alarm or warning event for this attribute, or changing the default attribute range, see Defining-a-monitoring-policy.
Event generated by the KM
You can see the event in the TrueSight console in Monitoring > Events.

Suggested action
A higher value can indicate many inactive sessions in the database which can result in exhausting the max sessions limit.