Browse Source

Add AMI to labels scraped during service discovery. (#7386)

Signed-off-by: Martin Lee <martin@martinlee.org>
pull/7391/head
Martin Lee 5 years ago committed by GitHub
parent
commit
b5d61fb66c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      discovery/ec2/ec2.go
  2. 1
      docs/configuration/configuration.md

2
discovery/ec2/ec2.go

@ -38,6 +38,7 @@ import (
const (
ec2Label = model.MetaLabelPrefix + "ec2_"
ec2LabelAMI = ec2Label + "ami"
ec2LabelAZ = ec2Label + "availability_zone"
ec2LabelArch = ec2Label + "architecture"
ec2LabelInstanceID = ec2Label + "instance_id"
@ -212,6 +213,7 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
labels[ec2LabelPublicDNS] = model.LabelValue(*inst.PublicDnsName)
}
labels[ec2LabelAMI] = model.LabelValue(*inst.ImageId)
labels[ec2LabelAZ] = model.LabelValue(*inst.Placement.AvailabilityZone)
labels[ec2LabelInstanceState] = model.LabelValue(*inst.State.Name)
labels[ec2LabelInstanceType] = model.LabelValue(*inst.InstanceType)

1
docs/configuration/configuration.md

@ -426,6 +426,7 @@ the public IP address with relabeling.
The following meta labels are available on targets during [relabeling](#relabel_config):
* `__meta_ec2_ami`: the EC2 Amazon Machine Image
* `__meta_ec2_architecture`: the architecture of the instance
* `__meta_ec2_availability_zone`: the availability zone in which the instance is running
* `__meta_ec2_instance_id`: the EC2 instance ID

Loading…
Cancel
Save