Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore unsupported metrics in the azure module #21486

Merged
merged 33 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
938e66c
mofidy doc
narph Jul 23, 2020
4daef08
Merge branch 'master' of github.com:elastic/beats
narph Aug 3, 2020
b613178
Merge branch 'master' of github.com:elastic/beats
narph Aug 4, 2020
05364cf
Merge branch 'master' of github.com:elastic/beats
narph Aug 4, 2020
f147c4d
Merge branch 'master' of github.com:elastic/beats
narph Aug 4, 2020
4574718
Merge branch 'master' of github.com:elastic/beats
narph Aug 17, 2020
1e43077
Merge branch 'master' of github.com:elastic/beats
narph Aug 19, 2020
807cf06
Merge branch 'master' of github.com:elastic/beats
narph Aug 24, 2020
2096668
Merge branch 'master' of github.com:elastic/beats
narph Aug 27, 2020
da8ac1f
Merge branch 'master' of github.com:elastic/beats
narph Aug 27, 2020
c2d8930
Merge branch 'master' of github.com:elastic/beats
narph Aug 27, 2020
7bd9e73
Merge branch 'master' of github.com:elastic/beats
narph Aug 31, 2020
6e89a84
Merge branch 'master' of github.com:elastic/beats
narph Aug 31, 2020
bdf21e9
Merge branch 'master' of github.com:elastic/beats
narph Sep 2, 2020
7833687
Merge branch 'master' of github.com:elastic/beats
narph Sep 3, 2020
bbf6178
Merge branch 'master' of github.com:elastic/beats
narph Sep 4, 2020
4ba8817
Merge branch 'master' of github.com:elastic/beats
narph Sep 7, 2020
0cba5dc
Merge branch 'master' of github.com:elastic/beats
narph Sep 8, 2020
b2625ca
Merge branch 'master' of github.com:elastic/beats
narph Sep 8, 2020
5100e6a
Merge branch 'master' of github.com:elastic/beats
narph Sep 9, 2020
a302d31
Merge branch 'master' of github.com:elastic/beats
narph Sep 14, 2020
631d667
Merge branch 'master' of github.com:elastic/beats
narph Sep 15, 2020
35072a5
Merge branch 'master' of github.com:elastic/beats
narph Sep 17, 2020
4b2f87a
Merge branch 'master' of github.com:elastic/beats
narph Sep 22, 2020
f26b533
Merge branch 'master' of github.com:elastic/beats
narph Sep 28, 2020
c61620d
Merge branch 'master' of github.com:elastic/beats
narph Sep 28, 2020
43f90c4
Merge branch 'master' of github.com:elastic/beats
narph Sep 30, 2020
2d28f07
Merge branch 'master' of github.com:elastic/beats
narph Oct 1, 2020
0a42bbe
Merge branch 'master' of github.com:elastic/beats
narph Oct 2, 2020
c349f30
add ignore
narph Oct 2, 2020
0fe618e
changelog
narph Oct 2, 2020
0bedffe
Merge branch 'master' of github.com:elastic/beats
narph Oct 5, 2020
92999da
Merge branch 'master' into az-unsup
narph Oct 5, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add overview and platform health dashboards to Cloud Foundry module. {pull}21124[21124]
- Release lambda metricset in aws module as GA. {issue}21251[21251] {pull}21255[21255]
- Add dashboard for pubsub metricset in googlecloud module. {pull}21326[21326] {issue}17137[17137]
- Expand unsupported option from namespace to metrics in the azure module. {pull}21486[21486]
- Map cloud data filed `cloud.account.id` to azure subscription. {pull}21483[21483] {issue}21381[21381]

