Rules

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')
    self.r1.condition(
            '{} >= {}',
            [self.m1,
             self.params['minor_threshold']])
    self.r1.action(self.action_minor_avg_cpu)
    self.r1.clear_action(self.action_clear_minor_avg_cpu)