From 06b264fdd5f755c9a068c8de089bbc5997341852 Mon Sep 17 00:00:00 2001 From: aexel90 Date: Tue, 29 Dec 2020 14:24:09 +0100 Subject: [PATCH] metric file rename --- hue/hue.go | 8 ++++++++ metrics.json => hue_metrics.json | 2 +- main.go | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) rename metrics.json => hue_metrics.json (98%) diff --git a/hue/hue.go b/hue/hue.go index 59700bd..8eccbe5 100644 --- a/hue/hue.go +++ b/hue/hue.go @@ -23,6 +23,7 @@ type collectEntry struct { const ( typeLight = "light" typeSensor = "sensor" + typeBridge = "bridge" labelName = "name" labelType = "type" @@ -127,12 +128,19 @@ func (exporter *Exporter) Collect(metrics []*metric.Metric) (err error) { return err } + bridgeData, err := collectBridgeInfo(bridge) + if err != nil { + return err + } + for _, metric := range metrics { switch metric.HueType { case typeLight: metric.MetricResult = lightData case typeSensor: metric.MetricResult = sensorData + case typeBridge: + metric.MetricResult = bridgeData default: return fmt.Errorf("Type '%v' currently not supported", metric.HueType) } diff --git a/metrics.json b/hue_metrics.json similarity index 98% rename from metrics.json rename to hue_metrics.json index aa3c7cd..3b17f21 100644 --- a/metrics.json +++ b/hue_metrics.json @@ -32,7 +32,7 @@ ] }, { - "type": "sesnsor", + "type": "sensor", "fqname": "hue_sensor_info", "help": "Non-numeric data, value is always 1", "labels": [ diff --git a/main.go b/main.go index 88709ff..254b0ae 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,7 @@ var ( flagBridgeURL = flag.String("hue-url", "", "The URL of the bridge") flagUsername = flag.String("username", "", "The username token having bridge access") flagAddress = flag.String("listen-address", "127.0.0.1:9773", "The address to listen on for HTTP requests.") - flagMetricsFile = flag.String("metrics-file", "metrics.json", "The JSON file with the metric definitions.") + flagMetricsFile = flag.String("metrics-file", "hue_metrics.json", "The JSON file with the metric definitions.") flagTest = flag.Bool("test", false, "test configured metrics") flagCollect = flag.Bool("collect", false, "test configured metrics")