Custom Alert Templates v8
An alert template is a prototype that defines the properties of an alert. An alert instructs the server to compare the current state of the monitored object to a threshold (specified in the alert template) to determine if a situation exists that requires administrative attention.
You can use the Alert Templates
tab to define a custom alert template or view the definitions of existing alert templates. To open the Alert Template
tab, select the Manage Alerts...
menu option from the Management
menu; when the Manage Alerts
tab opens, select Alert Templates
from the Quick Links
menu.
Use the Show System Template
drop-down listbox to filter the alert templates; select a type from the listbox to view all of the templates for that level of the PEM hierarchy.
Reviewing an Existing Alert Template
To view the definition of an existing template (including PEM pre-defined alert templates), use the Show System Template
drop-down listbox to select the type of object monitored. When you select the object type, the Alert Templates
table will display the currently defined alert templates that correspond with that object type. Highlight a template name and click the edit icon (at the left end of the row) to review the template definition.
Use the edit button to the left of a template name to view detailed information about the template:
- General information is displayed on the
General
tab. - The names of probes that provide data for the template are listed on the
Probe Dependency
tab. - The names of any parameters referred to in the SQL code are listed on the
Parameters
tab. - The SQL code that defines the behavior of the alert is displayed on the
SQL
tab.
Defining a New Alert Template
To define a new alert template, use the Show System Template
drop-down listbox to select None
, and click the Add
icon (+) located in the upper-right corner of the alert template table.
Use fields on the General
tab to specify general information about the template:
Use the
Template name
field to specify a name for the new alert template; this field is required.Use the
Description
field to provide a description of the alert template; this field is required.Use the
Target type
drop-down listbox to select the type of object that will be the focus of the alert.Use the
Applies to server
drop-down listbox to specify the server type (EDB Postgres Advanced Server or PostgreSQL) to which the alert will be applied; you can specify a single server type, orALL
.Use the
History retention
field to specify the number of days that the result of the alert execution will be stored on the PEM server.Use the
Threshold unit
field to specify a unit type of the threshold value that corresponds to the output type of the underlying SQL statement. For example, the following units are used in the system alert templates:Threshold unit System Alert Template #
Function count %
CPU utilization ''
Events lagging in one slony cluster days
A user expires in N days Hours
Last Vaccum Minutes
Number of minutes lag of replica server from primary server MB
Average table bloat in server NULL
Swap consumption STATE
Server down Note
NULL
type is only defined for a few system alert templates and cannot be defined for the custom alert templates.- You can also define any meaningful
Threshold unit
such as:No of leader ID's
forPGD Group Raft Leader ID not matching
No of worker error
forPGD worker error detected
Use fields in the
Auto create
box to indicate if PEM should use the template to generate an automatic alert. If enabled, PEM will automatically create an alert when a new server or agent (as specified by theTarget type
drop-down listbox) is added, and delete that alert when the target object is dropped.Move the
Auto create?
slider toYes
to indicate that PEM should automatically create alerts based on the template. If you modify an existing alert template, changing theAuto create?
slider fromNo
toYes
, PEM will create alerts on the existing agents and servers. Please note that if you change the slider fromYes
toNo
, the default threshold values in existing alerts will be erased, and cannot be recovered.Use the
Operator
drop-down listbox to select the operator that PEM will use when evaluating the current system values.Select a greater-than sign (>) to indicate that the alert should be triggered when the system values are greater than the values entered in the
Threshold values
fields.Select a less-than sign (<) to indicate that the alert should be triggered when the system values are less than the values entered in the
Threshold values
fields.Use the threshold fields to specify the values that PEM will compare to the system values to determine if an alert should be raised. Please note that you must specify values for all three thresholds (
Low
,Medium
, andHigh
):- Enter a value that will trigger a low-severity alert in the
Low
field. - Enter a value that will trigger a medium-severity alert in the
Medium
field. - Enter a value that will trigger a high-severity alert in the
High
field.
- Enter a value that will trigger a low-severity alert in the
Use the
Check frequency
field to specify the default number of minutes between alert executions. This value specifies how often the server will invoke the SQL code specified in the definition and compare the result to the threshold value specified in the template.
Use the fields on the Probe Dependency
tab to specify the names of probes referred to in the SQL query specified on the SQL
tab:
- Use the
Probes
drop-down listbox to select from a list of the available probes; highlight a probe name, and click theAdd
button to add the probe to the list of probes used by the alert template. To remove a probe from the selected probes list, highlight the probe name, and click theDelete
icon.
Use fields on the Parameters
tab to define the parameters that will be used in the SQL code specified on the SQL
tab. Click the Add
icon, and:
- Use the
Name
field to specify the parameter name. - Use the
Data type
drop-down listbox to select the type of parameter. - Use the
Unit
field to specify the type of unit specified by the parameter.
When you've defined a new parameter, click the Add/Change
button to save the definition and add the parameter to the parameter list.
To modify an existing parameter definition, highlight a parameter name in the list, modify the parameter values in the fields at the bottom of the tab, and click Add/Change
to preserve the changes. To remove one or more parameter definitions, highlight the parameter name(s) and click the Remove
button.
Use the Code
field on the SQL
tab to provide the text of the SQL query that the server will invoke when executing the alert. The SQL query will provide the result against which the threshold value is compared; if the alert result deviates from the specified threshold value, an alert will be raised.
Within the query, parameters defined on the Parameters
tab should be referenced (sequentially) by the variable param_x
, where x
indicates the position of the parameter definition within the parameter list. For example, param_1
refers to the first parameter in the parameter list, param_2 refers to the second parameter in the parameter list, and so on.
The query can also include the following pre-defined variables:
Variable Description | Variable Name |
---|---|
agent identifier | '${agent_id}' |
server identifier | '${server_id}' |
database name | '${database_name}' |
schema name | '${schema_name}' |
table, index, sequence or function name | '${object_name}' |
Please Note: If the specified query is dependent on one or more probes from different levels within the PEM hierarchy (server, database, schema, etc.), and a probe becomes disabled, any resulting alerts will be displayed as follows:
- If the alert definition and the probe referenced by the query are from the same level within the PEM hierarchy, the server will display any alerts that reference the alert template on the Alert Error table of the Global Alert Dashboard.
- If the alert definition and the probe referenced by the query are from different levels of the PEM hierarchy, the server will display any triggered alerts that reference the alert template on the Alert Details table of the hierarchy on which the Alert was defined.
Use the Detailed Information SQL
field to provide a SQL query that will be invoked if the alert is triggered. The result set of the query may be displayed as part of the detailed alert information on the Alerts
dashboard or Global Overview
dashboard.
After defining a new alert template, click the Add/Change
button to save the definition and add the template to the Alert Templates list
. Click Cancel
to exit the Alert Templates
dialog without saving changes.
After defining a template, you can use the Manage Alerts tab to create and enable an alert based on the template.
Exporting or Importing an Alert Template
From PEM 8.2 onwards, you can export or import the alert templates to another PEM Server.
To Export
the Alert Template, select any alert template from the Alert Templates
tab and then select the Export
icon in the upper-right corner of the table. Select Save File
option and then select ok
, it will generate the JSON
file.
To Import
the Alert Template, go to the Alert Templates
tab and then select the Import
icon in the upper-right corner.
Click on the Browse
button to select the JSON
file with the code to be imported and then click Import
.
After selecting the file to import, you can select the following checkboxes:
skip exiting
- If you select this checkbox then it will skip the alert template if it already exists.skip existing dependent probe
- The alert templates are dependent on probes. If you select this checkbox then it will skip the dependent probe if it already exists.
If both the checkboxes are selected and the alert template already exists, then it skips importing the alert template with below message:
If the skip existing
checkbox is not selected and skip dependent probe
is selected and the alert template already exists, then it will import the alert template successfully as below:
If both the checkboxes are not selected and the alert template does not exist, then it will successfully import the alert template as below:
Deleting an Alert Template
To delete an alert template, select the template name in the alert templates table, and click the Delete
icon (located to the upper-right corner of the table). The alert history will persist for the length of time specified on the History Retention
field in the template definition.