mirror of https://github.com/1Panel-dev/1Panel
fix: 修改监控默认采集间隔和保存时间 (#1795)
parent
b59ccc52ae
commit
e0ca9507de
|
@ -167,10 +167,12 @@ func StartMonitor(removeBefore bool, interval string) error {
|
|||
if removeBefore {
|
||||
global.Cron.Remove(cron.EntryID(global.MonitorCronID))
|
||||
}
|
||||
monitorID, err := global.Cron.AddJob(fmt.Sprintf("@every %sm", interval), NewIMonitorService())
|
||||
imservice := NewIMonitorService()
|
||||
monitorID, err := global.Cron.AddJob(fmt.Sprintf("@every %sm", interval), imservice)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
imservice.Run()
|
||||
global.MonitorCronID = int(monitorID)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ var AddTableSetting = &gormigrate.Migration{
|
|||
if err := tx.Create(&model.Setting{Key: "MonitorStatus", Value: "enable"}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Create(&model.Setting{Key: "MonitorStoreDays", Value: "30"}).Error; err != nil {
|
||||
if err := tx.Create(&model.Setting{Key: "MonitorStoreDays", Value: "7"}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ var AddBindAndAllowIPs = &gormigrate.Migration{
|
|||
if err := tx.Create(&model.Setting{Key: "NtpSite", Value: "pool.ntp.org"}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Create(&model.Setting{Key: "MonitorInterval", Value: "1"}).Error; err != nil {
|
||||
if err := tx.Create(&model.Setting{Key: "MonitorInterval", Value: "5"}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue