Skip to content

Commit

Permalink
sort labels in main.go and in README
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mk committed Oct 29, 2019
1 parent 6a19fba commit e100dd6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,22 @@ Here is a Prometheus `scrape_config` snippet that configures Prometheus to scrap

The following meta labels are available on targets during relabeling at the moment:

* `__meta_packet_hostname`
* `__meta_packet_state`
* `__meta_packet_billing_cycle`
* `__meta_packet_plan`
* `__meta_packet_device_id`
* `__meta_packet_facility`
* `__meta_packet_hostname`
* `__meta_packet_operating_system`
* `__meta_packet_organization_name`
* `__meta_packet_plan`
* `__meta_packet_private_ipv4`
* `__meta_packet_project_id`
* `__meta_packet_project_name`
* `__meta_packet_public_ipv4`
* `__meta_packet_public_ipv6`
* `__meta_packet_tags`
* `__meta_packet_device_id`
* `__meta_packet_short_id`
* `__meta_packet_project_id`
* `__meta_packet_project_name`
* `__meta_packet_organization_name`
* `__meta_packet_operating_system`
* `__meta_packet_state`
* `__meta_packet_switch_uuid
* `__meta_packet_tags`



Expand Down
19 changes: 9 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,22 @@ func (d *packetDiscoverer) createTarget(device *packngo.Device) *targetgroup.Gro
},
Labels: model.LabelSet{
model.AddressLabel: model.LabelValue(addr),

model.LabelName(labelName("hostname")): model.LabelValue(device.Hostname),
model.LabelName(labelName("state")): model.LabelValue(device.State),
model.LabelName(labelName("billing_cycle")): model.LabelValue(device.BillingCycle),
model.LabelName(labelName("plan")): model.LabelValue(device.Plan.Slug),
model.LabelName(labelName("device_id")): model.LabelValue(device.ID),
model.LabelName(labelName("facility")): model.LabelValue(device.Facility.Code),
model.LabelName(labelName("hostname")): model.LabelValue(device.Hostname),
model.LabelName(labelName("operating_system")): model.LabelValue(device.OS.Slug),
model.LabelName(labelName("organization_name")): model.LabelValue(device.Project.Organization.Name),
model.LabelName(labelName("plan")): model.LabelValue(device.Plan.Slug),
model.LabelName(labelName("private_ipv4")): model.LabelValue(networkInfo.PrivateIPv4),
model.LabelName(labelName("project_id")): model.LabelValue(device.Project.ID),
model.LabelName(labelName("project_name")): model.LabelValue(device.Project.Name),
model.LabelName(labelName("public_ipv4")): model.LabelValue(networkInfo.PublicIPv4),
model.LabelName(labelName("public_ipv6")): model.LabelValue(networkInfo.PublicIPv6),
model.LabelName(labelName("tags")): model.LabelValue(tags),
model.LabelName(labelName("device_id")): model.LabelValue(device.ID),
model.LabelName(labelName("short_id")): model.LabelValue(device.ShortID),
model.LabelName(labelName("project_id")): model.LabelValue(device.Project.ID),
model.LabelName(labelName("project_name")): model.LabelValue(device.Project.Name),
model.LabelName(labelName("organization_name")): model.LabelValue(device.Project.Organization.Name),
model.LabelName(labelName("operating_system")): model.LabelValue(device.OS.Slug),
model.LabelName(labelName("state")): model.LabelValue(device.State),
model.LabelName(labelName("switch_uuid")): model.LabelValue(device.SwitchUUID),
model.LabelName(labelName("tags")): model.LabelValue(tags),
},
}
}
Expand Down

0 comments on commit e100dd6

Please sign in to comment.