*Packetbeat*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ input:
- name: ["CPU Credits Remaining", "CPU Credits Consumed", "OS Per Disk Read Bytes/sec", "OS Per Disk Write Bytes/sec", "OS Per Disk Read Operations/Sec", "OS Per Disk Write Operations/Sec", "OS Per Disk QD"]
namespace: "Microsoft.Compute/virtualMachineScaleSets"
timegrain: "PT5M"
ignore_unsupported: true
kaiyan-sheng marked this conversation as resolved.
Show resolved Hide resolved
- name: ["Per Disk Read Bytes/sec", "Per Disk Write Bytes/sec", "Per Disk Read Operations/Sec", "Per Disk Write Operations/Sec", "Per Disk QD"]
namespace: "Microsoft.Compute/virtualMachineScaleSets"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "SlotId"
Expand All @@ -24,6 +26,7 @@ input:
"Premium Data Disk Cache Read Hit", "Outbound Flows Maximum Creation Rate", "Inbound Flows Maximum Creation Rate", "Outbound Flows", "Inbound Flows", "OS Disk IOPS Consumed Percentage", "OS Disk Bandwidth Consumed Percentage",
"OS Disk Queue Depth", "OS Disk Write Operations/Sec", "OS Disk Read Operations/Sec", "OS Disk Write Bytes/sec", "OS Disk Read Bytes/sec", "Data Disk IOPS Consumed Percentage"]
namespace: "Microsoft.Compute/virtualMachineScaleSets"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "VMName"
Expand All @@ -40,9 +43,11 @@ input:
metrics:
- name: ["CPU Credits Remaining", "CPU Credits Consumed", "OS Per Disk Read Bytes/sec", "OS Per Disk Write Bytes/sec", "OS Per Disk Read Operations/Sec", "OS Per Disk Write Operations/Sec", "OS Per Disk QD"]
namespace: "Microsoft.Compute/virtualMachineScaleSets"
ignore_unsupported: true
timegrain: "PT5M"
- name: ["Per Disk Read Bytes/sec", "Per Disk Write Bytes/sec", "Per Disk Read Operations/Sec", "Per Disk Write Operations/Sec", "Per Disk QD"]
namespace: "Microsoft.Compute/virtualMachineScaleSets"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "SlotId"
Expand All @@ -53,6 +58,7 @@ input:
"Premium Data Disk Cache Read Hit", "Outbound Flows Maximum Creation Rate", "Inbound Flows Maximum Creation Rate", "Outbound Flows", "Inbound Flows", "OS Disk IOPS Consumed Percentage", "OS Disk Bandwidth Consumed Percentage",
"OS Disk Queue Depth", "OS Disk Write Operations/Sec", "OS Disk Read Operations/Sec", "OS Disk Write Bytes/sec", "OS Disk Read Bytes/sec", "Data Disk IOPS Consumed Percentage"]
namespace: "Microsoft.Compute/virtualMachineScaleSets"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "VMName"
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/azure/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type MetricConfig struct {
Dimensions []DimensionConfig `config:"dimensions"`
Timegrain string `config:"timegrain"`
// namespaces can be unsupported by some resources and supported in some, this configuration option makes sure no error messages are returned if namespace is unsupported
// info messages will be logged instead
// info messages will be logged instead. Same situation with metrics, some are being removed from the API, we would like to make sure that does not affect the module
IgnoreUnsupported bool `config:"ignore_unsupported"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,25 @@ input:
metrics:
- name: ["CpuUsage", "MemoryUsage"]
namespace: "Microsoft.ContainerInstance/containerGroups"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "containerName"
value: "*"
- name: ["NetworkBytesReceivedPerSecond", "NetworkBytesTransmittedPerSecond"]
namespace: "Microsoft.ContainerInstance/containerGroups"
ignore_unsupported: true
timegrain: "PT5M"
- resource_id: ""
metrics:
- name: ["CpuUsage", "MemoryUsage"]
namespace: "Microsoft.ContainerInstance/containerGroups"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "containerName"
value: "*"
- name: ["NetworkBytesReceivedPerSecond", "NetworkBytesTransmittedPerSecond"]
namespace: "Microsoft.ContainerInstance/containerGroups"
ignore_unsupported: true
timegrain: "PT5M"
6 changes: 6 additions & 0 deletions x-pack/metricbeat/module/azure/container_service/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ input:
metrics:
- name: ["kube_node_status_condition"]
namespace: "Microsoft.ContainerService/managedClusters"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "node"
Expand All @@ -20,9 +21,11 @@ input:
value: "*"
- name: ["kube_node_status_allocatable_cpu_cores", "kube_node_status_allocatable_memory_bytes"]
namespace: "Microsoft.ContainerService/managedClusters"
ignore_unsupported: true
timegrain: "PT5M"
- name: ["kube_pod_status_ready", "kube_pod_status_phase"]
namespace: "Microsoft.ContainerService/managedClusters"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "pod"
Expand All @@ -31,6 +34,7 @@ input:
metrics:
- name: ["kube_node_status_condition"]
namespace: "Microsoft.ContainerService/managedClusters"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "node"
Expand All @@ -41,9 +45,11 @@ input:
value: "*"
- name: ["kube_node_status_allocatable_cpu_cores", "kube_node_status_allocatable_memory_bytes"]
namespace: "Microsoft.ContainerService/managedClusters"
ignore_unsupported: true
timegrain: "PT5M"
- name: ["kube_pod_status_ready", "kube_pod_status_phase"]
namespace: "Microsoft.ContainerService/managedClusters"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "pod"
Expand Down
8 changes: 8 additions & 0 deletions x-pack/metricbeat/module/azure/database_account/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ input:
- name: ["AvailableStorage", "DataUsage","DocumentCount", "DocumentQuota", "IndexUsage", "MetadataRequests", "MongoRequestCharge", "MongoRequests", "MongoRequestsCount",
"MongoRequestsInsert", "MongoRequestsDelete", "MongoRequestsQuery", "MongoRequestsUpdate","ProvisionedThroughput", "NormalizedRUConsumption"]
namespace: "Microsoft.DocumentDb/databaseAccounts"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "DatabaseName"
value: "*"
- name: ["TotalRequestUnits", "TotalRequests"]
namespace: "Microsoft.DocumentDb/databaseAccounts"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "DatabaseName"
Expand All @@ -28,6 +30,7 @@ input:
value: "*"
- name: ["CassandraRequestCharges", "CassandraRequests"]
namespace: "Microsoft.DocumentDb/databaseAccounts"
ignore_unsupported: true
timegrain: "PT1M"
dimensions:
- name: "DatabaseName"
Expand All @@ -38,6 +41,7 @@ input:
"SqlContainerDelete", "SqlContainerThroughputUpdate", "SqlContainerUpdate", "SqlDatabaseDelete", "SqlDatabaseThroughputUpdate", "SqlDatabaseUpdate", "TableTableDelete",
"TableTableThroughputUpdate","TableTableUpdate"]
namespace: "Microsoft.DocumentDb/databaseAccounts"
ignore_unsupported: true
dimensions:
- name: "ResourceName"
value: "*"
Expand All @@ -49,12 +53,14 @@ input:
- name: ["AvailableStorage", "DataUsage","DocumentCount", "DocumentQuota", "IndexUsage", "MetadataRequests", "MongoRequestCharge", "MongoRequests", "MongoRequestsCount",
"MongoRequestsInsert", "MongoRequestsDelete", "MongoRequestsQuery", "MongoRequestsUpdate","ProvisionedThroughput", "NormalizedRUConsumption"]
namespace: "Microsoft.DocumentDb/databaseAccounts"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "DatabaseName"
value: "*"
- name: ["TotalRequestUnits", "TotalRequests"]
namespace: "Microsoft.DocumentDb/databaseAccounts"
ignore_unsupported: true
timegrain: "PT5M"
dimensions:
- name: "DatabaseName"
Expand All @@ -63,6 +69,7 @@ input:
value: "*"
- name: ["CassandraRequestCharges", "CassandraRequests"]
namespace: "Microsoft.DocumentDb/databaseAccounts"
ignore_unsupported: true
timegrain: "PT1M"
dimensions:
- name: "DatabaseName"
Expand All @@ -73,6 +80,7 @@ input:
"SqlContainerDelete", "SqlContainerThroughputUpdate", "SqlContainerUpdate", "SqlDatabaseDelete", "SqlDatabaseThroughputUpdate", "SqlDatabaseUpdate", "TableTableDelete",
"TableTableThroughputUpdate","TableTableUpdate"]
namespace: "Microsoft.DocumentDb/databaseAccounts"
ignore_unsupported: true
dimensions:
- name: "ResourceName"
value: "*"
Expand Down
3 changes: 3 additions & 0 deletions x-pack/metricbeat/module/azure/monitor/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Metrics with dimensions are exported as flattened single dimensional metrics, ag
`name`:: Dimension key
`value`:: Dimension value. (Users can select * to return metric values for each dimension)

`ignore_unsupported`:: (_bool_) Namespaces can be unsupported by some resources and supported in some, this configuration option makes sure no error messages are returned if the namespace is unsupported.
The same will go for the metrics configured, some can be removed from Azure Monitor and it should not affect the state of the module.

Users can select the options to retrieve all metrics from a specific namespace using the following:

["source","yaml"]
Expand Down
10 changes: 5 additions & 5 deletions x-pack/metricbeat/module/azure/monitor/client_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@ func filterMetricNames(resourceId string, metricConfig azure.MetricConfig, metri
}
} else {
// verify if configured metric names are valid, return log error event for the invalid ones, map only the valid metric names
supportedMetricNames, unsupportedMetricNames = filterSConfiguredMetrics(metricConfig.Name, metricDefinitions)
if len(unsupportedMetricNames) > 0 {
supportedMetricNames, unsupportedMetricNames = filterConfiguredMetrics(metricConfig.Name, metricDefinitions)
if len(unsupportedMetricNames) > 0 && !metricConfig.IgnoreUnsupported {
return nil, errors.Errorf("the metric names configured %s are not supported for the resource %s and namespace %s",
strings.Join(unsupportedMetricNames, ","), resourceId, metricConfig.Namespace)
}
}
if len(supportedMetricNames) == 0 {
if len(supportedMetricNames) == 0 && !metricConfig.IgnoreUnsupported {
return nil, errors.Errorf("the metric names configured : %s are not supported for the resource %s and namespace %s ", strings.Join(metricConfig.Name, ","), resourceId, metricConfig.Namespace)
}
return supportedMetricNames, nil
}

// filterSConfiguredMetrics will filter out any unsupported metrics based on the namespace selected
func filterSConfiguredMetrics(selectedRange []string, allRange []insights.MetricDefinition) ([]string, []string) {
// filterConfiguredMetrics will filter out any unsupported metrics based on the namespace selected
func filterConfiguredMetrics(selectedRange []string, allRange []insights.MetricDefinition) ([]string, []string) {
var inRange []string
var notInRange []string
var allMetrics string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestMapMetric(t *testing.T) {

func TestFilterSConfiguredMetrics(t *testing.T) {
selectedRange := []string{"TotalRequests", "Capacity", "CPUUsage"}
intersection, difference := filterSConfiguredMetrics(selectedRange, *MockMetricDefinitions())
intersection, difference := filterConfiguredMetrics(selectedRange, *MockMetricDefinitions())
assert.Equal(t, intersection, []string{"TotalRequests", "Capacity"})
assert.Equal(t, difference, []string{"CPUUsage"})
}
Expand Down