Configuring a Command Assistant Based on Commands

This section describes how to configure a command assistant based on commands.

Context

If you want a device to automatically run a few commands in a specific condition to implement a function, bind the commands to a command assistant.

  • Ensure that the specified commands are correct and complete. The system does not provide help information or check the correctness of the commands bound to a command assistant.

  • 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.

  • When executing an interactive command that requires a Y/N choice, the system automatically selects Y. When executing an interactive command that requires input of a character string, the system waits until the command times out and then runs the subsequent command.

  • The system switches to the user view by default to run the specified commands. If a command needs to be executed in the system view, run the execute priority command system-view command first. Otherwise, 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 execute priority command commit command after specifying this command. Otherwise, the configuration does not take effect.

  • This configuration process is supported only by the admin VS.

Procedure

  1. Run system-view

    The system view is displayed.

  2. Run ops

    The OPS view is displayed.

  3. Run enable

    OPS is enabled.

  4. Run assistant assistant-name

    An assistant is created.

  5. Configure a trigger condition for the assistant.

    • 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 OID of an SNMP trap that triggers the assistant execution, run the condition snmp-notification oid oid-string [ optype oid-value ] command.
    • To set a log that triggers the assistant execution, run the condition syslog pattern reg-express [ 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.

  6. Run execute priority command command-string

    A command that the assistant will run is specified.

    You can run the command multiple times to specify multiple commands to run.

  7. Run commit

    The configuration is committed.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
Next topic >