From 7a4103869593dac333eaeff7e3f18a1a9bdcfa61 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Fri, 7 Dec 2018 10:40:45 +0100 Subject: [PATCH 1/2] Add Azure tenant and subscription ID labels Signed-off-by: Fabian Reinartz --- discovery/azure/azure.go | 4 ++++ docs/configuration/configuration.md | 2 ++ 2 files changed, 6 insertions(+) diff --git a/discovery/azure/azure.go b/discovery/azure/azure.go index 4164325d6..a5d97acec 100644 --- a/discovery/azure/azure.go +++ b/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), diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 5b8b70ea4..a0d069c3e 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -259,6 +259,8 @@ Azure SD configurations allow retrieving scrape targets from Azure VMs. The following meta labels are available on targets during relabeling: +* `__meta_azure_subscription_id`: the subscription ID +* `__meta_azure_tenant_id`: the tenant ID * `__meta_azure_machine_id`: the machine ID * `__meta_azure_machine_location`: the location the machine runs in * `__meta_azure_machine_name`: the machine name From 93d13c59d01047e1e28b5558baf56100aefcfa94 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Sun, 23 Dec 2018 13:06:36 +0100 Subject: [PATCH 2/2] Sort Signed-off-by: Fabian Reinartz --- docs/configuration/configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index a0d069c3e..545fa8394 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -259,8 +259,6 @@ Azure SD configurations allow retrieving scrape targets from Azure VMs. The following meta labels are available on targets during relabeling: -* `__meta_azure_subscription_id`: the subscription ID -* `__meta_azure_tenant_id`: the tenant ID * `__meta_azure_machine_id`: the machine ID * `__meta_azure_machine_location`: the location the machine runs in * `__meta_azure_machine_name`: the machine name @@ -269,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_`: 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: