on_parameter_change
Syntax
on_parameter_change(<agent>, <params>)
Description
Performs the specified actions when a user changes the value of an agent parameter.
Parameters
<agent>
Specifies the agent that has the changed parameters.
Typically, this parameter is defined as the variable:
self
<params>
Specifies a Python dictionary that contains the name of the changed parameter, the old value, and the new value.
Usage
Parameters that are defined in the
ParameterDefinitions
of a script can be changed by a user after the user creates the agent.
The Aruba Network Analytics Engine provides the
on_parameter_change
function to enable you to specify actions the agent is to perform when the user changes the value of one or more parameters.
Example
ParameterDefinitions = {
'interface_id': {
'Name': 'Interface Id',
'Description': 'Interface to be monitored',
'Type': 'string',
'Default': '1/1/1'
}
}
uri1 = '/rest/v1/system/interfaces/{}?attributes=link_state'
self.m1 = Monitor(uri1, 'Interface Link State')
def on_parameter_change(self, params):
interface_id = params['interface_id']
if interface_id["old"] != interface_id["new"]:
self.remove_alert_level()