The query should be in a single line and maximum of 2000 characters. Please note that the number of queries is limited to five queries in one monitor. Also, note that the delimiter for query is new line. Total number of rows shown in the output is limited to 50 rows.
If there are more than one columns in the results, we recommend to have set a column which has string values as primary key in the monitor.
For queries involving counts we recommend to have a dummy column and use that as primary key.
Lets take for example some pending tasks for your application is stored in app_pending_tasks table and you want to monitor the number of pending tasks for the application.
Typically we will form the query as given below.
select count(*) from app_pending_tasks
The problem with the above query is it doesn't have an identifier. Instead you can form the query as given below.
For MySql, Oracle, Sybase:
---------------------------------
select 'Number of Pending Tasks', count(*) as totalcount from app_pending_tasks
Make the 'Number of Pending Tasks' the primary column.
For MsSql, Postgres, Db2:
---------------------------------
select 'Number of Pending Tasks' as NumberOfPendingTasks, count(*) as totalcount from app_pending_tasks
Make the 'Number of Pending Tasks' the primary column.
Now you can generate alarms by assigning thresholds and generate reports for 'totalcount'.