-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add database_account azure metricset (#16234) * add metricset * work on database_Account * fix * work on tests * mage fmt update * work on manifest * update json * move timegrain * uppercase (cherry picked from commit 6816bb1) * changelog
- Loading branch information
Showing
29 changed files
with
329 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//// | ||
This file is generated! See scripts/mage/docs_collector.go | ||
//// | ||
|
||
[[metricbeat-metricset-azure-database_account]] | ||
=== azure database_account metricset | ||
|
||
beta[] | ||
|
||
include::../../../../x-pack/metricbeat/module/azure/database_account/_meta/docs.asciidoc[] | ||
|
||
This is a default metricset. If the host module is unconfigured, this metricset is enabled by default. | ||
|
||
==== Fields | ||
|
||
For a description of each field in the metricset, see the | ||
<<exported-fields-azure,exported fields>> section. | ||
|
||
Here is an example document generated by this metricset: | ||
|
||
[source,json] | ||
---- | ||
include::../../../../x-pack/metricbeat/module/azure/database_account/_meta/data.json[] | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
x-pack/metricbeat/module/azure/compute_vm_scaleset/_meta/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
x-pack/metricbeat/module/azure/database_account/_meta/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"@timestamp" : "2020-02-25T08:53:00.000Z", | ||
"cloud" : { | ||
"provider" : "azure", | ||
"region" : "westeurope" | ||
}, | ||
"event" : { | ||
"module" : "azure", | ||
"duration" : 4877063600, | ||
"dataset" : "azure.database_account" | ||
}, | ||
"metricset" : { | ||
"name" : "database_account", | ||
"period" : 300000 | ||
}, | ||
"azure" : { | ||
"timegrain" : "PT5M", | ||
"dimensions" : { | ||
"databasename" : "testdb" | ||
}, | ||
"database_account" : { | ||
"provisionedthroughput" : { | ||
"max" : 400 | ||
} | ||
}, | ||
"resource" : { | ||
"group" : "obs-test", | ||
"tags" : { | ||
"defaultExperience" : "Core (SQL)" | ||
}, | ||
"name" : "obsaccount", | ||
"type" : "Microsoft.DocumentDb/databaseAccounts" | ||
}, | ||
"subscription_id" : "123456-qwer-1234-5678-12345678", | ||
"namespace" : "Microsoft.DocumentDb/databaseAccounts" | ||
}, | ||
"service" : { | ||
"type" : "azure" | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
x-pack/metricbeat/module/azure/database_account/_meta/docs.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
This is the database_account metricset of the module azure. | ||
|
||
This metricset allows users to retrieve all metrics from specified database accounts. | ||
|
||
include::../../_meta/shared-azure.asciidoc[] | ||
|
||
[float] | ||
==== Config options to identify resources | ||
|
||
`resource_id`:: (_[]string_) The fully qualified ID's of the resource, including the resource name and resource type. Has the format /subscriptions/{guid}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}. | ||
Should return a list of resources. | ||
|
||
`resource_group`:: (_[]string_) This option should return a list of databases we want to apply our metric configuration options on. | ||
|
||
If none of the options are entered then we will select all databases from the entire subscription | ||
For each metric the primary aggregation assigned will be retrieved. | ||
A default non configurable timegrain of 5 min is set so users are advised to configure an interval of 300s or a multiply of it. | ||
|
||
|
7 changes: 7 additions & 0 deletions
7
x-pack/metricbeat/module/azure/database_account/_meta/fields.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
- name: database_account.*.* | ||
release: beta | ||
type: object | ||
object_type: float | ||
object_type_mapping_type: "*" | ||
description: > | ||
database account |
51 changes: 51 additions & 0 deletions
51
x-pack/metricbeat/module/azure/database_account/database_account_integration_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package database_account | ||
|
||
import ( | ||
"errors" | ||
"os" | ||
"testing" | ||
|
||
mbtest "github.com/elastic/beats/metricbeat/mb/testing" | ||
) | ||
|
||
func TestData(t *testing.T) { | ||
config, err := getConfig() | ||
if err != nil { | ||
t.Skip("Skipping TestData: " + err.Error()) | ||
} | ||
|
||
metricSet := mbtest.NewFetcher(t, config) | ||
metricSet.WriteEvents(t, "/") | ||
} | ||
|
||
func getConfig() (map[string]interface{}, error) { | ||
clientId, ok := os.LookupEnv("AZURE_CLIENT_ID") | ||
if !ok { | ||
return nil, errors.New("missing AZURE_CLIENT_ID key") | ||
} | ||
clientSecret, ok := os.LookupEnv("AZURE_CLIENT_SECRET") | ||
if !ok { | ||
return nil, errors.New("missing AZURE_CLIENT_SECRET key") | ||
} | ||
tenantId, ok := os.LookupEnv("AZURE_TENANT_ID") | ||
if !ok { | ||
return nil, errors.New("missing AZURE_TENANT_ID key") | ||
} | ||
subscriptionId, ok := os.LookupEnv("AZURE_SUBSCRIPTION_ID") | ||
if !ok { | ||
return nil, errors.New("missing AZURE_SUBSCRIPTION_ID key") | ||
} | ||
config := map[string]interface{}{ | ||
"module": "azure", | ||
"metricsets": []string{"database_account"}, | ||
"client_id": clientId, | ||
"client_secret": clientSecret, | ||
"tenant_id": tenantId, | ||
"subscription_id": subscriptionId, | ||
} | ||
return config, nil | ||
} |
Oops, something went wrong.