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")