mirror of
https://github.com/prometheus/prometheus
synced 2024-12-24 23:42:32 +00:00
Add azure public ip label (#5475)
* Update Azure SD Config with Public IP label Signed-off-by: earthmant <trammell@cloudify.co>
This commit is contained in:
parent
3cc5f9d880
commit
35be8c9e25
@ -48,6 +48,7 @@ const (
|
||||
azureLabelMachineOSType = azureLabel + "machine_os_type"
|
||||
azureLabelMachineLocation = azureLabel + "machine_location"
|
||||
azureLabelMachinePrivateIP = azureLabel + "machine_private_ip"
|
||||
azureLabelMachinePublicIP = azureLabel + "machine_public_ip"
|
||||
azureLabelMachineTag = azureLabel + "machine_tag_"
|
||||
azureLabelMachineScaleSet = azureLabel + "machine_scale_set"
|
||||
|
||||
@ -334,6 +335,9 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
||||
|
||||
if *networkInterface.Primary {
|
||||
for _, ip := range *networkInterface.IPConfigurations {
|
||||
if ip.PublicIPAddress != nil {
|
||||
labels[azureLabelMachinePublicIP] = model.LabelValue(*ip.PublicIPAddress.IPAddress)
|
||||
}
|
||||
if ip.PrivateIPAddress != nil {
|
||||
labels[azureLabelMachinePrivateIP] = model.LabelValue(*ip.PrivateIPAddress)
|
||||
address := net.JoinHostPort(*ip.PrivateIPAddress, fmt.Sprintf("%d", d.port))
|
||||
|
@ -274,6 +274,7 @@ The following meta labels are available on targets during relabeling:
|
||||
* `__meta_azure_machine_name`: the machine name
|
||||
* `__meta_azure_machine_os_type`: the machine operating system
|
||||
* `__meta_azure_machine_private_ip`: the machine's private IP
|
||||
* `__meta_azure_machine_public_ip`: the machine's public IP if it exists
|
||||
* `__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/))
|
||||
|
Loading…
Reference in New Issue
Block a user