In a script, a monitor defines what resource the agent will monitor when the agent is enabled on a switch.

There is no rule that limits how many monitors can be specified in a single script. However the total number of scripts, agents, and monitors supported depends on the computing capacity of the switch.

A resource is any concept (received packets on a particular interface, user, CPU utilization, and so forth) that can be addressed and referenced using a URI.

The URI of a monitored resource is composed of several components, including the host name or host IP address, the path, and the query string that specifies the attribute to monitor.

In a Python NAE script, when you specify the URI of local switch resource to monitor, omit the server URL portion of the URI. Specify only the path and query string portion of the URI.

For example:

cpu_uri = '/rest/v1/system/daemons/{}?' \

If the switch is a VSX switch, you can specify the peer switch by prepending /vsx-peer to the path portion of the URI.

For example:

peer_cpu_uri = '/vsx-peer/rest/v1/system/daemons/{}?' \

The path portion of a monitored resource URI can contain wildcard characters and user-defined parameters.

For example:

CPU utilization


Memory utilization


Packets received on interface 1/1/5


Packets transmitted from a user-specified interface:


Link states of all interfaces


Monitor function

The monitor is defined by the Monitor function, which has the following arguments:

  • The item to be monitored—expressed as the REST URI of a system resource. This URI must include a query string that specifies the attribute or attributes to be monitored.

  • If the URI includes a parameter, the name of the parameter.

  • The name of the monitor, which is a string that is unique among the monitors defined in that script.

    In the example, the name of the monitor is: Interface Received Bytes.

The following is an example of a monitor that uses a parameter for the resource ID. The monitor, named Interface Received Bytes, records the received bytes of the interface that will be specified by the user when the agent is created.

self.monitor = Monitor('/rest/v1/system/interfaces/{}?attributes=rx_bytes', 
	             [self.params['iface_id'] ],name='Interface Received Bytes')

The following is an example of the same monitor except that it does not use a parameter for the resource ID of the interface. Instead, the resource ID is defined as 1%2f1%2f7, which is the percent-encoded representation of the switch member/slot/port notation: 1/1/7.

self.monitor = Monitor('/rest/v1/system/interfaces/1%2f1%2f7?attributes=rx_bytes', 
	             name='Interface Received Bytes')

In the previous example:

  • The URI path is: /rest/v1/system/interfaces/1%2f1%2f7

  • The resource ID portion of the path is: 1%2f1%2f7

  • The URI query string is: ?attributes=rx_bytes

To get the URI of a resource to monitor, you can use the ArubaOS-CX REST API Reference browser interface to access the REST API. For more information about the REST API and the Swagger UI, see the REST API Guide.

When you specify the monitored URI, you can also use variables to represent the URI. This strategy can simplify updating a script with the REST API version changes or to make code more readable when there are long URI paths.

For example:

#Received bytes on a user-specified interface
        uri1 = '/rest/v1/system/interfaces/{}?attributes=rx_bytes'
        self.m1 = Monitor(
            'Interface Received Bytes',