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 (
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"type": "sesnsor",
|
||||
"type": "sensor",
|
||||
"fqname": "hue_sensor_info",
|
||||
"help": "Non-numeric data, value is always 1",
|
||||
"labels": [
|
2
main.go
2
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")
|
||||
|
|
Loading…
Reference in a new issue