package model import "time" // AlertNotifyCategory 告警通知策略分类(与监控中心四 Tab 对齐)// Logan.Li type AlertNotifyCategory string const ( AlertNotifyHost AlertNotifyCategory = "host" AlertNotifyMiddleware AlertNotifyCategory = "middleware" AlertNotifySite AlertNotifyCategory = "site" AlertNotifySNMP AlertNotifyCategory = "snmp" ) // AllAlertNotifyCategories 全部告警集合 // Logan.Li var AllAlertNotifyCategories = []AlertNotifyCategory{ AlertNotifyHost, AlertNotifyMiddleware, AlertNotifySite, AlertNotifySNMP, } // AlertNotifyPolicy 告警集合级通知策略 — 绑定联系组/联系人 // Logan.Li type AlertNotifyPolicy struct { ID uint `gorm:"primaryKey;autoIncrement" json:"id"` Category AlertNotifyCategory `gorm:"type:varchar(16);not null;uniqueIndex" json:"category"` Label string `gorm:"type:varchar(64)" json:"label"` Enabled bool `gorm:"default:false" json:"enabled"` ContactGroupIDs string `gorm:"type:text;comment:联系组ID列表JSON" json:"contact_group_ids,omitempty"` ContactIDs string `gorm:"type:text;comment:额外联系人ID列表JSON" json:"contact_ids,omitempty"` NotifyMode string `gorm:"type:varchar(16);default:every;comment:every/once" json:"notify_mode"` Description string `gorm:"type:varchar(256)" json:"description,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } func (AlertNotifyPolicy) TableName() string { return "monitor_alert_notify_policies" }