Documentation forDatabase Performance Analyzer

Configure 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:

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:

DB1   120
DB2   840
DB2    35

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:

  1. 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 or FALSE.)

    Use the custom tag #ALERTVALUE# to include this output parameter.

  2. 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 or edit a Custom alert

  1. From the DPA main menu, click Alerts.
  2. Click the Manager Alerts tab.
  3. Do one of the following:
    • To create a new alert, 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.

    • To edit an existing alert, click the alert name.
  4. In the Alert Information section:

    1. Enter a unique name.

    2. If you want to disable the alert, clear the Active check box.
    3. Select the execution interval. (DPA recommends an execution interval of at least 10 minutes.)
    4. 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)
  5. To run the SQL statement or stored procedure against monitored database instances (instead of the DPA repository), select the database instances.

  6. In the Alert Parameters section:

    1. 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.

    2. 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.
    3. 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.
    4. If the alert returns a numeric value, specify the Units for the returned value.
  7. 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.

  8. 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.
  9. Verify or change the notification policy.

    To send notifications when the alert returns to Normal, the notification policy must be Notify when level changes.

  10. Select the email template that defines the contents of the email notifications sent by this alert.
  11. 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.

  12. Click Test Alert to test the alert and view the current alert level. The test does not generate an email.
  13. 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.

Tag Description
#DBID#

The internal DPA ID for the monitored database instance.

  • Data type: VARCHAR2(50)

  • SQL statement usage example:

    select mycol from mytable where dbid=#DBID#

  • Stored procedure usage example: 

    myproc(..., #DBID#, ...)

#DBLINK#

A database link used to connect to an Oracle monitored database.

  • Data type: VARCHAR2(50)

  • SQL statement usage example:

    select mycol from myschema.mytable@#DBLINK#

  • Stored procedure usage example: 

    myproc(..., '#DBLINK#', ...)

#ALERTVALUE#

(Stored procedures only.) The first required output parameter for stored procedures. It returns one of the expected values based on the alert type. It must appear in the parameter list before #ALERTSTRING#.

  • Data type: VARCHAR2(500)

  • Stored procedure usage example: 

    myproc(..., #ALERTVALUE#, ..., #ALERTSTRING#)

#ALERTSTRING#

(Stored procedures only.) The second required output parameter for stored procedures. It returns a description of the alert condition.

  • Data type: VARCHAR2(4000)

  • Stored procedure usage example: 

    myproc(..., #ALERTVALUE#, ..., #ALERTSTRING#)

#FREQUENCY#

The execution interval for the alert, in minutes.

  • Data type: NUMBER

  • SQL statement usage example:

    select mycol from myschema.mytable@#DBLINK#
    where mydate > SYSDATE -
    (#FREQUENCY#/1440)

  • Stored procedure usage example: 

    myproc(..., #FREQUENCY#, ...)