feat: 添加通知与告警模块

- 通知渠道支持配置多个 SMTP 账号,配置整体加密落库,删除时清理规则与事件设置中的引用
- 告警规则支持 18 种指标:CPU/内存/Swap/负载/磁盘用量与 inode/磁盘与网卡速率/网站 5xx 与错误率、
  服务与项目与容器与应用与数据库运行状态、证书与网站剩余天数,可配连续命中次数与静默期
- 系统事件通知覆盖证书续签失败、备份失败、后台任务失败、计划任务失败、网站到期、防篡改拦截、
  面板健康问题、面板登录与爆破、SSH 登录与爆破
- 计划任务统一经 wrapper 执行以捕获退出码,flock 抢锁失败不计为失败
- 监控页改造为系统/告警/设置三 Tab
- 数据库驱动建连打通 context 并补齐连接超时,探测不再阻塞告警评估

close #1041

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
耗子
2026-07-25 22:45:34 +08:00
parent 693dd36b30
commit 4e28fc60a3
111 changed files with 7122 additions and 1853 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ var Package = do.Package(
do.LazyNamed(Prefix+"bind-ip", BindIPCommand), do.LazyNamed(Prefix+"bind-ua", BindUACommand),
do.LazyNamed(Prefix+"website", WebsiteCommand), do.LazyNamed(Prefix+"database", DatabaseCommand),
do.LazyNamed(Prefix+"backup", BackupCommand), do.LazyNamed(Prefix+"restore", RestoreCommand),
do.LazyNamed(Prefix+"cutoff", CutoffCommand),
do.LazyNamed(Prefix+"cutoff", CutoffCommand), do.LazyNamed(Prefix+"cron", CronCommand),
do.LazyNamed(Prefix+"app", AppCommand), do.LazyNamed(Prefix+"setting", SettingCommand),
)
+42
View File
@@ -0,0 +1,42 @@
package command
import (
"context"
"github.com/leonelquinteros/gotext"
"github.com/samber/do/v2"
"github.com/urfave/cli/v3"
"github.com/acepanel/panel/v3/internal/service"
)
// CronCommand 计划任务命令组
func CronCommand(i do.Injector) (*cli.Command, error) {
t := do.MustInvoke[*gotext.Locale](i)
return &cli.Command{
Name: "cron",
Usage: t.Get("Cron task"),
Commands: []*cli.Command{
{
Name: "failed",
Usage: t.Get("Report a failed cron task, called by the task wrapper script"),
Flags: []cli.Flag{
&cli.UintFlag{
Name: "id",
Aliases: []string{"i"},
Usage: t.Get("Cron task ID"),
Required: true,
},
&cli.IntFlag{
Name: "code",
Aliases: []string{"c"},
Usage: t.Get("Exit code"),
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
return do.MustInvoke[*service.CliService](i).CronFailed(ctx, cmd)
},
},
},
}, nil
}