diff --git a/installer/conf/container.conf b/installer/conf/container.conf
index 6d810a0e2..4cb9e6913 100755
--- a/installer/conf/container.conf
+++ b/installer/conf/container.conf
@@ -32,7 +32,7 @@
#custom_metrics_mdm filter plugin
type filter_cadvisor2mdm
- custom_metrics_azure_regions eastus,southcentralus,westcentralus,westus2,southeastasia,northeurope,westeurope
+ custom_metrics_azure_regions eastus,southcentralus,westcentralus,westus2,southeastasia,northeurope,westeurope,southafricanorth,centralus,northcentralus,eastus2,koreacentral,eastasia,centralindia,uksouth,canadacentral
metrics_to_collect cpuUsageNanoCores,memoryWorkingSetBytes,memoryRssBytes
log_level info
diff --git a/installer/conf/kube.conf b/installer/conf/kube.conf
index 4b4ec09ea..3cbc3ff17 100644
--- a/installer/conf/kube.conf
+++ b/installer/conf/kube.conf
@@ -70,14 +70,14 @@
type filter_inventory2mdm
- custom_metrics_azure_regions eastus,southcentralus,westcentralus,westus2,southeastasia,northeurope,westEurope
+ custom_metrics_azure_regions eastus,southcentralus,westcentralus,westus2,southeastasia,northeurope,westeurope,southafricanorth,centralus,northcentralus,eastus2,koreacentral,eastasia,centralindia,uksouth,canadacentral
log_level info
#custom_metrics_mdm filter plugin for perf data from windows nodes
type filter_cadvisor2mdm
- custom_metrics_azure_regions eastus,southcentralus,westcentralus,westus2,southeastasia,northeurope,westEurope
+ custom_metrics_azure_regions eastus,southcentralus,westcentralus,westus2,southeastasia,northeurope,westeurope,southafricanorth,centralus,northcentralus,eastus2,koreacentral,eastasia,centralindia,uksouth,canadacentral
metrics_to_collect cpuUsageNanoCores,memoryWorkingSetBytes
log_level info
diff --git a/source/code/plugin/out_mdm.rb b/source/code/plugin/out_mdm.rb
index 69ef25580..4b9d50a29 100644
--- a/source/code/plugin/out_mdm.rb
+++ b/source/code/plugin/out_mdm.rb
@@ -44,37 +44,38 @@ def start
super
begin
file = File.read(@@azure_json_path)
+ @data_hash = JSON.parse(file)
+ aks_resource_id = ENV["AKS_RESOURCE_ID"]
+ aks_region = ENV["AKS_REGION"]
+
+ if aks_resource_id.to_s.empty?
+ @log.info "Environment Variable AKS_RESOURCE_ID is not set.. "
+ @can_send_data_to_mdm = false
+ end
+ if aks_region.to_s.empty?
+ @log.info "Environment Variable AKS_REGION is not set.. "
+ @can_send_data_to_mdm = false
+ end
+ aks_region = aks_region.gsub(" ","")
+
+ if @can_send_data_to_mdm
+ @log.info "MDM Metrics supported in #{aks_region} region"
+ @token_url = @@token_url_template % {tenant_id: @data_hash["tenantId"]}
+ @cached_access_token = get_access_token
+ @@post_request_url = @@post_request_url_template % {aks_region: aks_region, aks_resource_id: aks_resource_id}
+ @post_request_uri = URI.parse(@@post_request_url)
+ @http_client = Net::HTTP.new(@post_request_uri.host, @post_request_uri.port)
+ @http_client.use_ssl = true
+ @log.info "POST Request url: #{@@post_request_url}"
+ ApplicationInsightsUtility.sendCustomEvent("AKSCustomMetricsMDMPluginStart", {})
+ end
rescue => e
- @log.info "Unable to read file #{@@azure_json_path} #{e}"
+ @log.info "exception when initializing out_mdm #{e}"
+ ApplicationInsightsUtility.sendExceptionTelemetry(e, {"FeatureArea" => "MDM"})
@can_send_data_to_mdm = false
return
end
- # Handle the case where the file read fails. Send Telemetry and exit the plugin?
- @data_hash = JSON.parse(file)
- @token_url = @@token_url_template % {tenant_id: @data_hash["tenantId"]}
- @cached_access_token = get_access_token
- aks_resource_id = ENV["AKS_RESOURCE_ID"]
- aks_region = ENV["AKS_REGION"]
-
- if aks_resource_id.to_s.empty?
- @log.info "Environment Variable AKS_RESOURCE_ID is not set.. "
- @can_send_data_to_mdm = false
- return
- end
- if aks_region.to_s.empty?
- @log.info "Environment Variable AKS_REGION is not set.. "
- @can_send_data_to_mdm = false
- return
- end
-
- aks_region = aks_region.gsub(" ","")
- @@post_request_url = @@post_request_url_template % {aks_region: aks_region, aks_resource_id: aks_resource_id}
- @post_request_uri = URI.parse(@@post_request_url)
- @http_client = Net::HTTP.new(@post_request_uri.host, @post_request_uri.port)
- @http_client.use_ssl = true
- @log.info "POST Request url: #{@@post_request_url}"
- ApplicationInsightsUtility.sendCustomEvent("AKSCustomMetricsMDMPluginStart", {})
end
# get the access token only if the time to expiry is less than 5 minutes