Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
671a730
changes
Sep 12, 2019
03ca1bc
changes
Sep 12, 2019
ff9b299
changes
Sep 12, 2019
cb7a7fe
changes
Sep 12, 2019
add3a2a
changes
Sep 12, 2019
428885a
changes
Sep 12, 2019
5e120f3
env changes
Sep 12, 2019
eaec28b
changes
Sep 12, 2019
4aa1e74
changes
Sep 12, 2019
186a4fb
changes
Sep 12, 2019
b55d677
reverting
Sep 12, 2019
611a7b1
changes
Sep 12, 2019
71c458a
cahnges
Sep 12, 2019
2a9380d
changes
Sep 12, 2019
41623f8
changes
Sep 12, 2019
1ff772e
changes
Sep 12, 2019
ac6dd3f
changes
Sep 12, 2019
460953d
changes
Sep 12, 2019
4e69aa2
changes
Sep 12, 2019
4656efe
changes
Sep 12, 2019
a0b4256
changes
Sep 12, 2019
7ff3ced
changes
Sep 12, 2019
32549c2
changes
Sep 12, 2019
11997cf
changes
Sep 13, 2019
00737d7
changes
Sep 13, 2019
f0c40e2
changes
Sep 13, 2019
d6292c3
changes
Sep 13, 2019
67636c3
changes
Sep 13, 2019
938ffc8
changes
Sep 13, 2019
366b1e2
changes
Sep 13, 2019
760c877
changes
Sep 13, 2019
f8abfae
changes
Sep 16, 2019
0100c05
changes
Sep 16, 2019
1fc53ea
changes
Sep 17, 2019
be03e65
changes
Sep 17, 2019
edb7957
changes
Sep 17, 2019
ab7dc49
changes
Sep 17, 2019
57556b7
changes
Sep 17, 2019
0ce5bde
changes
Sep 17, 2019
87c39c6
changes
Sep 17, 2019
5ee933b
changes
Sep 17, 2019
f23bdd8
changes
Sep 17, 2019
40f2191
changes
Sep 18, 2019
758394e
changes
Sep 18, 2019
16c788a
changes
Sep 18, 2019
99a500c
changes
Sep 18, 2019
1c122a4
changes
Sep 18, 2019
f89e599
changes
Sep 18, 2019
eb064b4
changes
Sep 18, 2019
48d7c31
changes
Sep 18, 2019
f7952b8
changes
Sep 18, 2019
0c64f8d
changes
Sep 18, 2019
b4d8c43
changes
Sep 18, 2019
8b9eb07
changes
Sep 19, 2019
a6e62a9
changes
Sep 19, 2019
6cf4003
changes
Sep 20, 2019
3914a0e
changes
Sep 20, 2019
16df0ed
changes
Sep 20, 2019
f30fe44
changes
Sep 20, 2019
40739f7
changes
Sep 20, 2019
b8a1330
changes
Sep 20, 2019
eed00aa
changes
Sep 20, 2019
2b333e0
changes
Sep 20, 2019
be7529c
changes
Sep 20, 2019
cbf5fe0
changes
Sep 21, 2019
6a12b31
changes
Sep 22, 2019
7f656b8
changes
Sep 22, 2019
d8258d2
changes
Sep 22, 2019
4ce2c87
changes
Sep 22, 2019
acf80aa
changes
Sep 22, 2019
3e2e8a0
changes
Sep 22, 2019
0a64bae
changes
Sep 22, 2019
fb57e55
changes
Sep 22, 2019
fa25185
chnages
Sep 22, 2019
87a84d1
changes
Sep 22, 2019
24d8e86
changes
Sep 22, 2019
6e4f9ce
changes
Sep 22, 2019
a418ff2
changes
Sep 22, 2019
47b1515
changes
Sep 22, 2019
254b1dd
changes
Sep 22, 2019
bd1bf15
changes
Sep 22, 2019
e4b3934
changes
Sep 22, 2019
76f7a63
changes
Sep 23, 2019
8768b6d
changes
Sep 23, 2019
ed901b1
changes
Sep 23, 2019
a3f05b0
changes
Sep 23, 2019
3c5c8d7
changes
Sep 23, 2019
284a7cd
changes
Sep 23, 2019
4a2fe91
changes
Sep 23, 2019
a0f8218
changes
Sep 23, 2019
8c275e0
changes
Sep 23, 2019
74c8b43
changes
Sep 23, 2019
411225f
changes
Sep 24, 2019
33e1059
changes
Sep 24, 2019
a933076
changes
Sep 24, 2019
bafe229
changes
Sep 24, 2019
a94c70b
changes
Sep 24, 2019
f9e0568
changes
Sep 24, 2019
3333c16
changes
Sep 24, 2019
4f2c283
changes
Sep 24, 2019
9cef470
changes
Sep 25, 2019
ec022d4
changes
Sep 25, 2019
b206ecf
changes
Sep 25, 2019
417045e
changes
Sep 26, 2019
b9478c5
changes
Sep 26, 2019
30e9773
changes
Sep 27, 2019
b4b32e9
changes
Sep 27, 2019
134a25f
changes
Sep 27, 2019
16211a3
changes
Sep 27, 2019
297be54
changes
Sep 27, 2019
fbd45ac
changes
Sep 27, 2019
4519efa
changes
Sep 27, 2019
2c1ee93
changes
Sep 27, 2019
e2f3a18
changes
Sep 27, 2019
628d912
changes
Sep 28, 2019
1e37e01
changes
Sep 28, 2019
711d1c7
changes
Sep 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion installer/conf/td-agent-bit.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
Path /var/log/containers/omsagent*.log
DB /var/opt/microsoft/docker-cimprov/state/omsagent-ai.db
DB.Sync Off
Parser docker
Mem_Buf_Limit 1m
Path_Key filepath
Skip_Long_Lines On
Expand All @@ -51,7 +52,6 @@
[FILTER]
Name grep
Match oms.container.log.flbplugin.*
Exclude log E! [\[]inputs.prometheus[\]]

