The maintenance assistant function is used by the OPS to monitor events on a device and trigger corresponding actions. It implements automated device management and maintenance. You can create an assistant and define both a trigger condition and task for the assistant. After an assistant is started, the system monitors the device running status in real time and automatically performs the configured task if the configured trigger condition is met. Maintenance assistants enable the device to monitor its running status and take appropriate actions, thereby improving system maintainability.
Type |
Trigger Condition |
Task |
|
---|---|---|---|
Command assistant |
Command-based |
The following trigger conditions can be configured using commands:
|
Run a command. |
Batch processing file-based |
Run a batch processing file. |
||
Script assistant |
Defined by Python scripts. |
Defined by Python scripts. |
You can run the condition timer cron command to set the execution time of a maintenance assistant, in cron format, so that a maintenance assistant can be run one or more times at specified times, dates, or intervals. Table 2 lists the cron time formats.
Usage Scenario |
Format |
Description |
Example |
---|---|---|---|
Execute an assistant once. |
time |
It uses a set of integers to indicate the execution time and date. |
The condition timer cron 0 1 2 5 3 2020 command configures a maintenance assistant to be executed at 01:00 on May 2 (Wednesday), 2020. |
Execute an assistant multiple times. |
time1,time2,time3 |
It uses a set of integers to indicate multiple execution times, each separated by a comma (,) without spaces. There is no restriction on the sequence of execution times. |
The condition timer cron 0 1,2,3 2 3 * 2020 command configures a maintenance assistant to be executed at the following times on the given date:
|
Execute an assistant at an interval. |
time/step |
time is a set of integers indicating a specific time, and step specifies an interval. time and step are separated by a slash (/) without spaces. The time is calculated in the format of time, time + 1 x step, …, time + n x step, where n is determined by step in the command. The maximum time must be within the time range. |
The condition timer cron 0 0/10 * 3 * 2020 command configures a maintenance assistant to be executed at the following times:
|
Execute an assistant within a time range. |
time1-time2 |
time1 and time2 are integers that specify the start and end time of an assistant task, respectively. They are connected by a hyphen (-) without spaces. time2 must be greater than or equal to time1. The time is calculated in the format of time1, time1 + 1, time1 + 2, ..., time2. |
The condition timer cron 0 0-3 1 3 * 2020 command configures a maintenance assistant to be executed at the following times:
|
Execute an assistant periodically. |
* |
* indicates all possible times. |
The condition timer cron 30 10 * 1 1 2020 command configures a maintenance assistant to be executed at 10:30 every Monday in January 2020. |
Execute an assistant at a specified time combination. |
The preceding formats can be used together. |
The times are separated by a comma (,) without spaces. |
The condition timer cron 0 0/10,2,4-5 1 3 * 2020 command configures a maintenance assistant to be executed at the following times:
|
In addition, the OPS supports the Maintain-Probe (MTP) function, which uses a maintenance assistant to monitor protocol connectivity. If a protocol connection is torn down, the maintenance assistant script is run to collect information about this event, thereby improving device maintainability.