Device Performance API
  • 11 Jan 2023
  • 8 Minutes to read
  • Dark
    Light
  • PDF

Device Performance API

  • Dark
    Light
  • PDF

Article Summary

Netreo's API system must be enabled to use this API. See How to Enable Netreo API Access

Calls to this API are made using HTTP/HTTPS and must be sent as key/value pairs in a POST request.

For a tutorial on how to retrieve performance data using this API, see How to Retrieve Recorded Performance Data for a Device Using the Netreo APIs

Resource

The resource accessed by this API is device performance data.

This resource offers the following endpoints:

  • Device List
  • Performance Statistic Category ID List
  • Statistic Instance List
  • Performance Data

Resource URL

{your.netreo.ip.or.name}/fw/index.php?r=restful

Endpoints

Device List

POST
/devices/list
Returns a list of all managed devices along with some additional data about each device.

Parameters

The parameters for this endpoint must be included as request body parameters in a POST request.

password
String/Required if authentication is enabled.
The API key set in Netreo’s API Administration. Case-sensitive.

pin
String/Required when using Netreo SaaS-based APIs. Not applicable to on-premise deployments.
The pin number supplied in Netreo’s API Administration.

Request Examples

Curl using POST with API Authentication Disabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/list' \

Curl using POST with API Authentication Enabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/list' \
  -F password=pass123 \

Response

Supplying an incorrect password, or no password with API authentication enabled, will return an "Incorrect password" error.

A successful call to this API will return a standard JSON object array.

Note: The output will be returned as standard JSON without indentation or line breaks. It is formatted here to make the example easier to read.

Response Examples

Successful list retrieval.

[
    {
    "dev_index": 1,
    "name": "Storage-switch",
    "ip": "39.1.1.5",
    "description": "",
    "category": 18,
    "site": 3,
    "model": "",
    "poll": 1,
    "report": 1,
    "monitor": 1,
    "poll_intvl": 5,
    "template_persist": 1,
    "template": 0,
    "create_time": 1586830727,
    "snmp_version": null,
    "auto_config": 0
  },
  {
    "dev_index": 2,
    "name": "PA-2001",
    "ip": "39.1.1.67",
    "description": "",
    "category": 9,
    "site": 2,
    "model": "",
    "poll": 1,
    "report": 1,
    "monitor": 1,
    "poll_intvl": 5,
    "template_persist": 1,
    "template": 0,
    "create_time": 1586830728,
    "snmp_version": null,
    "auto_config": 0
  }
]

Response Schema

OutputTypeDescription
dev_indexstringNetreo's internal index number for the device.
namestringThe name of the device in Netreo.
ipstringThe device's IP address on the network.
descriptionstringThe device description as retrieved from the device.
categorystringThe Netreo internal index number of the category device group to which the device belongs.
sitestringThe Netreo internal index number of the site device group to which the device belongs.
modelstringThe device model as retrieved from the device.
pollstringIndicates whether or not Netreo is polling the device for statistical data.
0 = The device is not being polled.
1 = The device is being polled.
reportstringIndicates whether or not Netreo is including the device in reports.
0 = The device is not being included.
1 = The device is being included.
monitorstringIndicates whether or not Netreo is monitoring the device for availability on the network.
0 = The device is not being monitored.
1 = The device is being monitored.
poll_intvlstringIndicate the number of minutes between each statistical poll.
template_persiststringIndicates whether or not Netreo is automatically applying device template settings to the device.
0 = The device is not having device templates applied.
1 = The device is having device templates applied.
templatestringThe Netreo internal index number of the device template being applied at the device-level in the device template hierarchy.
create_timestringThe Unix timestamp of when the device was added to Netreo.
snmp_versionstringThe version of SNMP that Netreo is using to communicate with the device.
auto_configstringIndicates whether or not Netreo is applying autoconfiguration rules to the device.
0 = The device is not being autoconfigured.
1 = The device is being autoconfigured.

Performance Statistic Category ID List

POST
/devices/performance-category
Returns a list of Netreo performance statistics categories (CPU, disk, etc.) and IDs that are applicable to a specified device.

Parameters

The parameters for this endpoint must be included as request body parameters in a POST request.

password
String/Required if authentication is enabled.
The API key set in Netreo’s API Administration. Case-sensitive.

pin
String/Required when using Netreo SaaS-based APIs. Not applicable to on-premise deployments.
The pin number supplied in Netreo’s API Administration.

device_id
String/Required
The internal index number of the device for which to retrieve the available statistic categories. This number can be retrieved using the Device List endpoint above or any of the following Netreo APIs:

  • Category API
  • Device Management API
  • Site API
  • Strategic Group API

Request Examples

