Alert template
==============

get\_\ *alert_template*
-----------------------

**Code samples**

.. code:: shell


   #  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

.. code:: python

   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())

.. code:: javascript


   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
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 11,7,7,7,17
  :align: left
  :class: longtable

  X-Auth-Token,header,string,true,Token of authorization

**Example responses**

.. raw:: html

   <Details summary="200 Response">

.. code:: json

   [
     {
       "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"
     }
   ]

.. raw:: html

   </Details>

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Successful response,Inline

Response Schema
^^^^^^^^^^^^^^^

Status Code **200**

.. csv-table::
  :header: Name,Type,Required,Restrictions,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  *anonymous*,\ :ref:`Query information <Schemas>` ],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
'''''''''''''''''

.. csv-table::
  :header: Property,Value
  :widths: 25,25
  :align: left
  :class: longtable

  applicable_on_server,ALL
  applicable_on_server,POSTGRES_SERVER
  applicable_on_server,ADVANCED_SERVER
  operator,>
  operator,&lt;

..  info::
   This operation does not require authentication

post\_\ *alert_template*
------------------------

**Code samples**

.. code:: shell


   #  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

.. code:: python

   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())

.. code:: javascript

   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**

.. code:: json

   {
     "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-1:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 11,7,7,7,17
  :align: left
  :class: longtable

  X-Auth-Token,header,string,true,Token of authorization
  body,body,:ref:`AlertTemplatePost<AlertTemplatePost>` ,true,none

**Example responses**

.. _responses-1:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Status 200,None

.. _response-schema-1:

Response Schema
^^^^^^^^^^^^^^^

..  info::
   This operation does not require authentication

get\_\ *alert_template*\ {id}
-----------------------------

**Code samples**

.. code:: shell


   #  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

.. code:: python

   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())

.. code:: javascript


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

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 11,7,7,7,17
  :align: left
  :class: longtable

  id,path,integer,true,Alert template ID
  X-Auth-Token,header,string,true,Token of authorization

**Example responses**

.. raw:: html

   <Details summary="200 Response">

.. code:: json

   {
     "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"
   }

.. raw:: html

   </Details>

.. _responses-2:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Successful response,:ref:`AlertTemplateParams<AlertTemplateParams>` 

..  info::
   This operation does not require authentication

put\_\ *alert_template*\ {id}
-----------------------------

**Code samples**

.. code:: shell


   #  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

.. code:: python

   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())

.. code:: javascript

   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**

.. code:: json

   {
     "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-3:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 11,7,7,7,17
  :align: left
  :class: longtable

  id,path,integer,true,Alert template ID
  X-Auth-Token,header,string,true,Token of authorization
  body,body,:ref:`AlertTemplatePut<AlertTemplatePut>` ,true,none

**Example responses**

.. _responses-3:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Status 200,None

.. _response-schema-2:

Response Schema
^^^^^^^^^^^^^^^

..  info::
   This operation does not require authentication

delete\_\ *alert_template*\ {id}
--------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

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

.. code:: python

   import requests
   headers = {
     X-Auth-Token: string
   }

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

   print(r.json())

.. code:: javascript


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

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 11,7,7,7,17
  :align: left
  :class: longtable

  id,path,integer,true,Alert template ID
  X-Auth-Token,header,string,true,Token of authorization

**Example responses**

.. _responses-4:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Successful deletion,None

.. _response-schema-3:

Response Schema
^^^^^^^^^^^^^^^

..  info::
   This operation does not require authentication
