mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-23 11:41:54 -08:00
Add AMI to labels scraped during service discovery. (#7386)
Signed-off-by: Martin Lee <martin@martinlee.org>
This commit is contained in:
parent
7c31fe1541
commit
b5d61fb66c
|
@ -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)
|
||||
|
|
|
@ -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…
Reference in a new issue