Durations, evaluation delays, and pauses in condition expressions

The following are the behaviors when condition expression includes durations and either evaluation delays or evaluation pauses.

A duration is an number followed by a space followed by one of the values for the time keyword.

for followed by a duration

If a condition expression has the for keyword followed by a duration, the expression will be evaluated and monitored for that particular duration before the condition is considered true and any rule actions are executed.

For example, the following condition expression is true only if the count of the conn_state has been less than 5 for three minutes:

count /v1/system/vrfs/red/bgp_routers/bgp_neighbors/?attributes=conn_state < 5 for 3 minutes
pause followed by a duration

If a condition expression has the pause keyword followed by a duration, the condition will not be monitored for the specified duration after the condition is met. However, because the condition is true, any rule actions are executed before monitoring is paused.

For example, the following condition expression specifies that the spanning tree tcn_count will not be monitored for 1 minute after the tcn_count is greater than 10.

/v1/system/vlan/1/spanning_tree/tcn_count > 10 pause 1 minute

Using these kinds of expressions can reduce the number of actions taken—such as log entries generated—when a network condition is temporary, but still ensure that actions are taken at intervals the administrator considers to be reasonable.

Examples

rate /v1/system?attributes=resource_utilization_poll_interval' > 300 per 1 hour for 5 hours

rate /v1/system?attributes=resource_utilization_poll_interval' > 300 per 2 hours for 5 days

avg over 1 minute /v1/system/interface/1?attributes=statistics.tx_dropped < 5 for 2 minutes

rate /v1/system?attributes=resource_utilization_poll_interval' > 300 per 10 seconds for 5 minutes

avg over 1 minute /v1/system/interface/1?attributes=statistics.tx_dropped < 5 for 2 minutes pause 10 seconds