mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
add alert api (#458)
This commit is contained in:
@@ -12,16 +12,16 @@ const (
|
||||
|
||||
type AlertRule struct {
|
||||
Common
|
||||
Name string
|
||||
RulesRaw string
|
||||
Enable *bool
|
||||
TriggerMode int `gorm:"default:0"` // 触发模式: 0-始终触发(默认) 1-单次触发
|
||||
NotificationGroupID uint64 // 该报警规则所在的通知组
|
||||
FailTriggerTasksRaw string `gorm:"default:'[]'"`
|
||||
RecoverTriggerTasksRaw string `gorm:"default:'[]'"`
|
||||
Rules []Rule `gorm:"-" json:"-"`
|
||||
FailTriggerTasks []uint64 `gorm:"-" json:"-"` // 失败时执行的触发任务id
|
||||
RecoverTriggerTasks []uint64 `gorm:"-" json:"-"` // 恢复时执行的触发任务id
|
||||
Name string `json:"name,omitempty"`
|
||||
RulesRaw string `json:"-"`
|
||||
Enable *bool `json:"enable,omitempty"`
|
||||
TriggerMode int `gorm:"default:0" json:"trigger_mode,omitempty"` // 触发模式: 0-始终触发(默认) 1-单次触发
|
||||
NotificationGroupID uint64 `json:"notification_group_id,omitempty"` // 该报警规则所在的通知组
|
||||
FailTriggerTasksRaw string `gorm:"default:'[]'" json:"-"`
|
||||
RecoverTriggerTasksRaw string `gorm:"default:'[]'" json:"-"`
|
||||
Rules []Rule `gorm:"-" json:"rules"`
|
||||
FailTriggerTasks []uint64 `gorm:"-" json:"fail_trigger_tasks"` // 失败时执行的触发任务id
|
||||
RecoverTriggerTasks []uint64 `gorm:"-" json:"recover_trigger_tasks"` // 恢复时执行的触发任务id
|
||||
}
|
||||
|
||||
func (r *AlertRule) BeforeSave(tx *gorm.DB) error {
|
||||
|
||||
Reference in New Issue
Block a user