diff --git a/installer/conf/container.conf b/installer/conf/container.conf index 4cb9e6913..0b26357f0 100755 --- a/installer/conf/container.conf +++ b/installer/conf/container.conf @@ -76,7 +76,7 @@ heartbeat_type tcp - host healthmodel-replicaset-service.kube-system + host "#{ENV['HEALTHMODEL_REPLICASET_SERVICE_ENDPOINT']}" port 25227 diff --git a/installer/scripts/tomlparser.rb b/installer/scripts/tomlparser.rb index 067586629..b66e1257e 100644 --- a/installer/scripts/tomlparser.rb +++ b/installer/scripts/tomlparser.rb @@ -16,6 +16,7 @@ @logTailPath = "/var/log/containers/*.log" @logExclusionRegexPattern = "(^((?!stdout|stderr).)*$)" @excludePath = "*.csv2" #some invalid path +@enable_health_model = false # Use parser to parse the configmap toml file to a ruby structure def parseConfigMap(path) @@ -121,10 +122,12 @@ def populateSettingValuesFromConfigMap(parsedConfig) end begin - if !parsedConfig.nil? && !parsedConfig[:agent_settings][:health_model].nil? && !parsedConfig[:agent_settings][:health_model][:enabled].nil? + if !parsedConfig.nil? && !parsedConfig[:agent_settings].nil? && !parsedConfig[:agent_settings][:health_model].nil? && !parsedConfig[:agent_settings][:health_model][:enabled].nil? @enable_health_model = parsedConfig[:agent_settings][:health_model][:enabled] - puts "enable_health_model = #{@enable_health_model}" + else + @enable_health_model = false end + puts "enable_health_model = #{@enable_health_model}" rescue => errorStr puts "config::error:Exception while reading config settings for health_model enabled setting - #{errorStr}, using defaults" @enable_health_model = false @@ -140,7 +143,9 @@ def populateSettingValuesFromConfigMap(parsedConfig) Dir["/etc/config/settings/*settings"].each{|file| puts "Parsing File #{file}" settings = parseConfigMap(file) - configMapSettings = configMapSettings.merge(settings) + if !settings.nil? + configMapSettings = configMapSettings.merge(settings) + end } if !configMapSettings.nil? diff --git a/source/code/plugin/out_mdm.rb b/source/code/plugin/out_mdm.rb index 4b9d50a29..b8d10090d 100644 --- a/source/code/plugin/out_mdm.rb +++ b/source/code/plugin/out_mdm.rb @@ -55,8 +55,9 @@ def start if aks_region.to_s.empty? @log.info "Environment Variable AKS_REGION is not set.. " @can_send_data_to_mdm = false + else + aks_region = aks_region.gsub(" ","") end - aks_region = aks_region.gsub(" ","") if @can_send_data_to_mdm @log.info "MDM Metrics supported in #{aks_region} region"