If you want a device to automatically run a few commands in a specific condition to implement a function, write the commands one by one to a batch file with the file name extension *.bat. Then, load the batch file and bind it to a command assistant. When the device runs the command assistant, it executes the commands in the batch file in sequence.
A command assistant can be configured with only one batch file.
Ensure that the specified batch file is correct and complete. The system does not check the correctness of content in the batch file.
Assistants are executed on the background. Therefore, it is not recommended to bind interactive commands or jump commands, such as telnet and stelnet, to an assistant.
The system switches to the user view by default to run commands in the batch file. If a command needs to be executed in the system view, run the system-view command to enter the system view. Otherwise, the command will be executed in the user view, and the command configuration does not take effect.
If a command needs to be committed and the two-phase validation mode is used in the system, run the commit command after specifying this command. Otherwise, the configuration does not take effect.
The batch file is installed.
If you do not specify destination directory in the command, the batch file is loaded to the default path cfcard:/$_user/. If this parameter is specified, the batch file is loaded to the path cfcard:/$_user/directory/.
If the specified directory does not exist, the system automatically creates the directory. A maximum of seven levels of subdirectories can be created under cfcard:/$_user/.
The system view is displayed.
The OPS view is displayed.
OPS is enabled.
An assistant is created.
To set the severity of an alarm that triggers the assistant execution, run the condition alarm level { eq | ge | gt | le | lt | ne } { critical | major | minor | warning } command.
To set the name of an alarm or event that triggers the assistant execution, run the condition { alarm alarm-type | event } feature feature-name name event-name [ para-name para-optype para-value ] & <1-4> [ occurs occur-number [ period period-value ] ] command.
To set the time when an assistant is executed, run the condition timer cron minutes hours daysOfMonth months daysOfWeek [ years ] command.
Each assistant can have only one trigger condition.
Only one batch file can be configured for a command assistant. The batch file is a .bat file that contains commands to be processed in batches. The following is an example:
system-view arp static 1.1.1.1 1-1-1 commit snmp-agent snmp-agent sys-info version all commit
The configuration is committed.