[OUTPUT]
Name oms
Expand Down
1 change: 1 addition & 0 deletions installer/datafiles/base_container.data
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ MAINTAINER: 'Microsoft Corporation'
/opt/tomlparser.rb; installer/scripts/tomlparser.rb; 755; root; root
/opt/tomlparser-prom-customconfig.rb; installer/scripts/tomlparser-prom-customconfig.rb; 755; root; root
/opt/td-agent-bit-conf-customizer.rb; installer/scripts/td-agent-bit-conf-customizer.rb; 755; root; root
/opt/ConfigParseErrorLogger.rb; installer/scripts/ConfigParseErrorLogger.rb; 755; root; root



Expand Down
21 changes: 21 additions & 0 deletions installer/scripts/ConfigParseErrorLogger.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/local/bin/ruby
# frozen_string_literal: true

class ConfigParseErrorLogger
require "json"

def initialize
end

class << self
def logError(message)
begin
errorMessage = "config::error::" + message
jsonMessage = errorMessage.to_json
STDERR.puts jsonMessage
rescue => errorStr
puts "Error in ConfigParserErrorLogger::logError: #{errorStr}"
end
end
end
end
3 changes: 2 additions & 1 deletion installer/scripts/td-agent-bit-conf-customizer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/local/bin/ruby
require_relative "ConfigParseErrorLogger"

@td_agent_bit_conf_path = "/etc/opt/microsoft/docker-cimprov/td-agent-bit.conf"

Expand Down Expand Up @@ -40,7 +41,7 @@ def substituteFluentBitPlaceHolders
File.open(@td_agent_bit_conf_path, "w") { |file| file.puts new_contents }
puts "config::Successfully substituted the placeholders in td-agent-bit.conf file"
rescue => errorStr
puts "td-agent-bit-config-customizer: error while substituting values: #{errorStr}"
ConfigParseErrorLogger.logError("td-agent-bit-config-customizer: error while substituting values in td-agent-bit.conf file: #{errorStr}")
end
end

Expand Down
19 changes: 10 additions & 9 deletions installer/scripts/tomlparser-prom-customconfig.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/local/bin/ruby

require_relative "tomlrb"
require_relative "ConfigParseErrorLogger"
require "fileutils"

