Skip to content

Commit

Permalink
Add GCE Instance Status
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikschulz committed Oct 8, 2016
1 parent 0cf8586 commit c73aa82
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions retrieval/discovery/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ import (
)

const (
gceLabel = model.MetaLabelPrefix + "gce_"
gceLabelProject = gceLabel + "project"
gceLabelZone = gceLabel + "zone"
gceLabelNetwork = gceLabel + "network"
gceLabelSubnetwork = gceLabel + "subnetwork"
gceLabelPublicIP = gceLabel + "public_ip"
gceLabelPrivateIP = gceLabel + "private_ip"
gceLabelInstanceName = gceLabel + "instance_name"
gceLabelTags = gceLabel + "tags"
gceLabel = model.MetaLabelPrefix + "gce_"
gceLabelProject = gceLabel + "project"
gceLabelZone = gceLabel + "zone"
gceLabelNetwork = gceLabel + "network"
gceLabelSubnetwork = gceLabel + "subnetwork"
gceLabelPublicIP = gceLabel + "public_ip"
gceLabelPrivateIP = gceLabel + "private_ip"
gceLabelInstanceName = gceLabel + "instance_name"
gceLabelInstanceStatus = gceLabel + "instance_status"
gceLabelTags = gceLabel + "tags"

// Constants for instrumentation.
namespace = "prometheus"
Expand Down Expand Up @@ -164,9 +165,10 @@ func (gd *GCEDiscovery) refresh() (tg *config.TargetGroup, err error) {
continue
}
labels := model.LabelSet{
gceLabelProject: model.LabelValue(gd.project),
gceLabelZone: model.LabelValue(inst.Zone),
gceLabelInstanceName: model.LabelValue(inst.Name),
gceLabelProject: model.LabelValue(gd.project),
gceLabelZone: model.LabelValue(inst.Zone),
gceLabelInstanceName: model.LabelValue(inst.Name),
gceLabelInstanceStatus: model.LabelValue(inst.Status),
}
priIface := inst.NetworkInterfaces[0]
labels[gceLabelNetwork] = model.LabelValue(priIface.Network)
Expand Down

0 comments on commit c73aa82

Please sign in to comment.