Curl using POST with API Authentication Disabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/performance-category' \
  -F device_id=3

Curl using POST with API Authentication Enabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/performance-category' \
  -F password=pass123 \
  -F device_id=3

Response

Supplying an incorrect password, or no password with API authentication enabled, will return an "Incorrect password" error.

A successful call to this API will return a standard JSON object array.

Note: The output will be returned as standard JSON without indentation or line breaks. It is formatted here to make the example easier to read.

Response Examples

Successful list retrieval.

[
    {
        "id": 1,
        "category": "CPU"
    },
    {
        "id": 9,
        "category": "Disk"
    },
    {
        "id": 5,
        "category": "Latency"
    },
    {
        "id": 2,
        "category": "Memory"
    },
    {
        "id": "interfaces",
        "cat": "Network"
    }
]

Response Schema

OutputTypeDescription
idstringThe Netreo internal identification for the performance statistic category returned below.
categorystringThe name of the performance statistic category as seen on the "Performance" tab of the device dashboard.

Statistic Instance List

POST
/devices/performance-instance-per-category
Retrieves the attributes for each instance of a performance statistic in a specified category for a specified device.

Parameters

The parameters for this endpoint must be included as request body parameters in a POST request.

password
String/Required if authentication is enabled.
The API key set in Netreo’s API Administration. Case-sensitive.

pin
String/Required when using Netreo SaaS-based APIs. Not applicable to on-premise deployments.
The pin number supplied in Netreo’s API Administration.

device_id
String/Required
The internal index number of the device for which to retrieve the available statistic instances. This number can be retrieved using the Device List endpoint above or any of the following Netreo APIs:

  • Category API
  • Device Management API
  • Site API
  • Strategic Group API

id
String/Required
The ID of a performance statistic category. This ID can be retrieved using the "Performance Statistic Category ID List" endpoint.

Request Examples

Curl using POST with API Authentication Disabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/performance-instance-per-category' \
  -F device_id=3 \
  -F id=9

Curl using POST with API Authentication Enabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/performance-instance-per-category' \
  -F password=pass123 \
  -F device_id=3 \
  -F id=9

Response

Supplying an incorrect password, or no password with API authentication enabled, will return an "Incorrect password" error.

A successful call to this API will return a standard JSON object array.

Note: The output will be returned as standard JSON without indentation or line breaks. It is formatted here to make the example easier to read.

Response Example

[
    {
        "key": "21117",
        "type": "oid_pertable",
        "index": "156",
        "title": "Hard Drive Usage",
        "unit": "B",
        "description": "/"
    },
    {
        "key": "21115",
        "type": "oid_pertable",
        "index": "156",
        "title": "Hard Drive Usage",
        "unit": "B",
        "description": "/dev/shm"
    },
    {
        "key": "21116",
        "type": "oid_pertable",
        "index": "156",
        "title": "Hard Drive Usage",
        "unit": "B",
        "description": "/boot"
    }
]

Response Schema

OutputTypeDescription
keystringThe Netreo internal identification number for this instance of the statistic.
type
stringThe type of poller collecting data for this instance.
indexstringThe Netreo internal index number of the poller collecting data for this instance.
titlestringThe name of the poller referenced in index.
unitstringThe unit value in which data from the poller referenced in index is stored.
(B = Bytes)
descriptionstringThe instance of the statistic for which the poller referenced in index is collecting data.

Performance Data

POST
/devices/data-per-instance
Retrieves performance data for all instances of the performance statistic and device specified in the parameters (last 24 hours if no quick_time is specified).

Parameters

The parameters for this endpoint must be included as request body parameters in a POST request.

password
String/Required if authentication is enabled.
The API key set in Netreo’s API Administration. Case-sensitive.

pin
String/Required when using Netreo SaaS-based APIs. Not applicable to on-premise deployments.
The pin number supplied in Netreo’s API Administration.

device_id
String/Required
The internal index number of the device from which to retrieve the statistic categories. This number can be retrieved using the Device List endpoint above or any of the following Netreo APIs:

  • Category API
  • Device Management API
  • Site API
  • Strategic Group API

key
String/Required
The ID of a performance statistic instance. This ID can be retrieved using the "Statistic Instance List" endpoint.

type
String/Required
The type of the poller collecting data for the performance statistic instance specified in key. The poller type for that instance can also be retrieved using the "Statistic Instance List" endpoint.

quick_time
String/Optional
The time frame for which to retrieve performance data. Options are: lasthour, last5, last15,  last24 today,  yesterday,  7dy,  thisweek,  lastweek,  thismonth,  lastmonth,  thisyear, last12months. If no time frame is specified, last24 is used.

Request Examples