@promConfigMapMountPath = "/etc/config/settings/prometheus-data-collection-settings"
Expand Down Expand Up @@ -40,7 +41,7 @@ def parseConfigMap
return nil
end
rescue => errorStr
puts "config::error::Exception while parsing toml config file for prometheus config: #{errorStr}, using defaults"
ConfigParseErrorLogger.logError("Exception while parsing config map for prometheus config: #{errorStr}, using defaults, please check config map for errors")
return nil
end
end
Expand All @@ -66,7 +67,7 @@ def replaceDefaultMonitorPodSettings(new_contents, monitorKubernetesPods)
new_contents = new_contents.gsub("$AZMON_RS_PROM_MONITOR_PODS", ("monitor_kubernetes_pods = #{monitorKubernetesPods}"))
new_contents = new_contents.gsub("$AZMON_RS_PROM_PLUGINS_WITH_NAMESPACE_FILTER", "")
rescue => errorStr
puts "config::error::Exception while replacing default pod monitor settings: #{errorStr}"
puts "Exception while replacing default pod monitor settings: #{errorStr}"
end
return new_contents
end
Expand Down Expand Up @@ -98,7 +99,7 @@ def createPrometheusPluginsWithNamespaceSetting(monitorKubernetesPods, monitorKu
new_contents = new_contents.gsub("$AZMON_RS_PROM_PLUGINS_WITH_NAMESPACE_FILTER", pluginConfigsWithNamespaces)
return new_contents
rescue => errorStr
puts "config::error::Exception while creating prometheus input plugins to filter namespaces: #{errorStr}, using defaults"
puts "Exception while creating prometheus input plugins to filter namespaces: #{errorStr}, using defaults"
replaceDefaultMonitorPodSettings(new_contents, monitorKubernetesPods)
end
end
Expand Down Expand Up @@ -181,10 +182,10 @@ def populateSettingValuesFromConfigMap(parsedConfig)
puts "config::Successfully created telemetry file for replicaset"
end
else
puts "config::Typecheck failed for prometheus config settings for replicaset, using defaults"
ConfigParseErrorLogger.logError("Typecheck failed for prometheus config settings for replicaset, using defaults, please use right types for all settings")
end # end of type check condition
rescue => errorStr
puts "config::error::Exception while parsing config file for prometheus config for replicaset: #{errorStr}, using defaults"
ConfigParseErrorLogger.logError("Exception while parsing config file for prometheus config for replicaset: #{errorStr}, using defaults")
setRsPromDefaults
puts "****************End Prometheus Config Processing********************"
end
Expand Down Expand Up @@ -236,16 +237,16 @@ def populateSettingValuesFromConfigMap(parsedConfig)
puts "config::Successfully created telemetry file for daemonset"
end
else
puts "config::Typecheck failed for prometheus config settings for daemonset, using defaults"
ConfigParseErrorLogger.logError("Typecheck failed for prometheus config settings for daemonset, using defaults, please use right types for all settings")
end # end of type check condition
rescue => errorStr
puts "config::error::Exception while parsing config file for prometheus config for daemonset: #{errorStr}, using defaults"
ConfigParseErrorLogger.logError("Exception while parsing config file for prometheus config for daemonset: #{errorStr}, using defaults, please check correctness of configmap")
puts "****************End Prometheus Config Processing********************"
end
end # end of controller type check
end
else
puts "config::error:: Controller undefined while processing prometheus config, using defaults"
ConfigParseErrorLogger.logError("Controller undefined while processing prometheus config, using defaults")
end
end

Expand All @@ -258,7 +259,7 @@ def populateSettingValuesFromConfigMap(parsedConfig)
end
else
if (File.file?(@promConfigMapMountPath))
puts "config::unsupported/missing config schema version - '#{@configSchemaVersion}' , using defaults"
ConfigParseErrorLogger.logError("config::unsupported/missing config schema version - '#{@configSchemaVersion}' , using defaults, please use supported version")
else
puts "config::No configmap mounted for prometheus custom config, using defaults"
end
Expand Down
42 changes: 22 additions & 20 deletions installer/scripts/tomlparser.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/local/bin/ruby

require_relative "tomlrb"
require 'json'
require_relative "ConfigParseErrorLogger"
require "json"

@log_settings_config_map_mount_path = "/etc/config/settings/log-data-collection-settings"
@agent_settings_config_map_mount_path = "/etc/config/settings/agent-settings"
Expand Down Expand Up @@ -33,7 +34,7 @@ def parseConfigMap(path)
return nil
end
rescue => errorStr
puts "config::error::Exception while parsing toml config file: #{errorStr}, using defaults"
ConfigParseErrorLogger.logError("Exception while parsing config map for log collection/env variable settings: #{errorStr}, using defaults, please check config map for errors")
@excludePath = "*_kube-system_*.log"
return nil
end
Expand Down Expand Up @@ -70,7 +71,7 @@ def populateSettingValuesFromConfigMap(parsedConfig)
end
end
rescue => errorStr
puts "config::error::Exception while reading config settings for stdout log collection - #{errorStr}, using defaults"
ConfigParseErrorLogger.logError("Exception while reading config map settings for stdout log collection - #{errorStr}, using defaults, please check config map for errors")
end

#Get stderr log config settings
Expand Down Expand Up @@ -107,7 +108,7 @@ def populateSettingValuesFromConfigMap(parsedConfig)
end
end
rescue => errorStr
puts "config::error:Exception while reading config settings for stderr log collection - #{errorStr}, using defaults"
ConfigParseErrorLogger.logError("Exception while reading config map settings for stderr log collection - #{errorStr}, using defaults, please check config map for errors")
end

#Get environment variables log config settings
Expand All @@ -117,42 +118,43 @@ def populateSettingValuesFromConfigMap(parsedConfig)
puts "config::Using config map setting for cluster level environment variable collection"
end
rescue => errorStr
puts "config::error::Exception while reading config settings for cluster level environment variable collection - #{errorStr}, using defaults"
ConfigParseErrorLogger.logError("Exception while reading config map settings for cluster level environment variable collection - #{errorStr}, using defaults, please check config map for errors")
end
end

begin
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]
@enable_health_model = parsedConfig[:agent_settings][:health_model][:enabled]
else
@enable_health_model = false
@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"
ConfigParseErrorLogger.logError("Exception while reading config map settings for health_model enabled setting - #{errorStr}, using defaults, please check config map for errors")
@enable_health_model = false
end
end

