mirror of
https://github.com/fankes/komari-agent.git
synced 2025-10-18 18:49:23 +08:00
feat: 可以指定基础信息上报时间
This commit is contained in:
@@ -10,4 +10,5 @@ var (
|
|||||||
IgnoreUnsafeCert bool
|
IgnoreUnsafeCert bool
|
||||||
MaxRetries int
|
MaxRetries int
|
||||||
ReconnectInterval int
|
ReconnectInterval int
|
||||||
|
InfoReportInterval int
|
||||||
)
|
)
|
||||||
|
@@ -67,5 +67,6 @@ func init() {
|
|||||||
RootCmd.PersistentFlags().BoolVarP(&flags.IgnoreUnsafeCert, "ignore-unsafe-cert", "u", false, "Ignore unsafe certificate errors")
|
RootCmd.PersistentFlags().BoolVarP(&flags.IgnoreUnsafeCert, "ignore-unsafe-cert", "u", false, "Ignore unsafe certificate errors")
|
||||||
RootCmd.PersistentFlags().IntVarP(&flags.MaxRetries, "max-retries", "r", 3, "Maximum number of retries")
|
RootCmd.PersistentFlags().IntVarP(&flags.MaxRetries, "max-retries", "r", 3, "Maximum number of retries")
|
||||||
RootCmd.PersistentFlags().IntVarP(&flags.ReconnectInterval, "reconnect-interval", "c", 5, "Reconnect interval in seconds")
|
RootCmd.PersistentFlags().IntVarP(&flags.ReconnectInterval, "reconnect-interval", "c", 5, "Reconnect interval in seconds")
|
||||||
|
RootCmd.PersistentFlags().IntVar(&flags.InfoReportInterval, "info-report-interval", 5, "Interval in minutes for reporting basic info")
|
||||||
RootCmd.PersistentFlags().ParseErrorsWhitelist.UnknownFlags = true
|
RootCmd.PersistentFlags().ParseErrorsWhitelist.UnknownFlags = true
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func DoUploadBasicInfoWorks() {
|
func DoUploadBasicInfoWorks() {
|
||||||
ticker := time.NewTicker(time.Duration(15) * time.Minute)
|
ticker := time.NewTicker(time.Duration(flags.InfoReportInterval) * time.Minute)
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
err := uploadBasicInfo()
|
err := uploadBasicInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user