Getting information about agents using the REST API

Instructions and examples in this document use an IP address that is reserved for documentation, 192.0.2.5, as an example of the IP address for the switch. To access your switch, you must use the IP address or hostname of that switch.

Prerequisites

You must be logged in to the switch REST API.

Procedure
  • To get detailed information about a specific agent, use the GET method on the URI of the agent.

    This example gets information about the agent named com.myco.bgp_mon.Agent1:

    GET https://192.0.2.5/rest/v1/system/nae_scripts/com.myco.bgp_mon/nae_agents/com.myco.bgp_mon.Agent1

    The following response is an example of an agent that has an error:

    {
        "name": "com.myco.bgp_mon.Agent1",
        "disabled":false,
        "parameters_values":{
                 "threshold":"10"
         }
        "status": {
         "error_at": "1490134092",
         "error_description": "The URI is invalid or not supported",
         "executed_at": "1490134092",
    }
    
  • To get a list of the agents of a specific script, use the GET method on the URI of the nae_agents collection of the script.

    This example gets a list of the agents of the script com.myco.bgp_mon:

    GET https://192.0.2.5/rest/v1/system/nae_scripts/com.myco.bgp_mon/nae_agents

    The following is an example of a response for a script, port_admin_state_monitor, that has multiple agents:

    [ 
    	"/rest/v1/system/nae_scripts/port_admin_state_monitor/nae_agents/port-1_1_1",
    	"/rest/v1/system/nae_scripts/port_admin_state_monitor/nae_agents/port-1_1_2"
    ]
  • To get detailed information about all the agents on the switch, use the GET method and use wildcards for the script name and agent name:

    For example:

    GET https://192.0.2.5/rest/v1/system/nae_scripts/*/nae_agents/*