From c73aa8258970666abc331156182af0b50fcab841 Mon Sep 17 00:00:00 2001 From: Dominik Schulz Date: Sat, 8 Oct 2016 08:40:12 +0200 Subject: [PATCH] Add GCE Instance Status --- retrieval/discovery/gce.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/retrieval/discovery/gce.go b/retrieval/discovery/gce.go index 0b9116bfa..7d20c5701 100644 --- a/retrieval/discovery/gce.go +++ b/retrieval/discovery/gce.go @@ -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" @@ -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)