Custom Probe#

get_probe#

Code samples

#  You can also use wget

curl -X GET https://PEM-SERVER-IP/api/v14/probe/ \
  -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/v14/probe/, headers = headers)

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

fetch(https://PEM-SERVER-IP/api/v14/probe/,
{
  method: GET,

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

GET /probe/

Gets all the custom/system probes.

Parameters#

Name

In

Type

Required

Description

X-Auth-Token

header

string

true

Token of authorization

Example responses

[
  {
    "probe_id": 0,
    "probe_name": "string",
    "enabled": true,
    "target_type": 0,
    "internal_name": "string",
    "is_system_probe": true,
    "any_server_version": true,
    "collection_method": "w",
    "interval": 0,
    "lifetime": 0,
    "discard_history": true,
    "platform": "unix",
    "probe_code": "string",
    "probe_columns": [
      {
        "pc_id": 0,
        "pc_name": "string",
        "pc_data_type": "bigint",
        "pc_internal_name": "string",
        "pc_unit": "string",
        "pc_col_type": "m",
        "pc_position": 0,
        "pc_graphable": true,
        "pc_calc_pit": true,
        "pc_pit_default": true
      }
    ],
    "alternate_code": [
      {
        "server_version_id": 0,
        "server_probe_code": "string",
        "extension_version": 0
      }
    ]
  }
]

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

» probe_id

integer

false

none

Identifier for a probe

» probe_name

string

false

none

Name of the probe

» enabled

boolean

false

none

Determines whether the probe is enabled or 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>

» internal_name

string

false

none

Defines the internal name of the probe. The PEM system creates internal tables for storing probe statistics in the 'pemdata', and 'pemhistory' schema. The names of those tables are the same as the internal name.

» is_system_probe

boolean

false

none

Determines whether this probe is user-defined. This flag is always false for a user-defined probe.

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

» 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), or <b>900</b> (view), or <b>1000</b> (extension).</li></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

Determines whether to discard history data. When 'discard_history' is set to false, history of the data for this probe is not stored.

» 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 the definition of the code.

» probe_columns

[object]

false

none

none

»» pc_id

integer

false

none

Column identifier

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

string

false

none

Returns the internal name of the column.

»» pc_unit

string

false

none

Returns the unit of the column.

»» pc_col_type

string

false

none

Returns the column 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_position

integer

false

none

Returns the position of the column in the internal table.

»» 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 the point-in-time for metric data for this column.

»» pc_pit_default

boolean

false

none

Determines whether the metric is stored by point-in-time by default. Please refer to the 'Custom Probes' section in the documentation for detailed information.

» alternate_code

Query information ]

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

Enumerated Values#

Property

Value

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

post_probe#

Code samples

#  You can also use wget

curl -X POST https://PEM-SERVER-IP/api/v14/probe/ \
  -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/v14/probe/, headers = headers)

print(r.json())
const inputBody = {
  "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
    }
  ]
};
const headers = {
  Content-Type:application/json,
  X-Auth-Token:string
};

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

POST /probe/

Creates a new custom probe.

Body parameter

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

Parameters#

Name

In

Type

Required

Description

X-Auth-Token

header

string

true

Token of authorization

body

body

CustomProbePostData

true

none

Example responses

Responses#

Status

Meaning

Description

Schema

200

Invoking the server installer from the command line

Status 200

None

Response Schema#

Note

This operation does not require authentication

get_probe{probe_id}#

Code samples

#  You can also use wget

curl -X GET https://PEM-SERVER-IP/api/v14/probe/{probe_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/v14/probe/{probe_id}, headers = headers)

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

