Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
eb2c5f3
separate build yamls for ci_prod branch (#415)
ganga1980 Aug 5, 2020
df29e35
re-enable adx path (#420)
vishiy Aug 6, 2020
bcc8506
Gangams/release changes (#419)
ganga1980 Aug 6, 2020
39534d6
fix for zero filled metrics (#423)
rashmichandrashekar Aug 6, 2020
5e0b429
consolidate windows agent image docker files (#422)
ganga1980 Aug 7, 2020
c5c28f0
Gangams/cluster creation scripts (#414)
ganga1980 Aug 13, 2020
d7a3750
fix: Pin to a particular version of ltsc2019 by SHA (#427)
bragi92 Aug 14, 2020
5e8de91
enable collecting npm metrics (optionally) (#425)
vishiy Aug 14, 2020
17e7ff8
Saaror patch 3 (#426)
saaror Aug 17, 2020
6c7c675
Gangams/add containerd support to windows agent (#428)
ganga1980 Aug 18, 2020
bac8a32
Gangams/arc k8s metrics (#413)
ganga1980 Aug 20, 2020
ab03640
fix: Reverting back to ltsc2019 tag (#429)
bragi92 Aug 21, 2020
af0f981
more kubelet metrics (#430)
vishiy Aug 27, 2020
7fc4d4c
fix nom issue when config is empty (#432)
vishiy Sep 1, 2020
281a77c
support multiple docker paths when docker root is updated thru knode …
vishiy Sep 1, 2020
d8d7f9f
Gangams/doc and other related updates (#434)
ganga1980 Sep 11, 2020
2d56087
add missing serviceprincipal in ps scripts (#435)
ganga1980 Sep 14, 2020
a28aaf0
fix telemetry bug (#436)
vishiy Sep 15, 2020
0062b32
Gangams/readmeupdates non aks 09162020 (#437)
ganga1980 Sep 16, 2020
1a7ef1c
Gangams/fix weird conflicts (#439)
ganga1980 Sep 16, 2020
bf75bf0
fix quote issue for the region (#441)
ganga1980 Sep 21, 2020
6287724
fix cpucapacity/limit bug (#442)
vishiy Sep 21, 2020
bd30a47
grwehner/pv-usage-metrics (#431)
gracewehner Sep 23, 2020
7304a6b
add new custom metric regions (#444)
vishiy Sep 23, 2020
2d8c03f
add 'Terminating' state (#443)
vishiy Sep 23, 2020
da06d76
Gangams/sept agent release tasks (#445)
ganga1980 Sep 25, 2020
5453054
grwehner/pv-collect-volume-name (#448)
gracewehner Sep 28, 2020
fe9f14d
Changes for september agent release (#449)
rashmichandrashekar Sep 30, 2020
f1657c6
Gangams/arc k8s related scripts, charts and doc updates (#450)
ganga1980 Oct 1, 2020
e6dad83
Install CA certs from wireserver (#451)
rashmichandrashekar Oct 1, 2020
23397ed
grwehner/pv-volume-name-in-mdm (#452)
gracewehner Oct 1, 2020
7562a96
Release changes for 10052020 release (#453)
vishiy Oct 5, 2020
4b47f44
Update onboarding_instructions.md (#456)
saaror Oct 12, 2020
3f86b23
chart update for sept2020 release (#457)
ganga1980 Oct 19, 2020
6203c3a
add missing version update in the script (#458)
ganga1980 Oct 19, 2020
5b15469
November release fixes - activate one agent, adx schema v2, win perf …
vishiy Oct 27, 2020
157ba20
remove hiphen for params in chart (#462)
vishiy Oct 28, 2020
7c448bc
Changes for cutting a new build for ciprod10272020 release (#460)
vishiy Oct 28, 2020
62b27d7
using latest stable version of msys2 (#465)
ganga1980 Oct 29, 2020
909cc16
fixing the windows-perf-dups (#466)
rashmichandrashekar Oct 29, 2020
d481c06
chart updates related to new microsoft/charts repo (#467)
ganga1980 Nov 6, 2020
aff1e13
Changes for creating 11092020 release (#468)
vishiy Nov 9, 2020
ca18850
MDM exception aggregation (#470)
rashmichandrashekar Nov 10, 2020
18c27dd
grwehner/mdm custom metric regions (#471)
gracewehner Nov 23, 2020
a5c12e9
updaitng rs limit to 1gb (#474)
rashmichandrashekar Dec 4, 2020
7453fd4
grwehner/pv inventory (#455)
gracewehner Dec 10, 2020
24b709f
Gangams/fix for build release pipeline issue (#476)
ganga1980 Dec 15, 2020
9061201
add pv fluentd plugin config to helm rs config (#477)
gracewehner Dec 15, 2020
064bc06
Gangams/fix rs ooming (#473)
ganga1980 Dec 16, 2020
9cb058c
Gangams/enable arc onboarding to ff (#478)
ganga1980 Dec 18, 2020
ef9d726
Convert PV type dictionary to json for telemetry so it shows up in lo…
gracewehner Jan 4, 2021
97bdb94
fix 2 windows tasks - 1) Dont log to termination log 2) enable ADX ro…
vishiy Jan 6, 2021
94237be
fix ci envvar collection in large pods (#483)
ganga1980 Jan 6, 2021
aacd496
grwehner/jan agent tasks (#481)
gracewehner Jan 7, 2021
148d739
updating fbit version and cpu limit (#485)
rashmichandrashekar Jan 8, 2021
bd33dd9
reverting to older version (#487)
rashmichandrashekar Jan 8, 2021
d5164d2
Gangams/add fbsettings configurable via configmap (#486)
ganga1980 Jan 11, 2021
908d9b0
Gangams/jan agent release tasks (#484)
ganga1980 Jan 11, 2021
8ede536
remove per container logs in ci (#488)
ganga1980 Jan 11, 2021
37e5218
updates for ciprod01112021 release (#489)
ganga1980 Jan 12, 2021
3c97af6
new yaml files (#491)
deagraw Jan 14, 2021
90e1a5b
Use cloud-specific instrumentation keys (#494)
daweim0 Jan 22, 2021
98b6d77
upgrade apt to latest version (#492)
ganga1980 Jan 22, 2021
ddcd3ee
Gangams/add support for extension msi for arc k8s cluster (#495)
ganga1980 Jan 27, 2021
0cd99e4
Gangams/arm template arc k8s extension (#496)
ganga1980 Jan 27, 2021
13521c5
Gangams/aks monitoring via policy (#497)
ganga1980 Feb 1, 2021
e4f36c7
revert to use operatingSystem from osImage for node os telemety (#498)
ganga1980 Feb 1, 2021
ec15ac1
Container log v2 schema changes (#499)
vishiy Feb 4, 2021
6031be8
Add priority class to the daemonsets (#500)
Michael-Sinz Feb 9, 2021
4212e1a
fix node metric issue (#502)
ganga1980 Feb 11, 2021
24644ce
Bug fixes for Feb release (#504)
rashmichandrashekar Feb 18, 2021
e56104c
Gangams/feb 2021 agent bug fix (#505)
ganga1980 Feb 23, 2021
e00b2aa
changes for release -ciprod02232021 (#506)
vishiy Feb 23, 2021
31f0e5f
Gangams/e2e test framework (#503)
ganga1980 Feb 23, 2021
91f954f
scrape new kubelet pod count metric name (#508)
gracewehner Feb 25, 2021
4a8ff23
Adding explicit json output to az commands as the script fails if az …
nyuen Mar 20, 2021
512e5c0
Gangams/arc proxy contract and token renewal updates (#511)
ganga1980 Mar 22, 2021
6b48b6a
doc updates for microsoft charts repo release (#512)
ganga1980 Mar 22, 2021
d93c680
Update enable-monitoring.sh (#514)
seenu433 Mar 23, 2021
4d386ce
Prometheus scraping from sidecar and OSM changes (#515)
rashmichandrashekar Mar 25, 2021
16936aa
add liveness timeout for exec (#518)
vishiy Mar 26, 2021
12964be
chart and other updates (#519)
rashmichandrashekar Mar 26, 2021
73548c0
Saaror osmdoc (#523)
saaror Apr 5, 2021
fea4ffa
telemetry bug fix (#527)
rashmichandrashekar Apr 6, 2021
e31cc87
Fix conflicting logrotate settings (#526)
gracewehner Apr 6, 2021
ca8fa12
bug fix (#528)
rashmichandrashekar Apr 6, 2021
1f6f6d2
Gangams/arc ev2 deployment (#522)
ganga1980 Apr 7, 2021
97678b6
added liveness and telemetry for telegraf (#517)
daweim0 Apr 9, 2021
63ea896
Windows metric fix (#530)
daweim0 Apr 13, 2021
42730a4
OSM doc update (#533)
rashmichandrashekar Apr 13, 2021
7ad52cd
Adding MDM metrics for threshold violation (#531)
rashmichandrashekar Apr 14, 2021
34d1f64
Rashmi/april agent 2021 (#538)
rashmichandrashekar Apr 21, 2021
fcc5048
add Read_from_Head config for all fluentbit tail plugins (#539)
gracewehner Apr 21, 2021
01e5529
fix programdata mount issue on containerd win nodes (#542)
ganga1980 Apr 22, 2021
b5d074a
Update sidecar mem limits (#541)
rashmichandrashekar Apr 22, 2021
5feeb3e
David/release 4 22 2021 (#544)
daweim0 Apr 22, 2021
1b2da4a
1m, 1m, 1s by default (#543)
daweim0 Apr 23, 2021
83e5816
David/aad stage 1 release (#556)
daweim0 May 12, 2021
8beabe3
Update ReleaseNotes.md (#558)
ganga1980 May 13, 2021
3805f44
Add wait time for telegraf and also force mdm egress to use tls 1.2 (…
vishiy May 19, 2021
7c5087f
partially disabled telegraf liveness probe check, we'll still have te…
daweim0 May 19, 2021
0d33489
changes for 05202021 release (#563)
daweim0 May 20, 2021
486acfd
Rashmi/jedi wireserver (#566)
rashmichandrashekar May 21, 2021
0fa350e
Update ReadMe.md (#565)
saaror May 21, 2021
c707539
Gangams/aad stage2 full switch to mdsd (#559)
ganga1980 May 22, 2021
959b455
Send perf metrics to MDM from windows daemonset (#568)
rashmichandrashekar May 27, 2021
e4da519
updating json gem to address CVE-2020-10663 (#567)
daweim0 May 28, 2021
49486a8
update recommended alerts readme (#570)
daweim0 May 28, 2021
ef23fc6
trying again to fix the json gem (#571)
daweim0 May 28, 2021
cfa804a
Addressing PR comments for - https://github.com/microsoft/Docker-Prov…
rashmichandrashekar Jun 1, 2021
0d3e4a1
Mem_Buf_limit is configurable via ConfigMap (#574)
tsubasaxZZZ Jun 10, 2021
50b99ff
add log rotation settings for fluentd logs (#577)
ganga1980 Jun 11, 2021
4cebe73
Gangams/release 06112021 (#578)
ganga1980 Jun 11, 2021
adabaf9
release note update (#579)
ganga1980 Jun 11, 2021
a53688c
resolved merge conflicts
ganga1980 Jun 11, 2021
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
37 changes: 32 additions & 5 deletions Documentation/OSMPrivatePreview/ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
Note - This is private preview. For any support issues, please reach out to us at [askcoin@microsoft.com](mailto:askcoin@microsoft.com). Please don't open a support ticket.

This private preview supports Open Service Mesh on [AKS](https://docs.microsoft.com/azure/aks/servicemesh-osm-about) & Azure [Arc on k8s](http://docs.microsoft.com/azure/azure-arc/kubernetes/tutorial-arc-enabled-osm).

# Azure Monitor Container Insights Open Service Mesh Monitoring

Azure Monitor container insights now supporting preview of [Open Service Mesh(OSM)](https://docs.microsoft.com/azure/aks/servicemesh-osm-about) Monitoring. As part of this support, customer can:
1. Filter & view inventory of all the services that are part of your service mesh.
2. Visualize and monitor requests between services in your service mesh, with request latency, error rate & resource utilization by services.
3. Provides connection summary for OSM infrastructure running on AKS.
3. Provides connection summary for OSM infrastructure running on AKS or Azure Arc for k8s.

## How to onboard Container Insights OSM monitoring?
OSM exposes Prometheus metrics which Container Insights can collect, for container insights agent to collect OSM metrics follow the following steps.

### AKS
1. Follow this [link](https://docs.microsoft.com/en-us/azure/aks/servicemesh-osm-about?pivots=client-operating-system-linux#register-the-aks-openservicemesh-preview-feature) as a prereq before enabling the addon.

2. Enable AKS OSM addon on your
Expand All @@ -27,9 +29,29 @@ osm metrics enable --namespace "test1, test2"
* Download the configmap from [here](https://github.com/microsoft/Docker-Provider/blob/ci_prod/kubernetes/container-azm-ms-osmconfig.yaml)
* Add the namespaces you want to monitor in configmap `monitor_namespaces = ["namespace1", "namespace2"]`
* Run the following kubectl command: kubectl apply -f<configmap_yaml_file.yaml>
* Example: `kubectl apply -f container-azm-ms-agentconfig.yaml`
* Example: `kubectl apply -f container-azm-ms-osmconfig.yaml`
4. The configuration change can take upto 15 mins to finish before taking effect, and all omsagent pods in the cluster will restart. The restart is a rolling restart for all omsagent pods, not all restart at the same time.

### Azure Arc for Kuberentes
This section assumes that you already have your kubernetes distribution connected via Azure Arc. If not learn more [here.](https://docs.microsoft.com/en-us/azure/azure-arc/kubernetes/quickstart-connect-cluster)

1. Install Arc enabled Open Service mesh on your Arc cluster. Learn more [here](http://docs.microsoft.com/azure/azure-arc/kubernetes/tutorial-arc-enabled-osm#install-arc-enabled-open-service-mesh-osm-on-an-arc-enabled-kubernetes-cluster)
2. Install Azure Monitor Container Insights on Arc. If not installed already. Learn more how to install [here](https://docs.microsoft.com/azure/azure-monitor/containers/container-insights-enable-arc-enabled-clusters)
3. Ensure that prometheus_scraping is set to true in the OSM configmap.
3. Ensure that the application namespaces that you wish to be monitored are onboarded to the mesh. Follow the guidance available [here.](http://docs.microsoft.com/azure/azure-arc/kubernetes/tutorial-arc-enabled-osm#onboard-namespaces-to-the-service-mesh)
4. To enable namespace(s), download the osm client library [here](https://docs.microsoft.com/en-us/azure/aks/servicemesh-osm-about?pivots=client-operating-system-linux#osm-service-quotas-and-limits-preview) & then enable metrics on namespaces
```bash
# With osm
osm metrics enable --namespace test
osm metrics enable --namespace "test1, test2"

```
4. On your Azure Monitor Container Insights for Arc.
* Download the configmap from [here](https://github.com/microsoft/Docker-Provider/blob/ci_prod/kubernetes/container-azm-ms-osmconfig.yaml)
* Add the namespaces you want to monitor in configmap `monitor_namespaces = ["namespace1", "namespace2"]`
* Run the following kubectl command: kubectl apply -f<configmap_yaml_file.yaml>
* Example: `kubectl apply -f container-azm-ms-osmconfig.yaml`
5. The configuration change can take upto 15 mins to finish before taking effect, and all omsagent pods in the cluster will restart. The restart is a rolling restart for all omsagent pods, not all restart at the same time.

## Validate the metrics flow
1. Query cluster's Log Analytics workspace InsightsMetrics table to see metrics are flowing or not
Expand All @@ -41,8 +63,9 @@ InsightsMetrics

## How to consume OSM monitoring dashboard?
1. Access your AKS cluster & Container Insights through this [link.](https://aka.ms/azmon/osmux)
2. Go to reports tab and access Open Service Mesh (OSM) workbook.
3. Select the time-range & namespace to scope your services. By default, we only show services deployed by customers and we exclude internal service communication. In case you want to view that you select Show All in the filter. Please note OSM is managed service mesh, we show all internal connections for transparency.
* For **Azure Arc for k8s**, access Container Insights through this [link.](https://aka.ms/azmon/osmarcux)
3. Go to reports tab and access Open Service Mesh (OSM) workbook.
4. Select the time-range & namespace to scope your services. By default, we only show services deployed by customers and we exclude internal service communication. In case you want to view that you select Show All in the filter. Please note OSM is managed service mesh, we show all internal connections for transparency.

![alt text](https://github.com/microsoft/Docker-Provider/blob/saarorOSMdoc/Documentation/OSMPrivatePreview/Image1.jpg)
### Requests Tab
Expand All @@ -51,6 +74,8 @@ InsightsMetrics
3. You can view total requests, request error rate & P90 latency.
4. You can drill-down to destination and view trends for HTTP error/success code, success rate, Pods resource utilization, latencies at different percentiles.

![image](https://user-images.githubusercontent.com/31900410/119195241-2e712000-ba39-11eb-8cb0-2d7d16e26d1b.png)

### Connections Tab
1. This tab provides you a summary of all the connections between your services in Open Service Mesh.
2. Outbound connections: Total number of connections between Source and destination services.
Expand All @@ -68,4 +93,6 @@ InsightsMetrics
2. When source or destination is osmcontroller we show no latency & for internal services we show no resource utilization.
3. When both prometheus scraping using pod annotations and OSM monitoring are enabled on the same set of namespaces, the default set of metrics (envoy_cluster_upstream_cx_total, envoy_cluster_upstream_cx_connect_fail, envoy_cluster_upstream_rq, envoy_cluster_upstream_rq_xx, envoy_cluster_upstream_rq_total, envoy_cluster_upstream_rq_time_bucket, envoy_cluster_upstream_cx_rx_bytes_total, envoy_cluster_upstream_cx_tx_bytes_total, envoy_cluster_upstream_cx_active) will be collected twice. You can follow [this](https://docs.microsoft.com/en-us/azure/azure-monitor/containers/container-insights-prometheus-integration#prometheus-scraping-settings) documentation to exclude these namespaces from pod annotation scraping using the setting monitor_kubernetes_pods_namespaces to work around this issue.

4. For monitoring on **Azure Arc on k8s** currently there is a separate link to access OSM workbook. We plan to have one single link to access workbook on both platforms by 10th June 2021.

This is private preview, the goal for us is to get feedback. Please feel free to reach out to us at [askcoin@microsoft.com](mailto:askcoin@microsoft.com) for any feedback and questions!
18 changes: 18 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ additional questions or comments.

Note : The agent version(s) below has dates (ciprod<mmddyyyy>), which indicate the agent build dates (not release dates)

### 06/11/2021 -
##### Version microsoft/oms:ciprod06112021 Version mcr.microsoft.com/azuremonitor/containerinsights/ciprod:ciprod06112021 (linux)
##### Version microsoft/oms:win-ciprod06112021 Version mcr.microsoft.com/azuremonitor/containerinsights/ciprod:win-ciprod06112021 (windows)
- Linux Agent
- Removal of base omsagent dependency
- Using MDSD version 1.10.1 as base agent for all the supported LA data types
- Ruby version upgrade to 2.6 i.e. same version as windows agent
- Upgrade FluentD gem version to 1.12.2
- All the Ruby Fluentd Plugins upgraded to v1 as per Fluentd guidance
- Fluent-bit tail plugin Mem_Buf_limit is configurable via ConfigMap
- Windows Agent
- CA cert changes for airgapped clouds
- Send perf metrics to MDM from windows daemonset
- FluentD gem version upgrade from 1.10.2 to 1.12.2 to make same version as Linux Agent
- Doc updates
- README updates related to OSM preview release for Arc K8s
- README updates related to recommended alerts

### 05/20/2021 -
##### Version microsoft/oms:ciprod05202021 Version mcr.microsoft.com/azuremonitor/containerinsights/ciprod:ciprod05202021 (linux)
##### No Windows changes with this release, win-ciprod04222021 still current.
Expand Down
2 changes: 1 addition & 1 deletion alerts/recommended_alerts_ARM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Completed job count|Calculates number of jobs completed more than six hours ago.

### How to enable with a Resource Manager template
1. Download one or all of the available templates that describe how to create the alert.
2. Create and use a [parameters file](https://review.docs.microsoft.com/azure/azure-resource-manager/templates/parameter-files) as a JSON to set the values required to create the alert rule.
2. Create and use a [parameters file](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/parameter-files) as a JSON to set the values required to create the alert rule.
3. Deploy the template from the Azure portal, PowerShell, or Azure CLI.

For step by step procedures on how to enable alerts via Resource manager, please go [here.](https://aka.ms/ci_alerts_arm)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@default_service_interval = "1"
@default_buffer_chunk_size = "1"
@default_buffer_max_size = "1"
@default_mem_buf_limit = "10"

def is_number?(value)
true if Integer(value) rescue false
Expand All @@ -19,6 +20,7 @@ def substituteFluentBitPlaceHolders
interval = ENV["FBIT_SERVICE_FLUSH_INTERVAL"]
bufferChunkSize = ENV["FBIT_TAIL_BUFFER_CHUNK_SIZE"]
bufferMaxSize = ENV["FBIT_TAIL_BUFFER_MAX_SIZE"]
memBufLimit = ENV["FBIT_TAIL_MEM_BUF_LIMIT"]

serviceInterval = (!interval.nil? && is_number?(interval) && interval.to_i > 0 ) ? interval : @default_service_interval
serviceIntervalSetting = "Flush " + serviceInterval
Expand All @@ -32,8 +34,12 @@ def substituteFluentBitPlaceHolders
tailBufferMaxSize = tailBufferChunkSize
end

tailMemBufLimit = (!memBufLimit.nil? && is_number?(memBufLimit) && memBufLimit.to_i > 10) ? memBufLimit : @default_mem_buf_limit
tailMemBufLimitSetting = "Mem_Buf_Limit " + tailMemBufLimit + "m"

text = File.read(@td_agent_bit_conf_path)
new_contents = text.gsub("${SERVICE_FLUSH_INTERVAL}", serviceIntervalSetting)
new_contents = new_contents.gsub("${TAIL_MEM_BUF_LIMIT}", tailMemBufLimitSetting)
if !tailBufferChunkSize.nil?
new_contents = new_contents.gsub("${TAIL_BUFFER_CHUNK_SIZE}", "Buffer_Chunk_Size " + tailBufferChunkSize + "m")
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#!/usr/local/bin/ruby
# frozen_string_literal: true

require_relative "tomlrb"
#this should be require relative in Linux and require in windows, since it is a gem install on windows
@os_type = ENV["OS_TYPE"]
if !@os_type.nil? && !@os_type.empty? && @os_type.strip.casecmp("windows") == 0
require "tomlrb"
else
require_relative "tomlrb"
end

require_relative "/etc/fluent/plugin/constants"
require_relative "ConfigParseErrorLogger"
require_relative "microsoft/omsagent/plugin/constants"

@configMapMountPath = "/etc/config/settings/alertable-metrics-configuration-settings"
@configVersion = ""
Expand Down Expand Up @@ -124,6 +131,10 @@ def populateSettingValuesFromConfigMap(parsedConfig)
end
end

def get_command_windows(env_variable_name, env_variable_value)
return "[System.Environment]::SetEnvironmentVariable(\"#{env_variable_name}\", \"#{env_variable_value}\", \"Process\")" + "\n" + "[System.Environment]::SetEnvironmentVariable(\"#{env_variable_name}\", \"#{env_variable_value}\", \"Machine\")" + "\n"
end

@configSchemaVersion = ENV["AZMON_AGENT_CFG_SCHEMA_VERSION"]
puts "****************Start MDM Metrics Config Processing********************"
if !@configSchemaVersion.nil? && !@configSchemaVersion.empty? && @configSchemaVersion.strip.casecmp("v1") == 0 #note v1 is the only supported schema version, so hardcoding it
Expand All @@ -137,19 +148,37 @@ def populateSettingValuesFromConfigMap(parsedConfig)
end
end

# Write the settings to file, so that they can be set as environment variables
file = File.open("config_mdm_metrics_env_var", "w")
if !@os_type.nil? && !@os_type.empty? && @os_type.strip.casecmp("windows") == 0
# Write the settings to file, so that they can be set as environment variables in windows container
file = File.open("setmdmenv.ps1", "w")

if !file.nil?
file.write("export AZMON_ALERT_CONTAINER_CPU_THRESHOLD=#{@percentageCpuUsageThreshold}\n")
file.write("export AZMON_ALERT_CONTAINER_MEMORY_RSS_THRESHOLD=#{@percentageMemoryRssThreshold}\n")
file.write("export AZMON_ALERT_CONTAINER_MEMORY_WORKING_SET_THRESHOLD=\"#{@percentageMemoryWorkingSetThreshold}\"\n")
file.write("export AZMON_ALERT_PV_USAGE_THRESHOLD=#{@percentagePVUsageThreshold}\n")
file.write("export AZMON_ALERT_JOB_COMPLETION_TIME_THRESHOLD=#{@jobCompletionThresholdMinutes}\n")
# Close file after writing all MDM setting environment variables
file.close
puts "****************End MDM Metrics Config Processing********************"
if !file.nil?
commands = get_command_windows("AZMON_ALERT_CONTAINER_CPU_THRESHOLD", @percentageCpuUsageThreshold)
file.write(commands)
commands = get_command_windows("AZMON_ALERT_CONTAINER_MEMORY_WORKING_SET_THRESHOLD", @percentageMemoryWorkingSetThreshold)
file.write(commands)
# Close file after writing all environment variables
file.close
puts "****************End MDM Metrics Config Processing********************"
else
puts "Exception while opening file for writing MDM metric config environment variables"
puts "****************End MDM Metrics Config Processing********************"
end
else
puts "Exception while opening file for writing MDM metric config environment variables"
puts "****************End MDM Metrics Config Processing********************"
# Write the settings to file, so that they can be set as environment variables in linux container
file = File.open("config_mdm_metrics_env_var", "w")

if !file.nil?
file.write("export AZMON_ALERT_CONTAINER_CPU_THRESHOLD=#{@percentageCpuUsageThreshold}\n")
file.write("export AZMON_ALERT_CONTAINER_MEMORY_RSS_THRESHOLD=#{@percentageMemoryRssThreshold}\n")
file.write("export AZMON_ALERT_CONTAINER_MEMORY_WORKING_SET_THRESHOLD=\"#{@percentageMemoryWorkingSetThreshold}\"\n")
file.write("export AZMON_ALERT_PV_USAGE_THRESHOLD=#{@percentagePVUsageThreshold}\n")
file.write("export AZMON_ALERT_JOB_COMPLETION_TIME_THRESHOLD=#{@jobCompletionThresholdMinutes}\n")
# Close file after writing all MDM setting environment variables
file.close
puts "****************End MDM Metrics Config Processing********************"
else
puts "Exception while opening file for writing MDM metric config environment variables"
puts "****************End MDM Metrics Config Processing********************"
end
end
16 changes: 11 additions & 5 deletions build/common/installer/scripts/tomlparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
@enrichContainerLogs = false
@containerLogSchemaVersion = ""
@collectAllKubeEvents = false
@containerLogsRoute = ""

@containerLogsRoute = "v2" # default for linux
if !@os_type.nil? && !@os_type.empty? && @os_type.strip.casecmp("windows") == 0
@containerLogsRoute = "v1" # default is v1 for windows until windows agent integrates windows ama
end
# Use parser to parse the configmap toml file to a ruby structure
def parseConfigMap
begin
Expand Down Expand Up @@ -162,8 +164,12 @@ def populateSettingValuesFromConfigMap(parsedConfig)
#Get container logs route setting
begin
if !parsedConfig[:log_collection_settings][:route_container_logs].nil? && !parsedConfig[:log_collection_settings][:route_container_logs][:version].nil?
@containerLogsRoute = parsedConfig[:log_collection_settings][:route_container_logs][:version]
puts "config::Using config map setting for container logs route"
if !parsedConfig[:log_collection_settings][:route_container_logs][:version].empty?
@containerLogsRoute = parsedConfig[:log_collection_settings][:route_container_logs][:version]
puts "config::Using config map setting for container logs route: #{@containerLogsRoute}"
else
puts "config::Ignoring config map settings and using default value since provided container logs route value is empty"
end
end
rescue => errorStr
ConfigParseErrorLogger.logError("Exception while reading config map settings for container logs route - #{errorStr}, using defaults, please check config map for errors")
Expand Down Expand Up @@ -256,7 +262,7 @@ def get_command_windows(env_variable_name, env_variable_value)
file.write(commands)
commands = get_command_windows('AZMON_CLUSTER_COLLECT_ALL_KUBE_EVENTS', @collectAllKubeEvents)
file.write(commands)
commands = get_command_windows('AZMON_CONTAINER_LOGS_EFFECTIVE_ROUTE', @containerLogsRoute)
commands = get_command_windows('AZMON_CONTAINER_LOGS_ROUTE', @containerLogsRoute)
file.write(commands)
commands = get_command_windows('AZMON_CONTAINER_LOG_SCHEMA_VERSION', @containerLogSchemaVersion)
file.write(commands)
Expand Down
Loading