Browse Source

Merge pull request #4969 from prometheus/azuresubid

Add Azure tenant and subscription ID labels
pull/5071/head
Fabian Reinartz 6 years ago committed by GitHub
parent
commit
ca93c8e19b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      discovery/azure/azure.go
  2. 2
      docs/configuration/configuration.md

4
discovery/azure/azure.go

@ -37,6 +37,8 @@ import (
const (
azureLabel = model.MetaLabelPrefix + "azure_"
azureLabelSubscriptionID = azureLabel + "subscription_id"
azureLabelTenantID = azureLabel + "tenant_id"
azureLabelMachineID = azureLabel + "machine_id"
azureLabelMachineResourceGroup = azureLabel + "machine_resource_group"
azureLabelMachineName = azureLabel + "machine_name"
@ -332,6 +334,8 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
}
labels := model.LabelSet{
azureLabelSubscriptionID: model.LabelValue(d.cfg.SubscriptionID),
azureLabelTenantID: model.LabelValue(d.cfg.TenantID),
azureLabelMachineID: model.LabelValue(vm.ID),
azureLabelMachineName: model.LabelValue(vm.Name),
azureLabelMachineOSType: model.LabelValue(vm.OsType),

2
docs/configuration/configuration.md

@ -267,6 +267,8 @@ The following meta labels are available on targets during relabeling:
* `__meta_azure_machine_resource_group`: the machine's resource group
* `__meta_azure_machine_tag_<tagname>`: each tag value of the machine
* `__meta_azure_machine_scale_set`: the name of the scale set which the vm is part of (this value is only set if you are using a [scale set](https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/))
* `__meta_azure_subscription_id`: the subscription ID
* `__meta_azure_tenant_id`: the tenant ID
See below for the configuration options for Azure discovery:

Loading…
Cancel
Save