Alert template#

get_alert_template#

Code samples

#  You can also use wget

curl -X GET https://PEM-SERVER-IP/api/v15/alert/template/ \
  -H Accept: application/json \
  -H X-Auth-Token: string
import requests
headers = {
  Accept: application/json,
  X-Auth-Token: string
}

r = requests.get(https://PEM-SERVER-IP/api/v15/alert/template/, headers = headers)

print(r.json())
const headers = {
  Accept:application/json,
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v15/alert/template/,
{
  method: GET,

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /alert/template/

Gets Alert templates.

Parameters#

Name

In

Type

Required

Description

X-Auth-Token

header

string

true

Token of authorization

Example responses

[
  {
    "name": "string",
    "description": "string",
    "object_type": 0,
    "param_names": [
      "string"
    ],
    "param_types": "string",
    "params_units": [
      "string"
    ],
    "sql": "string",
    "applicable_on_server": "ALL",
    "default_check_frequency": 0,
    "default_history_retention": 0,
    "probe_dependency_list": [
      "string"
    ],
    "threshold_unit": "string",
    "is_system_template": false,
    "is_auto_create": true,
    "operator": ">",
    "low_threshold_value": 0,
    "medium_threshold_value": 0,
    "high_threshold_value": 0,
    "info_sql": "string"
  }
]

Responses#

Status

Meaning

Description

Schema

200

Invoking the server installer from the command line

Successful response

Inline

Response Schema#

Status Code 200

Name

Type

Required

Restrictions

Description

anonymous

Query information ]

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.

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

» param_names

[string]

false

none

Defines the name of parameters.

» param_types

string

false

none

Defines the type of parameters. Example: INTEGER/STRING..

» params_units

[string]

false

none

Defines the unit used for parameters.Example: 'DAYS','True or False','Hours','Minutes' etc

» sql

string

false

none

SQL query, possibly parameterized, to get a numeric value indicating 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, and ADVANCED_SERVER. NOTE: This property is a mandatory parameter for a POST request.

» default_check_frequency

integer

false

none

Defines how frequently (in minutes) to check for the alert defined in this template. NOTE: This property is a mandatory parameter for a POST request.

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

» probe_dependency_list

[string]

false

none

Defines the list of probes on which alert template is dependent.

» 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.Note: Only supported for Agent and Server level i.e object_type 100 and 200 respectively.

» operator

string

false

none

Operator to compare threshold values.Only supported for Agent and Server level i.e object_type 100 and 200 respectively.

» low_threshold_value

number

false

none

Low threshold value.Only supported for Agent and Server level i.e object_type 100 and 200 respectively.

» medium_threshold_value

number

false

none

Medium threshold value.Only supported for Agent and Server level i.e object_type 100 and 200 respectively.

» high_threshold_value

number

false

none

High threshold value.Only supported for Agent and Server level i.e object_type 100 and 200 respectively.

» info_sql

string

false

none

Specifies the SQL query that provides detailed information about the alert on the dashboard.

Enumerated Values#

Property

Value

applicable_on_server

ALL

applicable_on_server

POSTGRES_SERVER

applicable_on_server

ADVANCED_SERVER

operator

>

operator

&lt;

post_alert_template#

Code samples

#  You can also use wget

curl -X POST https://PEM-SERVER-IP/api/v15/alert/template/ \
  -H Content-Type: application/json \
  -H X-Auth-Token: string
import requests
headers = {
  Content-Type: application/json,
  X-Auth-Token: string
}

r = requests.post(https://PEM-SERVER-IP/api/v15/alert/template/, headers = headers)

print(r.json())
const inputBody = {
  "name": "string",
  "description": "string",
  "object_type": 0,
  "params": [
    {
      "param_types": "STRING",
      "param_units": "KK",
      "param_names": "param_1"
    }
  ],
  "sql": "string",
  "applicable_on_server": "ALL",
  "default_check_frequency": 0,
  "default_history_retention": 0,
  "probe_dependency_list": [
    {
      "internal_name": "probe_name"
    }
  ],
  "threshold_unit": "string",
  "is_system_template": false,
  "is_auto_create": true,
  "operator": ">",
  "low_threshold_value": 0,
  "medium_threshold_value": 0,
  "high_threshold_value": 0,
  "info_sql": "string"
};
const headers = {
  Content-Type:application/json,
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v15/alert/template/,
{
  method: POST,
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /alert/template/

Creates alert template.

Body parameter

{
  "name": "string",
  "description": "string",
  "object_type": 0,
  "params": [
    {
      "param_types": "STRING",
      "param_units": "KK",
      "param_names": "param_1"
    }
  ],
  "sql": "string",
  "applicable_on_server": "ALL",
  "default_check_frequency": 0,
  "default_history_retention": 0,
  "probe_dependency_list": [
    {
      "internal_name": "probe_name"
    }
  ],
  "threshold_unit": "string",
  "is_system_template": false,
  "is_auto_create": true,
  "operator": ">",
  "low_threshold_value": 0,
  "medium_threshold_value": 0,
  "high_threshold_value": 0,
  "info_sql": "string"
}

Parameters#

Name

In

Type

Required

Description

X-Auth-Token

header

string

true

Token of authorization

body

body

AlertTemplatePost

true

none

Example responses

Responses#

Status

Meaning

Description

Schema

200

Invoking the server installer from the command line

Status 200

None

Response Schema#

get_alert_template{id}#

Code samples

#  You can also use wget

curl -X GET https://PEM-SERVER-IP/api/v15/alert/template/{id} \
  -H Accept: application/json \
  -H X-Auth-Token: string
import requests
headers = {
  Accept: application/json,
  X-Auth-Token: string
}

r = requests.get(https://PEM-SERVER-IP/api/v15/alert/template/{id}, headers = headers)

print(r.json())
const headers = {
  Accept:application/json,
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v15/alert/template/{id},
{
  method: GET,

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /alert/template/{id}

Gets alert template identified by the ID.

Parameters#

Name

In

Type

Required

Description

id

path

integer

true

Alert template ID

X-Auth-Token

header

string

true

Token of authorization

Example responses

{
  "name": "string",
  "description": "string",
  "object_type": 0,
  "param_names": [
    "string"
  ],
  "param_types": "string",
  "params_units": [
    "string"
  ],
  "sql": "string",
  "applicable_on_server": "ALL",
  "default_check_frequency": 0,
  "default_history_retention": 0,
  "probe_dependency_list": [
    "string"
  ],
  "threshold_unit": "string",
  "is_system_template": false,
  "is_auto_create": true,
  "operator": ">",
  "low_threshold_value": 0,
  "medium_threshold_value": 0,
  "high_threshold_value": 0,
  "info_sql": "string"
}

Responses#

Status

Meaning

Description

Schema

200

Invoking the server installer from the command line

Successful response

AlertTemplateParams

put_alert_template{id}#

Code samples

#  You can also use wget

curl -X PUT https://PEM-SERVER-IP/api/v15/alert/template/{id} \
  -H Content-Type: application/json \
  -H X-Auth-Token: string
import requests
headers = {
  Content-Type: application/json,
  X-Auth-Token: string
}

r = requests.put(https://PEM-SERVER-IP/api/v15/alert/template/{id}, headers = headers)

print(r.json())
const inputBody = {
  "name": "string",
  "description": "string",
  "sql": "string",
  "applicable_on_server": "ALL",
  "default_check_frequency": 0,
  "default_history_retention": 0,
  "probe_dependency_list": {
    "deleted": [
      {
        "internal_name": "probe_name"
      }
    ],
    "added": [
      {
        "internal_name": "probe_name"
      }
    ]
  },
  "threshold_unit": "string",
  "is_system_template": false,
  "info_sql": "string"
};
const headers = {
  Content-Type:application/json,
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v15/alert/template/{id},
{
  method: PUT,
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

PUT /alert/template/{id}

Updates alert template.

Body parameter

{
  "name": "string",
  "description": "string",
  "sql": "string",
  "applicable_on_server": "ALL",
  "default_check_frequency": 0,
  "default_history_retention": 0,
  "probe_dependency_list": {
    "deleted": [
      {
        "internal_name": "probe_name"
      }
    ],
    "added": [
      {
        "internal_name": "probe_name"
      }
    ]
  },
  "threshold_unit": "string",
  "is_system_template": false,
  "info_sql": "string"
}

Parameters#

Name

In

Type

Required

Description

id

path

integer

true

Alert template ID

X-Auth-Token

header

string

true

Token of authorization

body

body

AlertTemplatePut

true

none

Example responses

Responses#

Status

Meaning

Description

Schema

200

Invoking the server installer from the command line

Status 200

None

Response Schema#

delete_alert_template{id}#

Code samples

#  You can also use wget

curl -X DELETE https://PEM-SERVER-IP/api/v15/alert/template/{id} \
  -H X-Auth-Token: string
import requests
headers = {
  X-Auth-Token: string
}

r = requests.delete(https://PEM-SERVER-IP/api/v15/alert/template/{id}, headers = headers)

print(r.json())
const headers = {
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v15/alert/template/{id},
{
  method: DELETE,

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

DELETE /alert/template/{id}

Deletes the alert template.

Parameters#

Name

In

Type

Required

Description

id

path

integer

true

Alert template ID

X-Auth-Token

header

string

true

Token of authorization

Example responses

Responses#

Status

Meaning

Description

Schema

200

Invoking the server installer from the command line

Successful deletion

None

Response Schema#