Export Custom Alert Templates#
post_alert_custom_export#
Code samples
# You can also use wget
curl -X POST https://PEM-SERVER-IP/api/v14/alert/custom/export/ \
-H Content-Type: application/json \
-H Accept: application/json \
-H X-Auth-Token: string
import requests
headers = {
Content-Type: application/json,
Accept: application/json,
X-Auth-Token: string
}
r = requests.post(https://PEM-SERVER-IP/api/v14/alert/custom/export/, headers = headers)
print(r.json())
const inputBody = {
"alert_templates": [
0
]
};
const headers = {
Content-Type:application/json,
Accept:application/json,
X-Auth-Token:string
};
fetch(https://PEM-SERVER-IP/api/v14/alert/custom/export/,
{
method: POST,
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /alert/custom/export/
Exports custom alert templates.
Body parameter
{
"alert_templates": [
0
]
}
Parameters#
Name |
In |
Type |
Required |
Description |
|---|---|---|---|---|
X-Auth-Token |
header |
string |
true |
Token of authorization |
body |
body |
true |
none |
Example responses
{
"version": 0,
"items": [
{
"version": 1,
"alert_templates": [
{
"name": "string",
"description": "string",
"reference_id": "string",
"default_history_retention": 0,
"object_type": 0,
"sql": "string",
"applicable_on_server": "ALL",
"default_check_frequency": 0,
"threshold_unit": "string",
"is_system_template": true,
"is_auto_create": true,
"thresholds": [
0
],
"operator": ">",
"high_threshold_value": "string",
"medium_threshold_value": "string",
"low_threshold_value": "string",
"info_sql": "string",
"probes": [
{
"probe_name": "string",
"collection_method": "w",
"enabled": true,
"target_type": 0,
"any_server_version": true,
"any_extension_version": true,
"extension_name": "string",
"interval": 0,
"lifetime": 0,
"discard_history": true,
"platform": "unix",
"probe_code": "string",
"probe_columns": [
{
"pc_name": "string",
"pc_data_type": "bigint",
"pc_unit": "string",
"pc_col_type": "m",
"pc_graphable": true,
"pc_calc_pit": true,
"pc_pit_default": true
}
],
"alternate_code": [
{
"server_version_id": 0,
"server_probe_code": "string",
"extension_version": 0
}
],
"internal_name": "string"
}
]
}
]
}
]
}
Responses#
Status |
Meaning |
Description |
Schema |
|---|---|---|---|
200 |
Successful response |
Inline |
Response Schema#
Status Code 200
Name |
Type |
Required |
Restrictions |
Description |
|---|---|---|---|---|
» version |
integer |
false |
none |
Export version id |
» items |
false |
none |
none |
|
»» version |
integer |
false |
none |
Version of the alert template export |
»» alert_templates |
false |
none |
none |
|
»»» name |
string |
false |
none |
Name of the alert template. NOTE: This property is a mandatory parameter for a POST request. |
»»» description |
string |
false |
none |
Description of the alert template. NOTE: This property is a mandatory parameter for a POST request. |
»»» reference_id |
string |
false |
none |
Internal identifier for the alert template |
»»» default_history_retention |
integer |
false |
none |
Defines the history retention period in days for this type of alerts. NOTE: This property is a mandatory parameter for a POST request. |
»»» object_type |
integer |
false |
none |
Defines the type of the object to which this alert template applies. <ul><li>A system-wide alert template is <b>50</b>.</li><li>An alert template applicable to an agent is <b>100</b>.</li><li>An alert template applicable to a managed server is <b>200</b>.</li><li>An alert template applicable to a database for a particular monitored server is <b>300</b>.</li><li>An alert template applicable to a schema on a particular database for the managed server is <b>400</b>.</li><li>An alert template applicable to a table on a particular schema for the database on a monitored server is <b>500</b>.</li><li>An alert template applicable to an index on a particular schema for the database on a monitored server is <b>600</b>.</li><li>An alert template applicable to a sequence on a particular schema for the database on a monitored server is <b>700</b>.</li><li>An alert template applicable to a function on a particular schema for the database on a monitored server is <b>800</b>.</li></ul>NOTE: This property is a mandatory parameter for a POST request. |
»»» sql |
string |
false |
none |
SQL query, possibly parameterized, to get a numeric value indicating the threshold reached. NOTE: This property is a mandatory parameter for a POST request. |
»»» applicable_on_server |
string |
false |
none |
Specifies the type of monitored server to which the template applies. Possible values are ALL, POSTGRES_SERVER, ADVANCED_SERVER. NOTE: This property is a mandatory parameter for a POST request. |
»»» default_check_frequency |
integer |
false |
none |
Specifies how frequently (in minutes) to check for the alert that this template defines. NOTE: This property is a mandatory parameter for a POST request. |
»»» threshold_unit |
string |
false |
none |
Units used to calculate the threshold, such as MB/kB/seconds/days/... This value is only used for the GUI. |
»»» is_system_template |
boolean |
false |
none |
Determines whether the given template is system-defined or user-defined. NOTE: This property is not applicable for POST/PUT requests. |
»»» is_auto_create |
boolean |
false |
none |
Determines whether an alert should be created as soon as an agent or server is added to PEM.. |
»»» thresholds |
[number] |
false |
none |
Default threshold values. Values in the thresholds array must be in a sorted order based on the operator. |
»»» operator |
string |
false |
none |
Operator to compare threshold values |
»»» high_threshold_value |
string |
false |
none |
High threshold value |
»»» medium_threshold_value |
string |
false |
none |
Medium threshold value |
»»» low_threshold_value |
string |
false |
none |
Low threshold value |
»»» info_sql |
string |
false |
none |
Defines the SQL query that provides detailed information about the alert on the dashboard. |
»»» probes |
[allOf] |
false |
none |
none |
allOf*
Name |
Type |
Required |
Restrictions |
Description |
|---|---|---|---|---|
»»»» anonymous |
false |
none |
none |
|
»»»»» probe_name |
string |
false |
none |
Name of the probe |
»»»»» collection_method |
string |
false |
none |
Defines the method of statistics collection. PEM supports three methods for custom made probes: SQL, WMI, or batch/shell script. <ul><li>'w' stands for WMI script. This type of script only applies to the Windows platform, and the target_type is <b>100</b> (for agent).</li><li>'b' stands for batch/shell script. The 'target_type' for this script is always <b>100</b> (agent). This script behaves as a batch script on Windows and a shell script on other platforms.</li><li>'s' stands for SQL script. The 'target_type' is always <b>200</b> (server), <b>300</b> (database), <b>400</b> (schema), <b>500</b> (table), <b>600</b> (index), <b>700</b> (sequence), <b>800</b> (function), <b>900</b> (view) or <b>1000</b> (extension).</li></ul> |
»»»»» enabled |
boolean |
false |
none |
Determines whether whether the probe is enabled/disabled by default. |
»»»»» target_type |
integer |
false |
none |
Defines the type of the object to which the probe applies. <ul><li>A probe with target_type <b>100</b> is responsible for collecting statistics for an agent.</li><li>A probe with target_type <b>200</b> is responsible for collecting statistics for a monitored server.</li><li>A probe with target_type <b>300</b> is responsible for collecting statistics for a database.</li><li>A probe with target_type <b>400</b> is responsible for collecting statistics for a schema.</li><li>A probe with target_type <b>500</b> is responsible for collecting statistics for a table.</li><li>A probe with target_type <b>600</b> is responsible for collecting statistics for a index.</li><li>A probe with target_type <b>700</b> is responsible for collecting statistics for a sequence.</li><li>A probe with target_type <b>800</b> is responsible for collecting statistics for a function.</li><li>A probe with target_type <b>900</b> is responsible for collecting statistics for a view.</li><li>A probe with target_type <b>1000</b> is responsible for collecting statistics for a extension.</li></ul> |
»»»»» any_server_version |
boolean |
false |
none |
Determines whether this probe applies to any version of a Postgres variant. For more details, please consult the documentation. |
»»»»» any_extension_version |
boolean |
false |
none |
Determines whether this probe applies to any version of a Extension variant. For more details, please consult the documentation. |
»»»»» extension_name |
string |
false |
none |
Name of the extension.<ul>Valid names are <b>edbspl</b> , <b>plpgsql</b> , <b>hstore</b> , <b>pldbgapi</b> , <b>edb_dblink_oci</b> , <b>edb_dblink_libpq</b> , <b>sslutils</b> .</ul> |
»»»»» interval |
integer |
false |
none |
Defines how frequently the probe collects statistics (in seconds).Must be greater than or equal to 10 |
»»»»» lifetime |
integer |
false |
none |
Defines the history data retention time (in days). Valid range is 1-365. This value does not have any effect if 'discard_history' is set to true. |
»»»»» discard_history |
boolean |
false |
none |
Defines whether to discard history data. When 'discard_history' is set to false, no history data is stored for this probe. |
»»»»» platform |
string |
false |
none |
Defines the platform where this probe can run. This value only applies to an agent-level probe. |
»»»»» probe_code |
string |
false |
none |
A <b>SQL/Batch script/Shell script/WMI script</b> to collect the statistics as per definition of the code. |
»»»»» probe_columns |
[object] |
false |
none |
none |
»»»»»» pc_name |
string |
false |
none |
Column name |
»»»»»» pc_data_type |
string |
false |
none |
Data type of the column. Supported datatypes are:<ul><ul>bigint</ul><ul>char</ul><ul>decimal</ul><ul>double precision</ul><ul>integer</ul><ul>numeric</ul><ul>real</ul><ul>text</ul><ul>text[]</ul><ul>timestamp</ul><ul>timestamptz</ul></ul> |
»»»»»» pc_unit |
string |
false |
none |
Returns the unit of the column. |
»»»»»» pc_col_type |
string |
false |
none |
Returns the columns as part of the primary key of the internal table, or not. 'k' stands for a key column, and 'm' stands for a member/normal column. |
»»»»»» pc_graphable |
boolean |
false |
none |
Determines whether the data of the column can be graphed on a chart. |
»»»»»» pc_calc_pit |
boolean |
false |
none |
Determines whether the server calculates point-in-time for metric data for this column. |
»»»»»» pc_pit_default |
boolean |
false |
none |
Determines whether metric data is stored by point-in-time by default. Please refer to the 'Custom Probes' section in the documentation for detailed information. |
»»»»» alternate_code |
false |
none |
none |
|
»»»»»» server_version_id |
integer |
false |
none |
Server version ID for the monitored server |
»»»»»» server_probe_code |
string |
false |
none |
SQL query to run on the specified server version |
»»»»»» extension_version |
integer |
false |
none |
Specifies the extension version. Valid for extension target type |
and*
Name |
Type |
Required |
Restrictions |
Description |
|---|---|---|---|---|
»»»» anonymous |
object |
false |
none |
none |
»»»»» internal_name |
string |
false |
none |
Internal name of the probe from the system where probe was exported |
Enumerated Values#
Property |
Value |
|---|---|
applicable_on_server |
ALL |
applicable_on_server |
POSTGRES_SERVER |
applicable_on_server |
ADVANCED_SERVER |
operator |
> |
operator |
< |
collection_method |
w |
collection_method |
b |
collection_method |
s |
platform |
unix |
platform |
windows |
pc_data_type |
bigint |
pc_data_type |
char |
pc_data_type |
decimal |
pc_data_type |
double precision |
pc_data_type |
integer |
pc_data_type |
numeric |
pc_data_type |
real |
pc_data_type |
text |
pc_data_type |
text[] |
pc_data_type |
timestamp |
pc_data_type |
timestamptz |
pc_col_type |
m |
pc_col_type |
k |
Note
This operation does not require authentication