Database Query Monitor is used to monitor a single query or a set of queries for any given database. Applications Manager provides easy to use and affordable Database monitoring software of different kinds, where database query monitoring is one among them. This SQL-based query monitor allows user to monitor the status of that particular query.
Using the REST API to add a new DB Query Monitor: Click here
To create a new Database Query Monitor, follow the below given steps:
Note: For the MySQL Driver, the MySQL jar file should be located in the AppManager_home/working/mysql/MMMySQLDriver/ path.
From the Enterprise Edition Admin Server, only the following database types are supported for Database Query Monitoring - MySQL, Oracle, DB2, DamengDB, Kingbase, MsSQL, Sybase, PostgreSQL, SAP HANA and SAP MaxDB.
You can enable a link to Configure Alarms (link will appear on the right top corner of each table in your Database Query Monitor page). Using the link, the user can set Predefined Thresholds for any attributes in the table.
Here is how you can enable Configure Alarms Template for Database Query Monitor:
Enable this option and configure both Threshold and Email actions for Row Count or Execution Time attribute, to receive query output as an attachment in the provided Email ID.
Here is how you can enable query output Attachment via email for Database Query Monitor:
Database Query Monitor is used to monitor a single or a specific set of queries for any given database.
Using a single query or a given set of queries, you can monitor the status of any given database using Applications Manager Database Query monitor. Queries are the best way to find out whether your database is up and running 24x7. In business enterprises such as an online store, there are a number of applications and databases used for e-commerce. Any interruption in such an environment could mean only one thing: loss of revenue.
The execution of such a query or a set of queries can be automated by setting the polling interval. By fixing the polling interval, user can automate this process and the results are obtained at the end of the polling. The result includes execution time (time taken by the query to provide results) and also displays any error that may occur during regular polling intervals. These errors help identify any issue that may occur with the database.
Let us consider an example. Many enterprise environment run critical applications which need to be up and running 24x7. Let us assume, the status of such applications are maintained in a "APPLICATION_STATUS" table. Using Database Query monitor, the user shall be able to send a select set of queries to that database to find out if they are operational or not.
|-----------------------------------------------------------|
| APPLICATIONS_STATUS |
|-----------------------------------------------------------|
| APPLICATIONS_NAME | Status |
|-----------------------------------------------------------|
| PURCHASE | OK |
| CRM | CRITICAL |
| PAYROLL | OK |
| LEADS | OK |
|-----------------------------------------------------------|
SELECT * APPLICATIONS_STATUS
By executing the above command using Database Query monitor, the user will then obtain the list of applications that are running along with its status. The user can then identify the applications whose status is 'Critical' and then carry out necessary action by configuring Alarms in Applications Manager. This action could be in the form of creating a ticket, or executing a script to rectify the problem.
Database Query monitor can also be used to identify any bottle necks in the networks which are linked to several databases and help remove them by identifying the correct database which has the issue. This bottle neck issue can arise because there is a problem with the one of applications or with the databases. Using Database Query monitor, user can then execute a given set of queries and analyze the result which provides a clear indication of the error that has caused such an occurance. The result includes the execution time (time taken by the query to generate the result). If the execution time is above a certain pre-assigned threshold, then the issue is with the database or if the result is below the pre-assigned threshold, then the issue is elswhere.
The Database Query monitor currently supports queries of the following databases:
Applications Manager also provides the ability to compare various column value in the output by attributes types. Option to Enable or Disable Reports is provided.
Note: Please note that the number of queries is limited to five queries. Total number of rows shown in the output is limited to 50 rows.
Here is a list of the compatible JDBC URLs for Oracle database type under Database query monitor: |
We have added support for Stored Procedures for all databases that we support in Database Query Monitor. We support Stored Procedures which returns only one Result Set.
To Enable Stored Procedures, go to Settings → Performance Polling → Optimize Data Collection → Script / Database Query Monitor and select Enable Stored Procedure Monitoring for Database Query Monitor.
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 is more than one column in the results, we recommend that you set a column which has string values as primary key in the monitor.
The query should have an identifier. For queries involving counts we recommend you have a dummy column and use that as primary key.
Let's take the example below:
Select 'count' as value, count(*) as alert_count from alert;
In the above query, identifier is alert_count and dummy primary column is value. Whenever this query is executed during polling we store the actual count values based on the primary key selection.In this case, the primary key is value.
You can configure an alarm for the alert_count attribute and then define a threshold value.
For reference: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/ef/language-reference/identifiers-entity-sql
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 Kingbase, MS SQL, PostgreSQL, 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'.