mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix(cloudmon): allow disable ping probe
This commit is contained in:
@@ -71,6 +71,9 @@ func (self *SPingProbeColectorReport) Report() error {
|
||||
}
|
||||
|
||||
func pingProbeColector(s *mcclient.ClientSession, args *options.ReportOptions) error {
|
||||
if args.DisablePingProbe {
|
||||
return nil
|
||||
}
|
||||
isRoot := sysutils.IsRootPermission()
|
||||
if !isRoot {
|
||||
return errors.Error("require root permissions")
|
||||
|
||||
@@ -64,6 +64,8 @@ type PingProbeOptions struct {
|
||||
Debug bool `help:"debug"`
|
||||
ProbeCount int `help:"probe count, default is 3" default:"3"`
|
||||
TimeoutSecond int `help:"probe timeout in second, default is 1 second" default:"1"`
|
||||
|
||||
DisablePingProbe bool `help:"enable ping probe"`
|
||||
}
|
||||
|
||||
func GetArgumentParser() (*structarg.ArgumentParser, error) {
|
||||
|
||||
@@ -36,7 +36,7 @@ func StartService() {
|
||||
duration := time.Duration(opts.CloudproviderSyncInterval) * time.Minute
|
||||
log.Errorf("CloudproviderSyncInterval: %d", opts.CloudproviderSyncInterval)
|
||||
nextSync := time.Now()
|
||||
for i, _ := range common.CustomizeMonTypeList {
|
||||
for i := range common.CustomizeMonTypeList {
|
||||
monType := common.CustomizeMonTypeList[i]
|
||||
cutomizeOperatorChanmap[monType] = make(chan struct{})
|
||||
cloudReportFactory, err := common.GetCloudReportFactory(monType)
|
||||
@@ -95,7 +95,6 @@ func getCloudproviderList(ctx context.Context) ([]jsonutils.JSONObject, error) {
|
||||
}
|
||||
cloudProviderList := make([]jsonutils.JSONObject, 0)
|
||||
for _, val := range common.SupportMetricBrands {
|
||||
|
||||
query.Add(jsonutils.NewString(val), "provider")
|
||||
tmpList, err := common.ListAllResources(&modules.Cloudproviders, session, query)
|
||||
if err != nil {
|
||||
@@ -126,5 +125,4 @@ func syncCloudproviderChanMap(cloudproviderList []jsonutils.JSONObject) []jsonut
|
||||
close(channel)
|
||||
}
|
||||
return newCloudprovider
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user