@configSchemaVersion = ENV["AZMON_AGENT_CFG_SCHEMA_VERSION"]
puts "****************Start Config Processing********************"

if !@configSchemaVersion.nil? && !@configSchemaVersion.empty? && @configSchemaVersion.strip.casecmp("v1") == 0 #note v1 is the only supported schema version , so hardcoding it
configMapSettings = {}
configMapSettings = {}

#iterate over every *settings file and build a hash of settings
Dir["/etc/config/settings/*settings"].each{|file|
puts "Parsing File #{file}"
settings = parseConfigMap(file)
if !settings.nil?
configMapSettings = configMapSettings.merge(settings)
end
}
#iterate over every *settings file and build a hash of settings
Dir["/etc/config/settings/*settings"].each { |file|
puts "Parsing File #{file}"
settings = parseConfigMap(file)
if !settings.nil?
configMapSettings = configMapSettings.merge(settings)
end
}

if !configMapSettings.nil?
populateSettingValuesFromConfigMap(configMapSettings)
end
else
puts "config::unsupported/missing config schema version - '#{@configSchemaVersion}' , using defaults"
ConfigParseErrorLogger.logError("config::unsupported/missing config schema version - '#{@configSchemaVersion}' , using defaults, please use supported schema version")
@excludePath = "*_kube-system_*.log"
end

Expand All @@ -178,13 +180,13 @@ def populateSettingValuesFromConfigMap(parsedConfig)
file.write("export AZMON_STDERR_EXCLUDED_NAMESPACES=#{@stderrExcludeNamespaces}\n")
file.write("export AZMON_CLUSTER_COLLECT_ENV_VAR=#{@collectClusterEnvVariables}\n")
file.write("export AZMON_CLUSTER_LOG_TAIL_EXCLUDE_PATH=#{@excludePath}\n")
#health_model settings
#health_model settings
file.write("export AZMON_CLUSTER_ENABLE_HEALTH_MODEL=#{@enable_health_model}\n")
# Close file after writing all environment variables
file.close
puts "Both stdout & stderr log collection are turned off for namespaces: '#{@excludePath}' "
puts "****************End Config Processing********************"
else
puts "config::error::Exception while opening file for writing config environment variables"
puts "Exception while opening file for writing config environment variables"
puts "****************End Config Processing********************"
end
Loading