mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-14 01:34:47 +08:00
fix: 修改监控默认采集间隔和保存时间 (#1795)
This commit is contained in:
parent
b59ccc52ae
commit
e0ca9507de
@ -167,10 +167,12 @@ func StartMonitor(removeBefore bool, interval string) error {
|
|||||||
if removeBefore {
|
if removeBefore {
|
||||||
global.Cron.Remove(cron.EntryID(global.MonitorCronID))
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
imservice.Run()
|
||||||
global.MonitorCronID = int(monitorID)
|
global.MonitorCronID = int(monitorID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ var AddTableSetting = &gormigrate.Migration{
|
|||||||
if err := tx.Create(&model.Setting{Key: "MonitorStatus", Value: "enable"}).Error; err != nil {
|
if err := tx.Create(&model.Setting{Key: "MonitorStatus", Value: "enable"}).Error; err != nil {
|
||||||
return err
|
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
|
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 {
|
if err := tx.Create(&model.Setting{Key: "NtpSite", Value: "pool.ntp.org"}).Error; err != nil {
|
||||||
return err
|
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 err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user