Wildcard characters in monitored URIs

The URI passed to the Monitor function can contain the asterisk (*) wildcard character instead of a component in the URI path.

For example:

  • The following URI specifies the configuration attributes of all interfaces:

    "https://192.0.2.5/rest/v1/system/interfaces/*?selector=configuration"
  • The following URI specifies all routes regardless of VRF:

    "https://192.0.2.5/rest/v1/system/vrfs/*/routes"

You can use wildcard characters in multiple places in the path. For example, the following Monitor function monitors the connection state of all BGP neighbors belonging to all BGP routers in the "red" VRF:

self.monitor = Monitor("/system/vrfs/red/bgp_routers/*/
               bgp_neighbors/*?attributes=conn_state", 
	                  name="BGP Neighbor Connection State") 

You cannot use a wildcard character as part of the query string. For example, you cannot use the wildcard character to specify all attributes of a BGP neighbor.

The wildcard character must replace the entire component in the path. The wildcard character is not part of a regular expression. For example:

  • You can use a wildcard to specify all VRFs, but you cannot use a wildcard character to specify all VRFs that begin with the letter r.

  • You can use a wildcard to specify all interfaces, but you cannot use the wildcard character to specify the interfaces in member 1, slot 2.

NOTE:

When designing scripts that use wildcard characters in monitored URIs, be aware that using a wildcard character for certain resources can result in high switch CPU and memory utilization, which can in turn affect the performance of the switch.

Using a wildcard for resources such as ACLs, interfaces, VLANs, or VRFs, might not result in performance issues in a customer environment that includes a small number of those resources. However, when the same script is installed in a customer environment that has a large number of those resources—such as 500 interfaces—thousands of time series instances are created.

Each monitored resource creates one time series. Each time series requires switch CPU, memory, and storage space in the time series database. Switch performance can be affected when the resident memory resources used by the NAE exceeds approximately 500 MB.

Monitoring the count of resources by including the count parameter in the URI—even on thousands of resources—does not cause performance issues.