增加告警间隔配置
This commit is contained in:
@@ -47,6 +47,9 @@ type Config struct {
|
||||
|
||||
// Collection 定时采集配置
|
||||
Collection CollectionConfig `yaml:"collection"`
|
||||
|
||||
// AlarmNotification 告警通知配置
|
||||
AlarmNotification AlarmNotificationConfig `yaml:"alarm_notification"`
|
||||
}
|
||||
|
||||
// AppConfig 代表应用基础配置
|
||||
@@ -204,14 +207,27 @@ type CollectionConfig struct {
|
||||
Interval int `yaml:"interval"`
|
||||
}
|
||||
|
||||
// NewConfig 创建并返回一个新的配置实例
|
||||
func NewConfig() *Config {
|
||||
// 默认值可以在这里设置,但我们优先使用配置文件中的值
|
||||
return &Config{
|
||||
Collection: CollectionConfig{
|
||||
Interval: 1, // 默认为1分钟
|
||||
},
|
||||
}
|
||||
type NotificationIntervalsConfig struct {
|
||||
// DebugIntervalMinutes Debug级别告警的通知间隔(分钟)
|
||||
DebugIntervalMinutes uint `yaml:"debug"`
|
||||
// InfoIntervalMinutes Info级别告警的通知间隔(分钟)
|
||||
InfoIntervalMinutes uint `yaml:"info"`
|
||||
// WarnIntervalMinutes Warn级别告警的通知间隔(分钟)
|
||||
WarnIntervalMinutes uint `yaml:"warn"`
|
||||
// ErrorIntervalMinutes Error级别告警的通知间隔(分钟)
|
||||
ErrorIntervalMinutes uint `yaml:"error"`
|
||||
// DPanicIntervalMinutes DPanic级别告警的通知间隔(分钟)
|
||||
DPanicIntervalMinutes uint `yaml:"dpanic"`
|
||||
// PanicIntervalMinutes Panic级别告警的通知间隔(分钟)
|
||||
PanicIntervalMinutes uint `yaml:"panic"`
|
||||
// FatalIntervalMinutes Fatal级别告警的通知间隔(分钟)
|
||||
FatalIntervalMinutes uint `yaml:"fatal"`
|
||||
}
|
||||
|
||||
// AlarmNotificationConfig 告警通知配置
|
||||
type AlarmNotificationConfig struct {
|
||||
// NotificationIntervals 告警通知的发送间隔时间,键为告警等级,值为时间间隔(秒)
|
||||
NotificationIntervals NotificationIntervalsConfig `yaml:"notification_intervals"`
|
||||
}
|
||||
|
||||
// Load 从指定路径加载配置文件
|
||||
|
||||
Reference in New Issue
Block a user