Agent class constructor


The agent class constructor must begin with the following declaration:

class Agent(NAE):
    def __init__(self):

The name of the constructor, Agent, is recommended, but using a different name does not result in an error.


The main body of the script is the agent class constructor. The agent class constructor can contain:

  • Monitors

  • Conditions

  • Rules

  • Actions

  • Agent functions such as Graph, on_parameter_change, and Baseline.

  • Analytics Data Collections (ADCs)


Example of an agent class constructor:

class Agent(NAE):
    def __init__(self):
        uri1 = '/rest/v1/system/subsystems/*/*/power_supplies/*?attributes=status'
        self.m1 = Monitor(uri1, name='System CPU utilization')

        self.r1 = Rule('High CPU utilization')
        self.r1.condition('{} > {}', [self.m1, self.params['threshold']])
        self.r1.action("CLI","top cpu")
        self.r1.action("SHELL","ps -ef")

    def action_high_cpu(self, event):

		      # CPU value when the Condition met
        cpu = event["value"]
        ActionSyslog("CPU Utilization at %s%." % cpu)
		      ActionCLI("top cpu")
		      ActionShell("ps -ef")