fetch(https://PEM-SERVER-IP/api/v14/probe/{probe_id},
{
  method: GET,

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

GET /probe/{probe_id}

Gets probe information for specified probe ID.

Parameters#

Name

In

Type

Required

Description

probe_id

path

integer

true

Probe ID for which probe information will be returned

X-Auth-Token

header

string

true

Token of authorization

Example responses

{
  "probe_id": 0,
  "probe_name": "string",
  "enabled": true,
  "target_type": 0,
  "internal_name": "string",
  "is_system_probe": true,
  "any_server_version": true,
  "collection_method": "w",
  "interval": 0,
  "lifetime": 0,
  "discard_history": true,
  "platform": "unix",
  "probe_code": "string",
  "probe_columns": [
    {
      "pc_id": 0,
      "pc_name": "string",
      "pc_data_type": "bigint",
      "pc_internal_name": "string",
      "pc_unit": "string",
      "pc_col_type": "m",
      "pc_position": 0,
      "pc_graphable": true,
      "pc_calc_pit": true,
      "pc_pit_default": true
    }
  ],
  "alternate_code": [
    {
      "server_version_id": 0,
      "server_probe_code": "string",
      "extension_version": 0
    }
  ]
}

Responses#

Status

Meaning

Description

Schema

200

Invoking the server installer from the command line

Successful response

CustomProbes

Note

This operation does not require authentication

put_probe{probe_id}#

Code samples

#  You can also use wget

curl -X PUT https://PEM-SERVER-IP/api/v14/probe/{probe_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/v14/probe/{probe_id}, headers = headers)

print(r.json())
const inputBody = {
  "interval_min": 0,
  "interval_sec": 0,
  "lifetime": 0,
  "enabled": true,
  "probe_code": "string",
  "probe_columns": {
    "changed": [
      {
        "pc_id": 0,
        "pc_unit": "string",
        "pc_graphable": true
      }
    ]
  },
  "alternate_code": {
    "changed": [
      {
        "server_version_id": 0,
        "server_probe_code": "string",
        "extension_version": 0
      }
    ],
    "deleted": [
      {
        "server_version_id": 0
      }
    ],
    "added": [
      {
        "server_version_id": 0,
        "server_probe_code": "string",
        "extension_version": 0
      }
    ]
  }
};
const headers = {
  Content-Type:application/json,
  X-Auth-Token:string
};

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

PUT /probe/{probe_id}

Updates custom/system probe information for specified probe ID.

Body parameter

{
  "interval_min": 0,
  "interval_sec": 0,
  "lifetime": 0,
  "enabled": true,
  "probe_code": "string",
  "probe_columns": {
    "changed": [
      {
        "pc_id": 0,
        "pc_unit": "string",
        "pc_graphable": true
      }
    ]
  },
  "alternate_code": {
    "changed": [
      {
        "server_version_id": 0,
        "server_probe_code": "string",
        "extension_version": 0
      }
    ],
    "deleted": [
      {
        "server_version_id": 0
      }
    ],
    "added": [
      {
        "server_version_id": 0,
        "server_probe_code": "string",
        "extension_version": 0
      }
    ]
  }
}

Parameters#

Name

In

Type

Required

Description

probe_id

path

integer

true

Probe ID for which probe information will be returned

X-Auth-Token

header

string

true

Token of authorization

body

body

CustomProbePutData

true

none

Example responses

Responses#

Status

Meaning

Description

Schema

200

Invoking the server installer from the command line

Status 200

None

Response Schema#

Note

This operation does not require authentication

delete_probe{probe_id}#

Code samples

#  You can also use wget

curl -X DELETE https://PEM-SERVER-IP/api/v14/probe/{probe_id} \
  -H X-Auth-Token: string
import requests
headers = {
  X-Auth-Token: string
}

r = requests.delete(https://PEM-SERVER-IP/api/v14/probe/{probe_id}, headers = headers)

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

fetch(https://PEM-SERVER-IP/api/v14/probe/{probe_id},
{
  method: DELETE,

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

DELETE /probe/{probe_id}

Deletes the custom probe.

Parameters#

Name

In

Type

Required

Description

probe_id

path

integer

true

Probe ID for which probe information will be returned

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#

Note

This operation does not require authentication