Create a DPA Custom alert
Use Custom alerts to execute SQL statements or stored procedures against the monitored database or DPA repository to check for conditions not covered by other DPA alerts. Each SQL statement or procedure returns a number (or set of numbers) that can trigger an alert depending on user-defined thresholds. Custom alerts can be used to alert against a wide variety of conditions. Any parameter that can be returned to DPA using a SQL statement or stored procedure can be used as the basis for a custom alert.
To create a custom alert, see the following sections:
- Custom alert types and expected return values
- Requirements for stored procedures
- Create a Custom alert
- Custom tags
Examples of custom alerts can be found on the DPA content exchange page in THWACK.
Custom alert types and expected return values
Depending on what type of custom alert you select, the SQL statement or stored procedure must return one of the following values.
Alert type | Expected return values |
---|---|
Single Numeric Return |
The SQL statement or stored procedure returns a single numeric value. The alert is triggered if the value exceeds the defined High, Medium, Low, and Info thresholds. |
Multiple Numeric Return |
(SQL statements only.) The SQL statement returns one or more rows of data. Each row contains a string in the first column and a numeric value in the second column. For example, the query could return database names and the amount of free space for each one:
The alert is triggered if any value exceeds the defined High, Medium, Low, and Info thresholds. |
Single Boolean Return |
The SQL statement or stored procedure returns a string value of TRUE or FALSE (not case-sensitive). The alert is triggered if TRUE is returned. |
Single Alert Status Return | The SQL statement or stored procedure returns a string value that specifies the alert status. Valid values are NORMAL , INFO , LOW , MEDIUM , and HIGH (not case-sensitive). |
Requirements for stored procedures
When you create a custom alert that calls a stored procedure, the stored procedure must include two output parameters. These output parameters must be in the following order relative to each other, and no other output parameters can be included:
-
AlertValue OUT VARCHAR2
The value of this parameter must be one of the expected return values for the selected alert type. (For example, if the alert type is Custom Procedure Alert - Single Boolean Return, this output parameter must be
TRUE
orFALSE
.)Use the custom tag
#ALERTVALUE#
to include this output parameter. -
AlertString OUT VARCHAR2
The value of this parameter is a description of the result of the stored procedure.
Use the custom tag
#ALERTSTRING#
to include this output parameter.
The stored procedure can include any number of input parameters. The input parameters can be interspersed with the output parameters, as long as the output parameters are in the correct order relative to each other. For example:
myproc('inputParam1', #ALERTVALUE#, 'inputParam2', #ALERTSTRING#, '#DBLINK#')
Create a Custom alert
- From the DPA menu in the upper-right corner, click Alerts.
- In the upper-right corner, click Manage alerts.
-
Select Custom as the alert category, select the alert type, and then click Create Alert.
To find out more about each alert type, see DPA alert categories and types. Or select a type to display a description on the right.
-
In the Alert Information section:
-
Enter a unique name.
- If you want to disable the alert, clear the Active checkbox.
- Select the execution interval. (DPA recommends an execution interval of at least 10 minutes.)
-
Enter the notification text to be sent with the email notification. Include an explanation of the issue and the suggested resolution.
If you apply a custom email template to this alert, the email notification includes the notification text if the email template contains one of the following variables:
- Alert Notification text:
[=alert.notificationText]
- Results:
[=dpa.body]
(included by default)
- Alert Notification text:
-
-
To run the SQL statement or stored procedure against monitored database instances (instead of the DPA repository), specify the database instances that the alert applies to. You can use a rule to identify instances that meet one or more conditions, or you can manually select the instances.
-
When you select a rule, DPA uses the rule conditions to determine which instances the alert monitors. If your environment changes, the list of instances is automatically updated.
-
Click Use rule.
-
The Rules page lists the existing rules.
-
Select an existing rule, or create a new rule and then select it.
-
Click Assign rule.
-
The alert definition shows the selected rule name, rule expression, and a list of instances that currently meet the rule conditions.
-
-
If you manually select the database instances, the list is static.
-
Click Select database instances.
-
The Available database instances page lists database instances. If the alert type is specific to one type of database, the page lists only instances of that type.
-
Use the Search bar to locate instances, or apply filters to refine the list.
-
To select all instances in the list, select the checkbox above the list. To select individual instances, select the checkbox next to each instance.
-
Click Assign and go back.
-
The alert definition shows the list of selected instances.
-
-
-
In the Alert Parameters section:
-
Enter the SQL statements to execute, or enter a call to a stored procedure.
Use custom tags to include variables such as the database ID and to include the required output parameters for stored procedures.
- In the Execute Against drop-down, indicate if the SQL statement or stored procedure should be executed against the selected database instances or against the DPA repository database.
- If the Description field is available, you can enter a custom description for the alert. This description replaces the DPA default description for the alert type when the Description parameter is included in the email template.
- If the alert returns a numeric value, specify the Units for the returned value.
-
-
If the alert returns a numeric value, specify the thresholds for each alert level you want to enable.
-
Leave the Max value for the highest level blank to alert on anything above the minimum value for that level.
-
If you configure multiple levels, the Max value for lower levels must equal the Min value for the next higher level.
-
When you enter a Max value for a level, DPA alerts at that level when the value is greater than or equal to the Min value but less than the Max level. For example, if the Min value is 5 and the Max value is 10, DPA alerts at that level when the value is 5 or more, but less than 10.
-
-
Select the person or group who gets notified when each alert level is triggered and when the alert is broken. (The alert status is set to Broken if an error occurs during execution.)
To send notifications when the alert returns to Normal, select a recipient for Normal.
- If you have not added the person or group as a contact in DPA, click Add Contact or Add Contact Group and create the contact or group.
- Select an SNMP contact to send SNMP traps when the alert is triggered. Select an SNMP contact for Normal to send a clearing notification when the alert status returns to Normal.
-
Verify or change the notification policy.
To send notifications when the alert returns to Normal, the notification policy must be
Notify when level changes
. - Select the email template that defines the contents of the email notifications sent by this alert.
-
Click Email Preview to see an example of the email that will be generated using the selected email template and contact information.
If the alert applies to multiple database instances, select an instance in the Email Preview dialog box and click OK. After reviewing the email, you can select a different database instance or click Cancel to close the Email Preview dialog box.
The email sent to users might not exactly match the preview because some alert parameters cannot be evaluated during a preview.
- Click Test Alert to test the alert and view the current alert level. The test does not generate an email.
- Click Save.
Custom tags
You can include the following custom tags in your SQL statements or stored procedure calls. DPA replaces these tags at runtime with the appropriate values.