URIs for monitors
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 a 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/{}?' \
'attributes=resource_utilization.cpu'
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/{}?' \
'attributes=resource_utilization.cpu'
Path component of the URI
The path component of the URI is everything before the question mark (?
) character. The path is a hierarchy. The forward slash (/
) character indicates the hierarchical relationship between resources.
Because the forward slash character has special meaning, forward slash characters that are part of the URL path must be percent-encoded, with the code
%2F
representing the forward slash.
For example, the following URI specifies interface 1/1/5:
/rest/v1/system/interfaces/1%2F1%2F5?attributes=statistics.rx_packets
The path portion of a monitored resource URI can contain the following:
Query component of the URI
The query component is sometimes called the query string. In a URI, the question mark (?
) character indicates the beginning of the query component.
The query component of a monitored URI must contain at least one
key=value
pair. Multiple pairs are separated by the ampersand (&
) character.
The following keys are supported:
attributes
When the key is
attributes
, value is the name of an attribute. The attribute must be an attribute of the resource specified by the path component of the URI. Multiple values are supported. Commas separate the values.For example:
/rest/v1/system/vlans?depth=1&attributes=id,name,type
When a URI defines a monitor in an Aruba Network Analytics Engine script, attribute values in the query string support an additional dot notation that the Network Analytics Engine uses to access additional information. For example:
/rest/v1/system/subsystems/management_module/1%2F5?attributes=resource_utilization.cpu
This dot notation is supported for certain URIs that define monitors in Network Analytics Engine scripts only.
filter
When the key is
filter
, value is anattribute-name:attribute-value
pair that specifies the name and value of an attribute. The attribute must be an attribute of the resource specified by the path component of the URI. Multiple attribute and value pairs are supported. Commas separate the pairs.For example:
...&filter=type:vlan,admin_state:up
Examples of URIs for monitors
- CPU utilization
/rest/v1/system/subsystems/system/base?attributes=resource_utilization.cpu
- Memory utilization
/rest/v1/system/subsystems/system/base?attributes=resource_utilization.memory
- Packets received on interface 1/1/5
/rest/v1/system/interfaces/1%2F1%2F5?attributes=statistics.rx_packets
- Packets transmitted from a user-specified interface
/rest/v1/system/interfaces/{}?attributes=tx_bytes
- Link states of all physical interfaces
/rest/v1/system/interfaces/*?attributes=link_state&filter=type:system
- Link states of all physical interfaces in a administrative down state
/rest/v1/system/interfaces/*?attributes=link_state&filter=type:system,admin_state:down