Curl using POST with API Authentication Disabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/data-per-instance' \
  -F device_id=14 \
  -F type=oid_pertable \
  -F key=21117

Curl using POST with API Authentication Enabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/data-per-instance' \
  -F password=pass123 \
  -F device_id=14 \
  -F type=oid_pertable \
  -F key=21117

Response

Supplying an incorrect password, or no password with API authentication enabled, will return an "Incorrect password" error.

A successful call to this API will return a standard JSON object array.

Note: The output will be returned as standard JSON without indentation or line breaks. It is formatted here to make the example easier to read.

Response Examples

Successful list retrieval.

[
    {
        "name": "/",
        "legend": "Free Drive Space",
        "max": "16855834624.000000",
        "avg": "16855619007.668148",
        "current": "16855404817.066666",
        "data": [
            "1548253800,16855831970.702223",
            "1548254700,16855827988.480001",
            "1548255600,16855822336.000000",
            "1548256500,16855818331.022223",
            "1548257400,16855815623.111109",
            "1548258300,16855810266.453333",
            "1548259200,16855801974.328888",
            "1548260100,16855797760.000000",
            "1548261000,16855793745.920000",
            "1548261900,16855792380.586668",
            "1548262800,16855787083.093332",
            "1548263700,16855781376.000000",
            "1548264600,16855777366.471109",
            "1548265500,16855776023.893333",
            "1548266400,16855771900.586668",
            "1548267300,16855769088.000000",
            "1548268200,16855765083.022223",
            "1548269100,16855763699.484444",
            "1548270000,16855759617.137777",
            "1548270900,16855755507.484444",
            "1548271800,16855748758.186666",
            "1548272700,16855746013.866667",
            "1548273600,16855743233.137777",
            "1548274500,16855740416.000000",
            "1548275400,16855736397.368889",
            "1548276300,16855733757.724443",
            "1548277200,16855729570.702223",
            "1548278100,16855726844.586668",
            "1548279000,16855722753.137777",
            "1548279900,16855715921.920000",
            "1548280800,16855713223.111109",
            "1548281700,16855710519.751112",
            "1548282600,16855707648.000000",
            "1548283500,16855703647.573334",
            "1548284400,16855700916.906668",
            "1548285300,16855698186.240000",
            "1548286200,16855695360.000000",
            "1548287100,16855690071.608887",
            "1548288000,16855684523.804443",
            "1548288900,16855681784.035555",
            "1548289800,16855678976.000000",
            "1548290700,16855675039.288889",
            "1548291600,16855670879.573334",
            "1548292500,16855669496.035555",
            "1548293400,16855666688.000000",
            "1548294300,16855662678.471109",
            "1548295200,16855658687.146667",
            "1548296100,16855651751.253334",
            "1548297000,16855649052.444443",
            "1548297900,16855646208.000000",
            "1548298800,16855635713.137777",
            "1548299700,16855610053.973333",
            "1548300600,16855594525.582220",
            "1548301500,16855574455.182220",
            "1548302400,16855557679.786667",
            "1548303300,16855553547.377777",
            "1548304200,16855546638.791109",
            "1548305100,16855543808.000000",
            "1548306000,16855541163.804443",
            "1548306900,16855537081.457777",
            "1548307800,16855534359.893333",
            "1548308700,16855531520.000000",
            "1548309600,16855528907.662222",
            "1548310500,16855524793.457777",
            "1548311400,16855519432.248886",
            "1548312300,16855515136.000000",
            "1548313200,16855511144.675554",
            "1548314100,16855508404.906668",
            "1548315000,16855505651.484444",
            "1548315900,16855502848.000000",
            "1548316800,16855498833.920000",
            "1548317700,16855494747.022223",
            "1548318600,16855492066.417778",
            "1548319500,16855486650.595552",
            "1548320400,16855481093.688889",
            "1548321300,16855478272.000000",
            "1548322200,16855475641.457777",
            "1548323100,16855472892.586668",
            "1548324000,16855468792.035555",
            "1548324900,16855465984.000000",
            "1548325800,16855463348.906668",
            "1548326700,16855460618.240000",
            "1548327600,16855453909.902222",
            "1548328500,16855449600.000000",
            "1548329400,16855445608.675554",
            "1548330300,16855444216.035555",
            "1548331200,16855440133.688889",
            "1548332100,16855437312.000000",
            "1548333000,16855433320.675554",
            "1548333900,16855430571.804443",
            "1548334800,16855426503.111109",
            "1548335700,16855421119.146666",
            "1548336600,16855416832.000000",
            "1548337500,16855414187.804443",
            "1548338400,16855410123.662222",
            "1548339300,16855407365.688889"
        ]
    },
    {
        "name": "/",
        "legend": "Used Drive Space",
        "max": "1513991918.931968",
        "avg": "1513777728.331852",
        "current": "1513991918.933333",
        "data": [
            "1548253800,1513564765.297778",
            "1548254700,1513568747.520000",
            "1548255600,1513574400.000000",
            "1548256500,1513578404.977778",
            "1548257400,1513581112.888889",
            "1548258300,1513586469.546667",
            "1548259200,1513594761.671111",
            "1548260100,1513598976.000000",
            "1548261000,1513602990.080000",
            "1548261900,1513604355.413333",
            "1548262800,1513609652.906667",
            "1548263700,1513615360.000000",
            "1548264600,1513619369.528889",
            "1548265500,1513620712.106667",
            "1548266400,1513624835.413333",
            "1548267300,1513627648.000000",
            "1548268200,1513631652.977778",
            "1548269100,1513633036.515556",
            "1548270000,1513637118.862222",
            "1548270900,1513641228.515556",
            "1548271800,1513647977.813334",
            "1548272700,1513650722.133333",
            "1548273600,1513653502.862222",
            "1548274500,1513656320.000000",
            "1548275400,1513660338.631111",
            "1548276300,1513662978.275555",
            "1548277200,1513667165.297778",
            "1548278100,1513669891.413333",
            "1548279000,1513673982.862222",
            "1548279900,1513680814.080000",
            "1548280800,1513683512.888889",
            "1548281700,1513686216.248889",
            "1548282600,1513689088.000000",
            "1548283500,1513693088.426666",
            "1548284400,1513695819.093333",
            "1548285300,1513698549.760000",
            "1548286200,1513701376.000000",
            "1548287100,1513706664.391111",
            "1548288000,1513712212.195555",
            "1548288900,1513714951.964444",
            "1548289800,1513717760.000000",
            "1548290700,1513721696.711111",
            "1548291600,1513725856.426667",
            "1548292500,1513727239.964444",
            "1548293400,1513730048.000000",
            "1548294300,1513734057.528889",
            "1548295200,1513738048.853333",
            "1548296100,1513744984.746667",
            "1548297000,1513747683.555555",
            "1548297900,1513750528.000000",
            "1548298800,1513761022.862222",
            "1548299700,1513786682.026667",
            "1548300600,1513802210.417777",
            "1548301500,1513822280.817778",
            "1548302400,1513839056.213333",
            "1548303300,1513843188.622222",
            "1548304200,1513850097.208889",
            "1548305100,1513852928.000000",
            "1548306000,1513855572.195555",
            "1548306900,1513859654.542222",
            "1548307800,1513862376.106667",
            "1548308700,1513865216.000000",
            "1548309600,1513867828.337778",
            "1548310500,1513871942.542222",
            "1548311400,1513877303.751111",
            "1548312300,1513881600.000000",
            "1548313200,1513885591.324445",
            "1548314100,1513888331.093333",
            "1548315000,1513891084.515556",
            "1548315900,1513893888.000000",
            "1548316800,1513897902.080000",
            "1548317700,1513901988.977778",
            "1548318600,1513904669.582222",
            "1548319500,1513910085.404444",
            "1548320400,1513915642.311111",
            "1548321300,1513918464.000000",
            "1548322200,1513921094.542222",
            "1548323100,1513923843.413333",
            "1548324000,1513927943.964444",
            "1548324900,1513930752.000000",
            "1548325800,1513933387.093333",
            "1548326700,1513936117.760000",
            "1548327600,1513942826.097778",
            "1548328500,1513947136.000000",
            "1548329400,1513951127.324445",
            "1548330300,1513952519.964444",
            "1548331200,1513956602.311111",
            "1548332100,1513959424.000000",
            "1548333000,1513963415.324445",
            "1548333900,1513966164.195555",
            "1548334800,1513970232.888889",
            "1548335700,1513975616.853333",
            "1548336600,1513979904.000000",
            "1548337500,1513982548.195555",
            "1548338400,1513986612.337778",
            "1548339300,1513989370.311111"
        ]
    }
]

Response Schema

OutputTypeDescription
namestringThe name of the instance from which the performance data is being collected.
legend
stringThe name of the performance statistic sub-category displayed in Netreo, as seen on the "Performance" tab of the device dashboard.
maxnumberThe peak value of the performance statistic recorded within the previous 24 hours.
avgnumberThe average value of the performance statistic recorded within the previous 24 hours.
currentnumberThe current value of the performance statistic at the time of retrieval by the API.
datanumber arrayThe collected data values for the specified quick_time parameter. The first number is the timestamp of when the data value was recorded, the second number is the raw value.

Was this article helpful?