diff --git a/otelcollector/prom-config-validator-builder/main.go b/otelcollector/prom-config-validator-builder/main.go index a311217db..80e457df0 100644 --- a/otelcollector/prom-config-validator-builder/main.go +++ b/otelcollector/prom-config-validator-builder/main.go @@ -215,6 +215,23 @@ func generateOtelConfig(promFilePath string, outputFilePath string, otelConfigTe return fmt.Errorf("unsupported features:\n\t%s", strings.Join(unsupportedFeatures, "\n\t")) } + globalSettingsFromMergedOtelConfig := prometheusConfig["global"] + + if globalSettingsFromMergedOtelConfig != nil { + globalSettings := globalSettingsFromMergedOtelConfig2.(map[interface{}]interface{}) + scrapeInterval := globalSettings["scrape_interval"] + if (len(globalSettings) > 1) || (len(globalSettings) == 1 && scrapeInterval != "15s") { + if os.Getenv("CONTROLLER_TYPE") == "ReplicaSet" { + os.Setenv("AZMON_GLOBAL_SETTINGS_ENABLED_REPLICASET", "true") + } else if os.Getenv("CONTROLLER_TYPE") == "DaemonSet" && os.Getenv("OS_TYPE") == "linux" { + os.Setenv("AZMON_GLOBAL_SETTINGS_ENABLED_DAEMONSET_LINUX", "true") + } else if os.Getenv("CONTROLLER_TYPE") == "DaemonSet" && os.Getenv("OS_TYPE") != "linux" { + os.Setenv("AZMON_GLOBAL_SETTINGS_ENABLED_DAEMONSET_WINDOWS", "true") + } + fmt.Printf("prom-config-validator::Successfully set env variables for global config\n") + } + } + otelConfig.Receivers.Prometheus.Config = prometheusConfig if os.Getenv("DEBUG_MODE_ENABLED") == "true" { diff --git a/otelcollector/telegraf/telegraf-prometheus-collector-ds.conf b/otelcollector/telegraf/telegraf-prometheus-collector-ds.conf index 260dfab05..8163eb3ae 100644 --- a/otelcollector/telegraf/telegraf-prometheus-collector-ds.conf +++ b/otelcollector/telegraf/telegraf-prometheus-collector-ds.conf @@ -33,6 +33,7 @@ podname = "$POD_NAME" ostype = "$OS_TYPE" mip="$MINIMAL_INGESTION_PROFILE" + daemonsetGlobalSettingsEnabled= "$AZMON_GLOBAL_SETTINGS_ENABLED_DAEMONSET_LINUX" # Configuration for telegraf agent [agent] diff --git a/otelcollector/telegraf/telegraf-prometheus-collector-ta-enabled.conf b/otelcollector/telegraf/telegraf-prometheus-collector-ta-enabled.conf index 11547a903..d5ee1048a 100644 --- a/otelcollector/telegraf/telegraf-prometheus-collector-ta-enabled.conf +++ b/otelcollector/telegraf/telegraf-prometheus-collector-ta-enabled.conf @@ -37,6 +37,7 @@ operatormodelcfgmapsetting = "$AZMON_OPERATOR_ENABLED_CFG_MAP_SETTING" operatormodelchartsetting = "$AZMON_OPERATOR_ENABLED_CHART_SETTING" collectorHpaEnabled = "$AZMON_COLLECTOR_HPA_ENABLED" + replicasetGlobalSettingsEnabled= "$AZMON_GLOBAL_SETTINGS_ENABLED_REPLICASET" # Configuration for telegraf agent [agent] diff --git a/otelcollector/telegraf/telegraf-prometheus-collector-windows.conf b/otelcollector/telegraf/telegraf-prometheus-collector-windows.conf index 7ecd99e69..d85339386 100644 --- a/otelcollector/telegraf/telegraf-prometheus-collector-windows.conf +++ b/otelcollector/telegraf/telegraf-prometheus-collector-windows.conf @@ -35,6 +35,8 @@ ostype = "$OS_TYPE" debugmodeenabled = "$DEBUG_MODE_ENABLED" windowsVersion = "$windowsVersion" + windowsdaemonsetGlobalSettingsEnabled= "$AZMON_GLOBAL_SETTINGS_ENABLED_DAEMONSET_WINDOWS" + # Configuration for telegraf agent [agent]