优化更新中英文文档-管理面板-任务
This commit is contained in:
parent
bbd57a50b1
commit
11c6091f8d
@ -1,38 +1,42 @@
|
||||
**In the task area, you can set up scheduled tasks, Trigger tasks, and multi-server batch execution tasks**
|
||||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
Nezha monitoring supports pushing commands to the Agent for execution, so this feature is very flexible and can be used to periodically back up the server in conjunction with restic, rclone. Periodically restart a service to reset the network connection. It can also be used with notifications to perform a task when a notification is triggered, such as running a script when the CPU is at high occupancy for a long period of time.
|
||||
**In the Tasks section, you can set up scheduled tasks, trigger tasks, and batch execute tasks on multiple servers.**
|
||||
|
||||
## How to use
|
||||
Go to the "Tasks" page of the admin panel and click "Add Scheduled Task"
|
||||
To add a scheduled task you need to make the following settings:
|
||||
+ `Name` - Customize a task name
|
||||
Nezha Monitoring supports pushing commands to Agents for execution. This feature is highly flexible and can be used for regular backups using tools like restic or rclone, periodically restarting a service to reset network connections, or executing a task when an notification is triggered, such as running a script when CPU usage is high for an extended period.
|
||||
|
||||
+ `Task Type` - select the type of task
|
||||
Scheduled Tasks - Tasks are executed periodically at the scheduled time set below
|
||||
Trigger Tasks - Tasks that are triggered only by API or notification rules and are executed once per trigger
|
||||
## How to Use
|
||||
|
||||
+ `Cron Expression` - (Not valid when using the trigger task type) Set schedule time, the Cron Expression is like:: `* * * * * *` `sec min hour day month week`, see details in [CRON Expression Format](https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format)
|
||||
For example: `0 0 3 * * *` is `Every day at 3 o'clock`
|
||||
Go to the "Tasks" page in the admin panel and click "Add Scheduled Task." When adding a scheduled task, you need to fill in the following parameters:
|
||||
|
||||
+ `Command` - Just like writing shell/bat scripts, **but line wrap is not recommended**, **Multiple Commands should be connected with `&&/&`**
|
||||
For example, to execute a periodic reboot command, you can type `reboot` here
|
||||
- **Name**: Customize a task name.
|
||||
|
||||
+ `Coverage` and `Specific Servers` - Similar to the settings on the Services page, select rules to determine which Agents need to execute scheduled tasks
|
||||
When using the trigger task type, you can select `Only servers that are included in the notification rule`
|
||||
- **Task Type**: Choose the type of task.
|
||||
- **Scheduled Task**: Executes periodically according to the schedule set below.
|
||||
- **Trigger Task**: Only executed when triggered by an API call or notification rule, runs once per trigger.
|
||||
|
||||
+ `Notification Group` - Select the notification method you have set up on the "Notification" page. [Click here](/en_US/guide/notifications.html#flexible-notification-methods) for more information
|
||||
- **Schedule**: Set the schedule time (not enable when using trigger task type). The time format is `* * * * * *`, corresponding to `second minute hour day month weekday`. For more details, see [Cron Expression Format](https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format).
|
||||
For example: `0 0 3 * * *` means "3 AM every day."
|
||||
|
||||
+ `Send Success Notification` - When this item is activated, a message notification will be triggered when the task is successfully executed
|
||||
<br/>
|
||||
- **Command**: Set the command to execute, similar to writing Shell/Bat scripts, but it's recommended not to use new lines; connect multiple commands with `&&` or `&`.
|
||||
For example, to schedule a reboot, you can enter `reboot` here.
|
||||
|
||||
## Manage tasks
|
||||
To manage existing scheduled tasks, you can go to the "Tasks" page in the administration panel
|
||||
Select a task configuration and the three icons on the right, which are:
|
||||
+ `Execute Now` - When clicked, the scheduled time will be ignored and the task will be executed immediately
|
||||
+ `Edit` - Click to modify the task configuration
|
||||
+ `Delete` - Delete this scheduled task
|
||||
<br/>
|
||||
- **Coverage** and **Specific Servers**: Select rules to determine which Agents execute the scheduled task, similar to the settings on the "Services" page. When using the trigger task type, you can choose "executed by the triggered server."
|
||||
|
||||
## FAQ
|
||||
1. Command not found
|
||||
Command not found may cause by missing PATH environment variable, for Linux Server, you may try adding `source ~/.bashrc` at beginning of your command or execute by absolute path.
|
||||
- **Notification Group**: Choose the notification methods you have set up on the "Notifications" page. [Click here](/en_US/guide/notifications.html#flexible-notification-methods) for more details.
|
||||
|
||||
- **Send Success Notification**: Check this option to trigger a notification upon successful task execution.
|
||||
|
||||
## Managing Tasks
|
||||
|
||||
To manage existing scheduled tasks, go to the "Tasks" page in the admin panel. For each task configuration, the three icons on the right are:
|
||||
|
||||
- **Execute Immediately**: Click to ignore the scheduled time and execute the task immediately.
|
||||
- **Edit**: Click to modify the task configuration.
|
||||
- **Delete**: Delete the scheduled task.
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
1. **Command not found error**
|
||||
If a command fails to run with a "command not found" error, it may be a PATH environment variable issue. On Linux servers, you can add `source ~/.bashrc` at the beginning of the command or use the absolute path to execute the command.
|
@ -4,40 +4,39 @@ outline: deep
|
||||
|
||||
**在任务区域中,可以设置计划任务,触发任务,多服务器批量执行任务**
|
||||
|
||||
哪吒监控支持推送命令到 Agent 执行,因此此功能非常灵活,使用此功能可以定期结合 restic、rclone 给服务器备份,定期重启某项服务来重置网络连接。也可以配合告警通知,在触发告警时执行某项任务,如 CPU 在长时期处于高占用的情况下运行某个脚本。
|
||||
哪吒监控支持推送命令到 Agent 执行,此功能非常灵活。使用此功能可以定期结合 restic、rclone 给服务器备份,定期重启某项服务来重置网络连接。也可以配合告警通知,在触发告警时执行某项任务,例如在 CPU 长时间高占用的情况下运行某个脚本。
|
||||
|
||||
## 使用方法
|
||||
|
||||
进入管理面板的 “任务” 页,点击 “添加计划任务”
|
||||
添加计划任务你需要填入以下参数:
|
||||
+ `名称` - 自定义一个任务名称
|
||||
进入管理面板的“任务”页,点击“添加计划任务”。添加计划任务时,你需要填入以下参数:
|
||||
|
||||
+ `任务类型` - 选择任务的类型
|
||||
计划任务 - 按下方设置的计划时间,周期性执行任务
|
||||
触发任务 - 仅被 API 或告警规则触发的任务,每次触发执行一次
|
||||
- **名称**:自定义一个任务名称。
|
||||
|
||||
+ `计划` - (使用触发任务类型时不生效)设置计划时间,时间的格式为: `* * * * * *` 分别对应 `秒 分 时 天 月 星期`,详情见[计划表达式格式](https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format)
|
||||
如:`0 0 3 * * *` 对应为 `每天3点`
|
||||
- **任务类型**:选择任务的类型。
|
||||
- **计划任务**:按下方设置的计划时间,周期性执行任务。
|
||||
- **触发任务**:仅被 API 或告警规则触发的任务,每次触发执行一次。
|
||||
|
||||
+ `命令` - 你可以在这里设置需要执行的命令,就像写 Shell/Bat 脚本一样,**但是不推荐换行,多个命令使用 `&&/&` 连接**
|
||||
例如执行定期重启命令,可以在这里输入 `reboot`
|
||||
- **计划**:设置计划时间(使用触发任务类型时不生效),时间格式为:`* * * * * *`,分别对应`秒 分 时 天 月 星期`,详情见[计划表达式格式](https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format)。
|
||||
例如:`0 0 3 * * *` 对应为“每天 3 点”。
|
||||
|
||||
+ `覆盖范围` 和 `特定服务器` - 跟“服务”页中的设置类似,选择规则来确定哪些 Agent 执行计划任务
|
||||
使用触发任务类型时,可选择`由触发的服务器执行`
|
||||
- **命令**:设置需要执行的命令,就像写 Shell/Bat 脚本一样,但不推荐换行,多个命令使用 `&&/&` 连接。
|
||||
例如执行定期重启命令,可以在这里输入 `reboot`。
|
||||
|
||||
+ `通知方式组` - 选择你已经在 “告警” 页设置好的通知方式,[点击这里](/guide/notifications.html#灵活的通知方式)了解详情
|
||||
- **覆盖范围**和**特定服务器**:选择规则来确定哪些 Agent 执行计划任务,类似于“服务”页中的设置。使用触发任务类型时,可选择“由触发的服务器执行”。
|
||||
|
||||
+ `推送成功的消息` - 勾选此项,任务执行成功后会触发消息通知
|
||||
<br/>
|
||||
- **通知方式组**:选择你已经在“告警”页设置好的通知方式,[点击这里](/guide/notifications.html#灵活的通知方式)了解详情。
|
||||
|
||||
- **推送成功的消息**:勾选此项,任务执行成功后会触发消息通知。
|
||||
|
||||
## 管理任务
|
||||
如需对已有的计划任务进行管理,可以前往管理面板中的 “任务” 页
|
||||
选择一条任务配置,右侧的三个图标,分别是:
|
||||
+ `立即执行` - 点击后将忽略计划时间,立刻执行任务
|
||||
+ `编辑` - 点击可以修改任务配置
|
||||
+ `删除` - 删除这条计划任务
|
||||
<br/>
|
||||
|
||||
如需对已有的计划任务进行管理,可以前往管理面板中的“任务”页。选择一条任务配置,右侧的三个图标分别是:
|
||||
|
||||
- **立即执行**:点击后将忽略计划时间,立刻执行任务。
|
||||
- **编辑**:点击可以修改任务配置。
|
||||
- **删除**:删除这条计划任务。
|
||||
|
||||
## 常见问题
|
||||
1. xxx 命令找不到
|
||||
如果运行失败,提示 xxx 命令找不到,可能是 PATH 环境变量的问题,Linux 服务器在命令开头加入 `source ~/.bashrc` 或者使用绝对路径执行
|
||||
|
||||
1. **xxx 命令找不到**
|
||||
如果运行失败,提示 xxx 命令找不到,可能是 PATH 环境变量的问题。在 Linux 服务器上,可以在命令开头加入 `source ~/.bashrc`,或者使用绝对路径执行命令。
|
Loading…
x
Reference in New Issue
Block a user