Device Service Checks API
  • 01 Oct 2024
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Device Service Checks 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.

Resource

The resource accessed by this API is a specific managed device's current list of service checks and their associated data.

This resource offers the following endpoints:

  • Service Check List

Resource URL

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

Endpoints

Service Check List

POST
/devices/services
Retrieves a list of service checks and their associated information for the device specified in the parameters.

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.

dev_name
String/Required
The name of the managed device (as it appears in the Netreo UI) for which you wish to retrieve the list of service checks.

Request Examples

Curl using POST with API Authentication Disabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/services' \
  -F dev_name=Dallas-S1.dallass1.netreo.net

Curl using POST with API Authentication Enabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/devices/services' \
  -F password=pass123 \
  -F dev_name=Dallas-S1.dallass1.netreo.net

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.

[
    {
        "service_id": 47,
        "state": "OK",
        "duration": "2017-12-08 14:25:10",
        "name": "Authentication",
        "description": "OK",
	"enabled": "True"
    },
    {
        "service_id": 362,
        "state": "OK",
        "duration": "2018-05-30 01:15:11",
        "name": "Check Interface Status on FastEthernet1/0/14",
        "description": "Interface 10014 is UP.",
	"enabled": "True"
    },
    {
        "service_id": 437,
        "state": "OK",
        "duration": "2018-12-11 09:00:20",
        "name": "Check Interface Status on FastEthernet1/0/24",
        "description": "Interface 10024 is UP.",
	"enabled": "True"
    },
    {
        "service_id": 361,
        "state": "OK",
        "duration": "2018-05-30 01:15:10",
        "name": "Check Interface Status on Vlan1",
        "description": "Interface 1 is UP.",
	"enabled": "True"
    },
    {
        "service_id": 52,
        "state": "OK",
        "duration": "2018-11-08 11:10:40",
        "name": "Cisco Hardware Check",
        "description": "No alarms.\n",
	"enabled": "True"
    },
    {
        "service_id": 51,
        "state": "CRITICAL",
        "duration": "2018-12-10 15:14:00",
        "name": "Configuration Save Check",
        "description": "CRITICAL: Configuration has been changed but not saved!\n\n",
	"enabled": "True"
    },
    {
        "service_id": 48,
        "state": "OK",
        "duration": "2018-11-21 14:25:30",
        "name": "Device Polling Status",
        "description": "Polling successful.",
	"enabled": "True"
    },
    {
        "service_id": 49,
        "state": "OK",
        "duration": "2019-01-23 13:46:40",
        "name": "PING",
        "description": "Ping OK: Packet Loss 0% | RTA = 2.045 ms",
	"enabled": "True"
    }
]

Response Schema

OutputTypeDescription
service_idstringThe Netreo internal ID for the service check.
statestringThe current alarm status of the service check.
durationstringThe check has been in the state specified above since this timestamp.
namestringThe name of the service service check as supplied in its "DESCRIPTION" configuration field.
descriptionstringThe output of the service check for the state returned above, as seen in the SERVICES STATE HISTORY on the "Services" tab of the device dashboard.
enabledstringThe enabled state of the service check. Either True or False. Disabled service checks do not execute.

Was this article helpful?

What's Next