Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
178
plugins/inputs/azure_monitor/README.md
Normal file
178
plugins/inputs/azure_monitor/README.md
Normal file
|
@ -0,0 +1,178 @@
|
|||
# Azure Monitor Input Plugin
|
||||
|
||||
This plugin gathers metrics of Azure resources using the
|
||||
[Azure Monitor][azure_monitor] API. The plugin requires a `client_id`,
|
||||
`client_secret` and `tenant_id` for authentication via access token. The
|
||||
`subscription_id` is required for accessing Azure resources.
|
||||
|
||||
Check the [supported metrics page][supported_metrics] for available resource
|
||||
types and their metrics.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> The Azure API has a read limit of 12,000 requests per hour. Please make sure
|
||||
> you don't exceed this limit with the total number of metrics you are in the
|
||||
> configured interval.
|
||||
|
||||
⭐ Telegraf v1.25.0
|
||||
🏷️ cloud
|
||||
💻 all
|
||||
|
||||
[azure_monitor]: https://docs.microsoft.com/en-us/azure/azure-monitor
|
||||
[supported_metrics]: https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported
|
||||
|
||||
## Property Locations
|
||||
|
||||
The `subscription_id` can be found under `Overview > Essentials` in the Azure
|
||||
portal for your application or service.
|
||||
|
||||
The `client_id` and `client_secret` can be obtained by registering an
|
||||
application under Azure Active Directory.
|
||||
|
||||
The `tenant_id` can be found under `Azure Active Directory > Properties`.
|
||||
|
||||
The resource target `resource_id` can be found under
|
||||
`Overview > Essentials > JSON View` in the Azure portal for your
|
||||
application or service.
|
||||
|
||||
The `cloud_option` defines the optional value for the API endpoints in case you
|
||||
are using the solution to get the metrics from the Azure Sovereign Cloud
|
||||
shipment e.g. AzureChina, AzureGovernment or AzurePublic.
|
||||
The default value is AzurePublic
|
||||
|
||||
## Usage
|
||||
|
||||
Use `resource_targets` to collect metrics from specific resources using
|
||||
resource id.
|
||||
|
||||
Use `resource_group_targets` to collect metrics from resources under the
|
||||
resource group with resource type.
|
||||
|
||||
Use `subscription_targets` to collect metrics from resources under the
|
||||
subscription with resource type.
|
||||
|
||||
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
||||
|
||||
In addition to the plugin-specific configuration settings, plugins support
|
||||
additional global and plugin configuration settings. These settings are used to
|
||||
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
||||
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
||||
|
||||
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
||||
|
||||
## Configuration
|
||||
|
||||
```toml @sample.conf
|
||||
# Gather Azure resources metrics from Azure Monitor API
|
||||
[[inputs.azure_monitor]]
|
||||
# can be found under Overview->Essentials in the Azure portal for your application/service
|
||||
subscription_id = "<<SUBSCRIPTION_ID>>"
|
||||
# can be obtained by registering an application under Azure Active Directory
|
||||
client_id = "<<CLIENT_ID>>"
|
||||
# can be obtained by registering an application under Azure Active Directory.
|
||||
# If not specified Default Azure Credentials chain will be attempted:
|
||||
# - Environment credentials (AZURE_*)
|
||||
# - Workload Identity in Kubernetes cluster
|
||||
# - Managed Identity
|
||||
# - Azure CLI auth
|
||||
# - Developer Azure CLI auth
|
||||
client_secret = "<<CLIENT_SECRET>>"
|
||||
# can be found under Azure Active Directory->Properties
|
||||
tenant_id = "<<TENANT_ID>>"
|
||||
# Define the optional Azure cloud option e.g. AzureChina, AzureGovernment or AzurePublic. The default is AzurePublic.
|
||||
# cloud_option = "AzurePublic"
|
||||
|
||||
# resource target #1 to collect metrics from
|
||||
[[inputs.azure_monitor.resource_target]]
|
||||
# can be found under Overview->Essentials->JSON View in the Azure portal for your application/service
|
||||
# must start with 'resourceGroups/...' ('/subscriptions/xxxxxxxx-xxxx-xxxx-xxx-xxxxxxxxxxxx'
|
||||
# must be removed from the beginning of Resource ID property value)
|
||||
resource_id = "<<RESOURCE_ID>>"
|
||||
# the metric names to collect
|
||||
# leave the array empty to use all metrics available to this resource
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
# metrics aggregation type value to collect
|
||||
# can be 'Total', 'Count', 'Average', 'Minimum', 'Maximum'
|
||||
# leave the array empty to collect all aggregation types values for each metric
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# resource target #2 to collect metrics from
|
||||
[[inputs.azure_monitor.resource_target]]
|
||||
resource_id = "<<RESOURCE_ID>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# resource group target #1 to collect metrics from resources under it with resource type
|
||||
[[inputs.azure_monitor.resource_group_target]]
|
||||
# the resource group name
|
||||
resource_group = "<<RESOURCE_GROUP_NAME>>"
|
||||
|
||||
# defines the resources to collect metrics from
|
||||
[[inputs.azure_monitor.resource_group_target.resource]]
|
||||
# the resource type
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# defines the resources to collect metrics from
|
||||
[[inputs.azure_monitor.resource_group_target.resource]]
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# resource group target #2 to collect metrics from resources under it with resource type
|
||||
[[inputs.azure_monitor.resource_group_target]]
|
||||
resource_group = "<<RESOURCE_GROUP_NAME>>"
|
||||
|
||||
[[inputs.azure_monitor.resource_group_target.resource]]
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# subscription target #1 to collect metrics from resources under it with resource type
|
||||
[[inputs.azure_monitor.subscription_target]]
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# subscription target #2 to collect metrics from resources under it with resource type
|
||||
[[inputs.azure_monitor.subscription_target]]
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
```
|
||||
|
||||
## Metrics
|
||||
|
||||
* azure_monitor_<<RESOURCE_NAMESPACE>>_<<METRIC_NAME>>
|
||||
* fields:
|
||||
* total (float64)
|
||||
* count (float64)
|
||||
* average (float64)
|
||||
* minimum (float64)
|
||||
* maximum (float64)
|
||||
* tags:
|
||||
* namespace
|
||||
* resource_group
|
||||
* resource_name
|
||||
* subscription_id
|
||||
* resource_region
|
||||
* unit
|
||||
|
||||
## Example Output
|
||||
|
||||
```text
|
||||
azure_monitor_microsoft_storage_storageaccounts_used_capacity,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Bytes average=9065573,maximum=9065573,minimum=9065573,timeStamp="2021-11-08T09:52:00Z",total=9065573 1636368744000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_transactions,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Count average=1,count=6,maximum=1,minimum=0,timeStamp="2021-11-08T09:52:00Z",total=6 1636368744000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_ingress,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Bytes average=5822.333333333333,count=6,maximum=5833,minimum=0,timeStamp="2021-11-08T09:52:00Z",total=34934 1636368744000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_egress,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Bytes average=840.1666666666666,count=6,maximum=841,minimum=0,timeStamp="2021-11-08T09:52:00Z",total=5041 1636368744000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_success_server_latency,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=MilliSeconds average=12.833333333333334,count=6,maximum=30,minimum=8,timeStamp="2021-11-08T09:52:00Z",total=77 1636368744000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_success_e2e_latency,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=MilliSeconds average=12.833333333333334,count=6,maximum=30,minimum=8,timeStamp="2021-11-08T09:52:00Z",total=77 1636368744000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_availability,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Percent average=100,count=6,maximum=100,minimum=100,timeStamp="2021-11-08T09:52:00Z",total=600 1636368744000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_used_capacity,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Bytes average=9065573,maximum=9065573,minimum=9065573,timeStamp="2021-11-08T09:52:00Z",total=9065573 1636368745000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_transactions,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Count average=1,count=6,maximum=1,minimum=0,timeStamp="2021-11-08T09:52:00Z",total=6 1636368745000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_ingress,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Bytes average=5822.333333333333,count=6,maximum=5833,minimum=0,timeStamp="2021-11-08T09:52:00Z",total=34934 1636368745000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_egress,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Bytes average=840.1666666666666,count=6,maximum=841,minimum=0,timeStamp="2021-11-08T09:52:00Z",total=5041 1636368745000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_success_server_latency,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=MilliSeconds average=12.833333333333334,count=6,maximum=30,minimum=8,timeStamp="2021-11-08T09:52:00Z",total=77 1636368745000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_success_e2e_latency,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=MilliSeconds average=12.833333333333334,count=6,maximum=30,minimum=8,timeStamp="2021-11-08T09:52:00Z",total=77 1636368745000000000
|
||||
azure_monitor_microsoft_storage_storageaccounts_availability,host=Azure-MBP,namespace=Microsoft.Storage/storageAccounts,resource_group=azure-rg,resource_name=azuresa,resource_region=eastus,subscription_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,unit=Percent average=100,count=6,maximum=100,minimum=100,timeStamp="2021-11-08T09:52:00Z",total=600 1636368745000000000
|
||||
```
|
195
plugins/inputs/azure_monitor/azure_monitor.go
Normal file
195
plugins/inputs/azure_monitor/azure_monitor.go
Normal file
|
@ -0,0 +1,195 @@
|
|||
//go:generate ../../../tools/readme_config_includer/generator
|
||||
package azure_monitor
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
receiver "github.com/logzio/azure-monitor-metrics-receiver"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
)
|
||||
|
||||
type AzureMonitor struct {
|
||||
SubscriptionID string `toml:"subscription_id"`
|
||||
ClientID string `toml:"client_id"`
|
||||
ClientSecret string `toml:"client_secret"`
|
||||
TenantID string `toml:"tenant_id"`
|
||||
CloudOption string `toml:"cloud_option,omitempty"`
|
||||
ResourceTargets []*resourceTarget `toml:"resource_target"`
|
||||
ResourceGroupTargets []*resourceGroupTarget `toml:"resource_group_target"`
|
||||
SubscriptionTargets []*resource `toml:"subscription_target"`
|
||||
Log telegraf.Logger `toml:"-"`
|
||||
|
||||
receiver *receiver.AzureMonitorMetricsReceiver
|
||||
azureManager azureClientsCreator
|
||||
azureClients *receiver.AzureClients
|
||||
}
|
||||
|
||||
type resourceTarget struct {
|
||||
ResourceID string `toml:"resource_id"`
|
||||
Metrics []string `toml:"metrics"`
|
||||
Aggregations []string `toml:"aggregations"`
|
||||
}
|
||||
|
||||
type resourceGroupTarget struct {
|
||||
ResourceGroup string `toml:"resource_group"`
|
||||
Resources []*resource `toml:"resource"`
|
||||
}
|
||||
|
||||
type resource struct {
|
||||
ResourceType string `toml:"resource_type"`
|
||||
Metrics []string `toml:"metrics"`
|
||||
Aggregations []string `toml:"aggregations"`
|
||||
}
|
||||
|
||||
type azureClientsManager struct{}
|
||||
|
||||
type azureClientsCreator interface {
|
||||
createAzureClients(subscriptionID string, clientID string, clientSecret string, tenantID string,
|
||||
clientOptions azcore.ClientOptions) (*receiver.AzureClients, error)
|
||||
}
|
||||
|
||||
//go:embed sample.conf
|
||||
var sampleConfig string
|
||||
|
||||
func (*AzureMonitor) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (am *AzureMonitor) Init() error {
|
||||
var clientOptions azcore.ClientOptions
|
||||
switch am.CloudOption {
|
||||
case "AzureChina":
|
||||
clientOptions = azcore.ClientOptions{Cloud: cloud.AzureChina}
|
||||
case "AzureGovernment":
|
||||
clientOptions = azcore.ClientOptions{Cloud: cloud.AzureGovernment}
|
||||
case "", "AzurePublic":
|
||||
clientOptions = azcore.ClientOptions{Cloud: cloud.AzurePublic}
|
||||
default:
|
||||
return fmt.Errorf("unknown cloud option: %s", am.CloudOption)
|
||||
}
|
||||
|
||||
var err error
|
||||
am.azureClients, err = am.azureManager.createAzureClients(am.SubscriptionID, am.ClientID, am.ClientSecret, am.TenantID, clientOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = am.setReceiver(); err != nil {
|
||||
return fmt.Errorf("error setting Azure Monitor receiver: %w", err)
|
||||
}
|
||||
|
||||
if err = am.receiver.CreateResourceTargetsFromResourceGroupTargets(); err != nil {
|
||||
return fmt.Errorf("error creating resource targets from resource group targets: %w", err)
|
||||
}
|
||||
|
||||
if err = am.receiver.CreateResourceTargetsFromSubscriptionTargets(); err != nil {
|
||||
return fmt.Errorf("error creating resource targets from subscription targets: %w", err)
|
||||
}
|
||||
|
||||
if err = am.receiver.CheckResourceTargetsMetricsValidation(); err != nil {
|
||||
return fmt.Errorf("error checking resource targets metrics validation: %w", err)
|
||||
}
|
||||
|
||||
if err = am.receiver.SetResourceTargetsMetrics(); err != nil {
|
||||
return fmt.Errorf("error setting resource targets metrics: %w", err)
|
||||
}
|
||||
|
||||
if err = am.receiver.SplitResourceTargetsMetricsByMinTimeGrain(); err != nil {
|
||||
return fmt.Errorf("error splitting resource targets metrics by min time grain: %w", err)
|
||||
}
|
||||
|
||||
am.receiver.SplitResourceTargetsWithMoreThanMaxMetrics()
|
||||
am.receiver.SetResourceTargetsAggregations()
|
||||
|
||||
am.Log.Debug("Total resource targets: ", len(am.receiver.Targets.ResourceTargets))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (am *AzureMonitor) Gather(acc telegraf.Accumulator) error {
|
||||
var waitGroup sync.WaitGroup
|
||||
|
||||
for _, target := range am.receiver.Targets.ResourceTargets {
|
||||
am.Log.Debug("Collecting metrics for resource target ", target.ResourceID)
|
||||
waitGroup.Add(1)
|
||||
|
||||
go func(target *receiver.ResourceTarget) {
|
||||
defer waitGroup.Done()
|
||||
|
||||
collectedMetrics, notCollectedMetrics, err := am.receiver.CollectResourceTargetMetrics(target)
|
||||
if err != nil {
|
||||
acc.AddError(err)
|
||||
}
|
||||
|
||||
for _, collectedMetric := range collectedMetrics {
|
||||
acc.AddFields(collectedMetric.Name, collectedMetric.Fields, collectedMetric.Tags)
|
||||
}
|
||||
|
||||
for _, notCollectedMetric := range notCollectedMetrics {
|
||||
am.Log.Info("Did not get any metric value from Azure Monitor API for the metric ID ", notCollectedMetric)
|
||||
}
|
||||
}(target)
|
||||
}
|
||||
|
||||
waitGroup.Wait()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (am *AzureMonitor) setReceiver() error {
|
||||
resourceTargets := make([]*receiver.ResourceTarget, 0, len(am.ResourceTargets))
|
||||
resourceGroupTargets := make([]*receiver.ResourceGroupTarget, 0, len(am.ResourceGroupTargets))
|
||||
subscriptionTargets := make([]*receiver.Resource, 0, len(am.SubscriptionTargets))
|
||||
|
||||
for _, target := range am.ResourceTargets {
|
||||
resourceTargets = append(resourceTargets, receiver.NewResourceTarget(target.ResourceID, target.Metrics, target.Aggregations))
|
||||
}
|
||||
|
||||
for _, target := range am.ResourceGroupTargets {
|
||||
resources := make([]*receiver.Resource, 0, len(target.Resources))
|
||||
for _, resource := range target.Resources {
|
||||
resources = append(resources, receiver.NewResource(resource.ResourceType, resource.Metrics, resource.Aggregations))
|
||||
}
|
||||
|
||||
resourceGroupTargets = append(resourceGroupTargets, receiver.NewResourceGroupTarget(target.ResourceGroup, resources))
|
||||
}
|
||||
|
||||
for _, target := range am.SubscriptionTargets {
|
||||
subscriptionTargets = append(subscriptionTargets, receiver.NewResource(target.ResourceType, target.Metrics, target.Aggregations))
|
||||
}
|
||||
|
||||
targets := receiver.NewTargets(resourceTargets, resourceGroupTargets, subscriptionTargets)
|
||||
var err error
|
||||
am.receiver, err = receiver.NewAzureMonitorMetricsReceiver(am.SubscriptionID, targets, am.azureClients)
|
||||
return err
|
||||
}
|
||||
|
||||
func (*azureClientsManager) createAzureClients(
|
||||
subscriptionID, clientID, clientSecret, tenantID string,
|
||||
clientOptions azcore.ClientOptions,
|
||||
) (*receiver.AzureClients, error) {
|
||||
if clientSecret != "" {
|
||||
return receiver.CreateAzureClients(subscriptionID, clientID, clientSecret, tenantID, receiver.WithAzureClientOptions(&clientOptions))
|
||||
}
|
||||
|
||||
token, err := azidentity.NewDefaultAzureCredential(&azidentity.DefaultAzureCredentialOptions{TenantID: tenantID,
|
||||
ClientOptions: clientOptions})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating Azure token: %w", err)
|
||||
}
|
||||
return receiver.CreateAzureClientsWithCreds(subscriptionID, token, receiver.WithAzureClientOptions(&clientOptions))
|
||||
}
|
||||
|
||||
func init() {
|
||||
inputs.Add("azure_monitor", func() telegraf.Input {
|
||||
return &AzureMonitor{
|
||||
azureManager: &azureClientsManager{},
|
||||
}
|
||||
})
|
||||
}
|
1084
plugins/inputs/azure_monitor/azure_monitor_test.go
Normal file
1084
plugins/inputs/azure_monitor/azure_monitor_test.go
Normal file
File diff suppressed because it is too large
Load diff
77
plugins/inputs/azure_monitor/sample.conf
Normal file
77
plugins/inputs/azure_monitor/sample.conf
Normal file
|
@ -0,0 +1,77 @@
|
|||
# Gather Azure resources metrics from Azure Monitor API
|
||||
[[inputs.azure_monitor]]
|
||||
# can be found under Overview->Essentials in the Azure portal for your application/service
|
||||
subscription_id = "<<SUBSCRIPTION_ID>>"
|
||||
# can be obtained by registering an application under Azure Active Directory
|
||||
client_id = "<<CLIENT_ID>>"
|
||||
# can be obtained by registering an application under Azure Active Directory.
|
||||
# If not specified Default Azure Credentials chain will be attempted:
|
||||
# - Environment credentials (AZURE_*)
|
||||
# - Workload Identity in Kubernetes cluster
|
||||
# - Managed Identity
|
||||
# - Azure CLI auth
|
||||
# - Developer Azure CLI auth
|
||||
client_secret = "<<CLIENT_SECRET>>"
|
||||
# can be found under Azure Active Directory->Properties
|
||||
tenant_id = "<<TENANT_ID>>"
|
||||
# Define the optional Azure cloud option e.g. AzureChina, AzureGovernment or AzurePublic. The default is AzurePublic.
|
||||
# cloud_option = "AzurePublic"
|
||||
|
||||
# resource target #1 to collect metrics from
|
||||
[[inputs.azure_monitor.resource_target]]
|
||||
# can be found under Overview->Essentials->JSON View in the Azure portal for your application/service
|
||||
# must start with 'resourceGroups/...' ('/subscriptions/xxxxxxxx-xxxx-xxxx-xxx-xxxxxxxxxxxx'
|
||||
# must be removed from the beginning of Resource ID property value)
|
||||
resource_id = "<<RESOURCE_ID>>"
|
||||
# the metric names to collect
|
||||
# leave the array empty to use all metrics available to this resource
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
# metrics aggregation type value to collect
|
||||
# can be 'Total', 'Count', 'Average', 'Minimum', 'Maximum'
|
||||
# leave the array empty to collect all aggregation types values for each metric
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# resource target #2 to collect metrics from
|
||||
[[inputs.azure_monitor.resource_target]]
|
||||
resource_id = "<<RESOURCE_ID>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# resource group target #1 to collect metrics from resources under it with resource type
|
||||
[[inputs.azure_monitor.resource_group_target]]
|
||||
# the resource group name
|
||||
resource_group = "<<RESOURCE_GROUP_NAME>>"
|
||||
|
||||
# defines the resources to collect metrics from
|
||||
[[inputs.azure_monitor.resource_group_target.resource]]
|
||||
# the resource type
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# defines the resources to collect metrics from
|
||||
[[inputs.azure_monitor.resource_group_target.resource]]
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# resource group target #2 to collect metrics from resources under it with resource type
|
||||
[[inputs.azure_monitor.resource_group_target]]
|
||||
resource_group = "<<RESOURCE_GROUP_NAME>>"
|
||||
|
||||
[[inputs.azure_monitor.resource_group_target.resource]]
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# subscription target #1 to collect metrics from resources under it with resource type
|
||||
[[inputs.azure_monitor.subscription_target]]
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
||||
|
||||
# subscription target #2 to collect metrics from resources under it with resource type
|
||||
[[inputs.azure_monitor.subscription_target]]
|
||||
resource_type = "<<RESOURCE_TYPE>>"
|
||||
metrics = [ "<<METRIC>>", "<<METRIC>>" ]
|
||||
aggregations = [ "<<AGGREGATION>>", "<<AGGREGATION>>" ]
|
114
plugins/inputs/azure_monitor/testdata/json/azure_metric_definitions_responses.json
vendored
Normal file
114
plugins/inputs/azure_monitor/testdata/json/azure_metric_definitions_responses.json
vendored
Normal file
|
@ -0,0 +1,114 @@
|
|||
[
|
||||
[
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1",
|
||||
"name": {
|
||||
"value": "metric1"
|
||||
},
|
||||
"metricAvailabilities": [
|
||||
{
|
||||
"timeGrain": "PT1M"
|
||||
},
|
||||
{
|
||||
"timeGrain": "PT5M"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1",
|
||||
"name": {
|
||||
"value": "metric2"
|
||||
},
|
||||
"metricAvailabilities": [
|
||||
{
|
||||
"timeGrain": "PT1M"
|
||||
},
|
||||
{
|
||||
"timeGrain": "PT5M"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1",
|
||||
"name": {
|
||||
"value": "metric3"
|
||||
},
|
||||
"metricAvailabilities": [
|
||||
{
|
||||
"timeGrain": "PT5M"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type2/resource2",
|
||||
"name": {
|
||||
"value": "metric1"
|
||||
},
|
||||
"metricAvailabilities": [
|
||||
{
|
||||
"timeGrain": "PT1M"
|
||||
},
|
||||
{
|
||||
"timeGrain": "PT5M"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type2/resource2",
|
||||
"name": {
|
||||
"value": "metric2"
|
||||
},
|
||||
"metricAvailabilities": [
|
||||
{
|
||||
"timeGrain": "PT1M"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup2/providers/Microsoft.Test/type1/resource3",
|
||||
"name": {
|
||||
"value": "metric1"
|
||||
},
|
||||
"metricAvailabilities": [
|
||||
{
|
||||
"timeGrain": "PT1M"
|
||||
},
|
||||
{
|
||||
"timeGrain": "PT5M"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup2/providers/Microsoft.Test/type1/resource3",
|
||||
"name": {
|
||||
"value": "metric2"
|
||||
},
|
||||
"metricAvailabilities": [
|
||||
{
|
||||
"timeGrain": "PT1M"
|
||||
},
|
||||
{
|
||||
"timeGrain": "PT5M"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup2/providers/Microsoft.Test/type1/resource3",
|
||||
"name": {
|
||||
"value": "metric3"
|
||||
},
|
||||
"metricAvailabilities": [
|
||||
{
|
||||
"timeGrain": "PT1M"
|
||||
},
|
||||
{
|
||||
"timeGrain": "PT5M"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
243
plugins/inputs/azure_monitor/testdata/json/azure_metrics_responses.json
vendored
Normal file
243
plugins/inputs/azure_monitor/testdata/json/azure_metrics_responses.json
vendored
Normal file
|
@ -0,0 +1,243 @@
|
|||
[
|
||||
{
|
||||
"namespace": "Microsoft.Test/type1",
|
||||
"resourceregion": "eastus",
|
||||
"value": [
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1/providers/Microsoft.Insights/metrics/metric1",
|
||||
"name": {
|
||||
"localizedValue": "metric1"
|
||||
},
|
||||
"unit": "Count",
|
||||
"timeseries": [
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:00:00Z",
|
||||
"total": 1.0,
|
||||
"maximum": 1.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:01:00Z",
|
||||
"total": 2.0,
|
||||
"maximum": 2.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:02:00Z",
|
||||
"total": 2.5,
|
||||
"maximum": 2.5
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:58:00Z",
|
||||
"total": 2.0,
|
||||
"maximum": 2.5
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:59:00Z",
|
||||
"total": 5.0,
|
||||
"maximum": 5.0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errorCode": "Success"
|
||||
},
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1/providers/Microsoft.Insights/metrics/metric2",
|
||||
"name": {
|
||||
"localizedValue": "metric2"
|
||||
},
|
||||
"unit": "Count",
|
||||
"timeseries": [
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:00:00Z",
|
||||
"total": 2.0,
|
||||
"maximum": 2.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:01:00Z",
|
||||
"total": 1.0,
|
||||
"maximum": 2.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:02:00Z",
|
||||
"total": 1.0,
|
||||
"maximum": 2.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:58:00Z",
|
||||
"total": 2.5,
|
||||
"maximum": 2.5
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:59:00Z",
|
||||
"total": 2.5,
|
||||
"maximum": 2.5
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errorCode": "Success"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"namespace": "Microsoft.Test/type2",
|
||||
"resourceregion": "eastus",
|
||||
"value": [
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type2/resource2/providers/Microsoft.Insights/metrics/metric1",
|
||||
"name": {
|
||||
"localizedValue": "metric1"
|
||||
},
|
||||
"unit": "Count",
|
||||
"timeseries": [
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:00:00Z",
|
||||
"total": 5.0,
|
||||
"minimum": 5.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:01:00Z",
|
||||
"total": 3.0,
|
||||
"minimum": 3.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:02:00Z",
|
||||
"total": 5.0,
|
||||
"minimum": 3.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:58:00Z",
|
||||
"total": 2.5,
|
||||
"minimum": 2.5
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:59:00Z",
|
||||
"total": 5.0,
|
||||
"minimum": 2.5
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errorCode": "Success"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"namespace": "Microsoft.Test/type1",
|
||||
"resourceregion": "eastus",
|
||||
"value": [
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup2/providers/Microsoft.Test/type1/resource3/providers/Microsoft.Insights/metrics/metric1",
|
||||
"name": {
|
||||
"localizedValue": "metric1"
|
||||
},
|
||||
"unit": "Bytes",
|
||||
"timeseries": [
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:00:00Z",
|
||||
"total": 5.0,
|
||||
"minimum": 5.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:01:00Z",
|
||||
"total": 3.0,
|
||||
"minimum": 3.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:02:00Z",
|
||||
"total": 5.0,
|
||||
"minimum": 3.0
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:58:00Z",
|
||||
"total": 2.5,
|
||||
"minimum": 2.5
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:59:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errorCode": "Success"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"namespace": "Microsoft.Test/type2",
|
||||
"resourceregion": "eastus",
|
||||
"value": [
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup2/providers/Microsoft.Test/type2/resource4/providers/Microsoft.Insights/metrics/metric1",
|
||||
"name": {
|
||||
"localizedValue": "metric1"
|
||||
},
|
||||
"unit": "Bytes",
|
||||
"timeseries": [
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:00:00Z"
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:01:00Z"
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:02:00Z"
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:58:00Z"
|
||||
},
|
||||
{
|
||||
"timeStamp": "2022-02-22T22:59:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errorCode": "Success"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"namespace": "Microsoft.Test/type2",
|
||||
"resourceregion": "eastus",
|
||||
"value": [
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup2/providers/Microsoft.Test/type2/resource5/providers/Microsoft.Insights/metrics/metric2",
|
||||
"name": {
|
||||
"localizedValue": "metric2"
|
||||
},
|
||||
"unit": "Bytes",
|
||||
"timeseries": [
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
],
|
||||
"errorCode": "Success"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"namespace": "Microsoft.Test/type2",
|
||||
"resourceregion": "eastus",
|
||||
"value": [
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup2/providers/Microsoft.Test/type2/resource6/providers/Microsoft.Insights/metrics/metric2",
|
||||
"name": {
|
||||
"localizedValue": "metric2"
|
||||
},
|
||||
"unit": "Bytes",
|
||||
"timeseries": [],
|
||||
"errorCode": "Success"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
14
plugins/inputs/azure_monitor/testdata/json/azure_resources_response.json
vendored
Normal file
14
plugins/inputs/azure_monitor/testdata/json/azure_resources_response.json
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
[
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1",
|
||||
"type": "Microsoft.Test/type1"
|
||||
},
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup1/providers/Microsoft.Test/type2/resource2",
|
||||
"type": "Microsoft.Test/type2"
|
||||
},
|
||||
{
|
||||
"id": "/subscriptions/subscriptionID/resourceGroups/resourceGroup2/providers/Microsoft.Test/type1/resource3",
|
||||
"type": "Microsoft.Test/type1"
|
||||
}
|
||||
]
|
34
plugins/inputs/azure_monitor/testdata/toml/gather_success.toml
vendored
Normal file
34
plugins/inputs/azure_monitor/testdata/toml/gather_success.toml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = ["metric1", "metric2"]
|
||||
aggregations = ["Total", "Maximum"]
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type2/resource2"
|
||||
metrics = ["metric1"]
|
||||
aggregations = ["Total", "Minimum"]
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup2/providers/Microsoft.Test/type1/resource3"
|
||||
metrics = ["metric1"]
|
||||
aggregations = ["Total", "Minimum"]
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup2/providers/Microsoft.Test/type2/resource4"
|
||||
metrics = ["metric1"]
|
||||
aggregations = ["Total", "Maximum"]
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup2/providers/Microsoft.Test/type2/resource5"
|
||||
metrics = ["metric2"]
|
||||
aggregations = ["Total"]
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup2/providers/Microsoft.Test/type2/resource6"
|
||||
metrics = ["metric2"]
|
||||
aggregations = ["Average"]
|
10
plugins/inputs/azure_monitor/testdata/toml/gather_success_cloud_option_china.toml
vendored
Normal file
10
plugins/inputs/azure_monitor/testdata/toml/gather_success_cloud_option_china.toml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
cloud_option = "AzureChina"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = ["metric1", "metric2"]
|
||||
aggregations = ["Total", "Maximum"]
|
10
plugins/inputs/azure_monitor/testdata/toml/gather_success_cloud_option_government.toml
vendored
Normal file
10
plugins/inputs/azure_monitor/testdata/toml/gather_success_cloud_option_government.toml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
cloud_option = "AzureGovernment"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = ["metric1", "metric2"]
|
||||
aggregations = ["Total", "Maximum"]
|
10
plugins/inputs/azure_monitor/testdata/toml/gather_success_cloud_option_public.toml
vendored
Normal file
10
plugins/inputs/azure_monitor/testdata/toml/gather_success_cloud_option_public.toml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
cloud_option = "AzurePublic"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = ["metric1", "metric2"]
|
||||
aggregations = ["Total", "Maximum"]
|
90
plugins/inputs/azure_monitor/testdata/toml/init_all_target_types.toml
vendored
Normal file
90
plugins/inputs/azure_monitor/testdata/toml/init_all_target_types.toml
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type2/resource2"
|
||||
metrics = ["metric1", "metric2"]
|
||||
aggregations = []
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup2/providers/Microsoft.Test/type1/resource3"
|
||||
metrics = []
|
||||
aggregations = ["Total"]
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type2/resource2"
|
||||
metrics = []
|
||||
aggregations = []
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = []
|
||||
aggregations = []
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup1"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = []
|
||||
aggregations = []
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = []
|
||||
aggregations = ["Average"]
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = ["metric2"]
|
||||
aggregations = []
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = ["metric2"]
|
||||
aggregations = []
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup2"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = ["metric3"]
|
||||
aggregations = ["Total", "Average"]
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = []
|
||||
aggregations = ["Average"]
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = ["metric2"]
|
||||
aggregations = []
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = []
|
||||
aggregations = []
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = []
|
||||
aggregations = []
|
9
plugins/inputs/azure_monitor/testdata/toml/init_bad_credentials.toml
vendored
Normal file
9
plugins/inputs/azure_monitor/testdata/toml/init_bad_credentials.toml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = []
|
||||
aggregations = []
|
8
plugins/inputs/azure_monitor/testdata/toml/init_no_client_id.toml
vendored
Normal file
8
plugins/inputs/azure_monitor/testdata/toml/init_no_client_id.toml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = []
|
||||
aggregations = []
|
8
plugins/inputs/azure_monitor/testdata/toml/init_no_client_secret.toml
vendored
Normal file
8
plugins/inputs/azure_monitor/testdata/toml/init_no_client_secret.toml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = []
|
||||
aggregations = []
|
8
plugins/inputs/azure_monitor/testdata/toml/init_no_subscription_id.toml
vendored
Normal file
8
plugins/inputs/azure_monitor/testdata/toml/init_no_subscription_id.toml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = []
|
||||
aggregations = []
|
4
plugins/inputs/azure_monitor/testdata/toml/init_no_targets.toml
vendored
Normal file
4
plugins/inputs/azure_monitor/testdata/toml/init_no_targets.toml
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
8
plugins/inputs/azure_monitor/testdata/toml/init_no_tenant_id.toml
vendored
Normal file
8
plugins/inputs/azure_monitor/testdata/toml/init_no_tenant_id.toml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = []
|
||||
aggregations = []
|
12
plugins/inputs/azure_monitor/testdata/toml/init_resource_group_target_no_resource_found.toml
vendored
Normal file
12
plugins/inputs/azure_monitor/testdata/toml/init_resource_group_target_no_resource_found.toml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup2"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = ["metric1", "metric2"]
|
||||
aggregations = ["Total"]
|
|
@ -0,0 +1,12 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup1"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = []
|
||||
aggregations = ["Invalid"]
|
12
plugins/inputs/azure_monitor/testdata/toml/init_resource_group_target_with_invalid_metric.toml
vendored
Normal file
12
plugins/inputs/azure_monitor/testdata/toml/init_resource_group_target_with_invalid_metric.toml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup1"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = ["invalid"]
|
||||
aggregations = []
|
|
@ -0,0 +1,12 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "invalid"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
|
@ -0,0 +1,12 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup1"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/invalid"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
|
@ -0,0 +1,11 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup1"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
metrics = []
|
||||
aggregations = []
|
|
@ -0,0 +1,11 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_group_target]]
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = []
|
||||
aggregations = []
|
7
plugins/inputs/azure_monitor/testdata/toml/init_resource_group_target_without_resources.toml
vendored
Normal file
7
plugins/inputs/azure_monitor/testdata/toml/init_resource_group_target_without_resources.toml
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup1"
|
40
plugins/inputs/azure_monitor/testdata/toml/init_resource_group_targets_only.toml
vendored
Normal file
40
plugins/inputs/azure_monitor/testdata/toml/init_resource_group_targets_only.toml
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup1"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = []
|
||||
aggregations = []
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = []
|
||||
aggregations = ["Average"]
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = ["metric2"]
|
||||
aggregations = []
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = ["metric2"]
|
||||
aggregations = []
|
||||
|
||||
[[resource_group_target]]
|
||||
resource_group = "resourceGroup2"
|
||||
|
||||
[[resource_group_target.resource]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = ["metric3"]
|
||||
aggregations = ["Total", "Average"]
|
|
@ -0,0 +1,9 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Invalid"]
|
9
plugins/inputs/azure_monitor/testdata/toml/init_resource_target_with_invalid_metric.toml
vendored
Normal file
9
plugins/inputs/azure_monitor/testdata/toml/init_resource_target_with_invalid_metric.toml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = ["invalid"]
|
||||
aggregations = []
|
|
@ -0,0 +1,9 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "invalid"
|
||||
metrics = []
|
||||
aggregations = []
|
8
plugins/inputs/azure_monitor/testdata/toml/init_resource_target_without_resource_id.toml
vendored
Normal file
8
plugins/inputs/azure_monitor/testdata/toml/init_resource_target_without_resource_id.toml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
29
plugins/inputs/azure_monitor/testdata/toml/init_resource_targets_only.toml
vendored
Normal file
29
plugins/inputs/azure_monitor/testdata/toml/init_resource_targets_only.toml
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type2/resource2"
|
||||
metrics = ["metric1", "metric2"]
|
||||
aggregations = []
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup2/providers/Microsoft.Test/type1/resource3"
|
||||
metrics = []
|
||||
aggregations = ["Total"]
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type2/resource2"
|
||||
metrics = []
|
||||
aggregations = []
|
||||
|
||||
[[resource_target]]
|
||||
resource_id = "resourceGroups/resourceGroup1/providers/Microsoft.Test/type1/resource1"
|
||||
metrics = []
|
||||
aggregations = []
|
9
plugins/inputs/azure_monitor/testdata/toml/init_subscription_target_no_resource_found.toml
vendored
Normal file
9
plugins/inputs/azure_monitor/testdata/toml/init_subscription_target_no_resource_found.toml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type3"
|
||||
metrics = ["metric1", "metric2"]
|
||||
aggregations = ["Total"]
|
|
@ -0,0 +1,9 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = []
|
||||
aggregations = ["Invalid"]
|
9
plugins/inputs/azure_monitor/testdata/toml/init_subscription_target_with_invalid_metric.toml
vendored
Normal file
9
plugins/inputs/azure_monitor/testdata/toml/init_subscription_target_with_invalid_metric.toml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = ["invalid"]
|
||||
aggregations = []
|
|
@ -0,0 +1,9 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/invalid"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
|
@ -0,0 +1,8 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[subscription_target]]
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
29
plugins/inputs/azure_monitor/testdata/toml/init_subscription_targets_only.toml
vendored
Normal file
29
plugins/inputs/azure_monitor/testdata/toml/init_subscription_targets_only.toml
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
subscription_id = "subscriptionID"
|
||||
client_id = "clientID"
|
||||
client_secret = "clientSecret"
|
||||
tenant_id = "tenantID"
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = ["metric1", "metric2", "metric3"]
|
||||
aggregations = ["Total", "Average"]
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = []
|
||||
aggregations = ["Average"]
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = ["metric2"]
|
||||
aggregations = []
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type2"
|
||||
metrics = []
|
||||
aggregations = []
|
||||
|
||||
[[subscription_target]]
|
||||
resource_type = "Microsoft.Test/type1"
|
||||
metrics = []
|
||||
aggregations = []
|
Loading…
Add table
Add a link
Reference in a new issue