Rules are optional components of the agent constructor, which is the main body of the Aruba Network Analytics Engine script.

When you monitor something on a switch, you can define rules to execute actions when certain conditions are true. For example, you might define a rule to send a message to the system log when CPU utilization exceeds 90% of capacity.

A script can have multiple rules using any combination of monitors previously specified on the script. A rule must include a condition, but actions are not required. A rule that does not include actions do not generate an alert when a condition transitions to true or to false.

A rule consists of the following components:

  • The Rule function, to which a text string identifying the rule is passed as an argument. For example:

    Rule('High CPU utilization by ' + daemon_name)
  • A condition, defined by the condition function of the rule.

  • Zero or more actions, each of which is defined by the action function of the rule. Actions are executed if the condition transitions from false to true.

  • Zero or more clear actions, each of which is defined by the clear_action function of the rule. Clear actions are executed if the condition transitions from true to false.

    self.r1 = Rule('Minor CPU Utilization')
            '{} >= {}',

You can also create time-based rules that execute actions at a regular interval instead of in response to the conditions of a monitored URI.

For example, you can use the every keyword to create a rule that executes an action every 60 seconds:

self.r1 = Rule("Periodic callback")
self.r1.condition("every 60 seconds")

You can use parameters to make the interval configurable. However time-based rules do not support clear conditions, conjunction operators, or disjunction operators.