metric file rename
This commit is contained in:
parent
050d40cf27
commit
06b264fdd5
3 changed files with 10 additions and 2 deletions
|
@ -23,6 +23,7 @@ type collectEntry struct {
|
||||||
const (
|
const (
|
||||||
typeLight = "light"
|
typeLight = "light"
|
||||||
typeSensor = "sensor"
|
typeSensor = "sensor"
|
||||||
|
typeBridge = "bridge"
|
||||||
|
|
||||||
labelName = "name"
|
labelName = "name"
|
||||||
labelType = "type"
|
labelType = "type"
|
||||||
|
@ -127,12 +128,19 @@ func (exporter *Exporter) Collect(metrics []*metric.Metric) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bridgeData, err := collectBridgeInfo(bridge)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for _, metric := range metrics {
|
for _, metric := range metrics {
|
||||||
switch metric.HueType {
|
switch metric.HueType {
|
||||||
case typeLight:
|
case typeLight:
|
||||||
metric.MetricResult = lightData
|
metric.MetricResult = lightData
|
||||||
case typeSensor:
|
case typeSensor:
|
||||||
metric.MetricResult = sensorData
|
metric.MetricResult = sensorData
|
||||||
|
case typeBridge:
|
||||||
|
metric.MetricResult = bridgeData
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("Type '%v' currently not supported", metric.HueType)
|
return fmt.Errorf("Type '%v' currently not supported", metric.HueType)
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "sesnsor",
|
"type": "sensor",
|
||||||
"fqname": "hue_sensor_info",
|
"fqname": "hue_sensor_info",
|
||||||
"help": "Non-numeric data, value is always 1",
|
"help": "Non-numeric data, value is always 1",
|
||||||
"labels": [
|
"labels": [
|
2
main.go
2
main.go
|
@ -20,7 +20,7 @@ var (
|
||||||
flagBridgeURL = flag.String("hue-url", "", "The URL of the bridge")
|
flagBridgeURL = flag.String("hue-url", "", "The URL of the bridge")
|
||||||
flagUsername = flag.String("username", "", "The username token having bridge access")
|
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.")
|
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")
|
flagTest = flag.Bool("test", false, "test configured metrics")
|
||||||
flagCollect = flag.Bool("collect", false, "test configured metrics")
|
flagCollect = flag.Bool("collect", false, "test configured metrics")
|
||||||
|
|
Loading…
Reference in a new issue