This commit is contained in:
aexel90 2022-10-18 23:51:18 +02:00
parent c98d4269ba
commit e2aa30cb2c
3 changed files with 100 additions and 67 deletions

View file

@ -9,6 +9,7 @@ RUN go build -o /hue_exporter
FROM alpine:latest FROM alpine:latest
WORKDIR / WORKDIR /
COPY --from=build /hue_exporter /hue_exporter COPY --from=build /hue_exporter /hue_exporter
COPY hue_metrics.json ./
EXPOSE 9773 EXPOSE 9773
ENTRYPOINT [ "sh", "-c", "/hue_exporter -username ${USERNAME} -hue-url ${HUE_URL} -metrics-file ${METRICS_FILE} " ] ENTRYPOINT [ "sh", "-c", "/hue_exporter -username ${USERNAME} -hue-url ${HUE_URL} -metrics-file hue_metrics.json" ]

View file

@ -8,6 +8,7 @@ services:
dockerfile: ./Dockerfile.multistage dockerfile: ./Dockerfile.multistage
restart: unless-stopped restart: unless-stopped
container_name: hue_exporter container_name: hue_exporter
network_mode: "host"
ports: ports:
- 9773:9773 - 9773:9773
env_file: env_file:

View file

@ -25,15 +25,12 @@
"fiscalYearStartMonth": 0, "fiscalYearStartMonth": 0,
"gnetId": 13645, "gnetId": 13645,
"graphTooltip": 0, "graphTooltip": 0,
"id": 4, "id": 2,
"links": [], "links": [],
"liveNow": false, "liveNow": false,
"panels": [ "panels": [
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"mappings": [], "mappings": [],
@ -75,9 +72,14 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "hue_bridge_info", "expr": "hue_bridge_info",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -92,7 +94,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "nLstfzWgz" "uid": "woSee8Zgk"
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -135,9 +137,13 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"expr": "hue_bridge_info", "expr": "hue_bridge_info",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -150,10 +156,7 @@
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"mappings": [], "mappings": [],
@ -195,9 +198,14 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "hue_bridge_info", "expr": "hue_bridge_info",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -210,10 +218,7 @@
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"mappings": [], "mappings": [],
@ -255,9 +260,14 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "hue_bridge_info", "expr": "hue_bridge_info",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -270,10 +280,7 @@
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"mappings": [], "mappings": [],
@ -316,9 +323,14 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "hue_bridge_info", "expr": "hue_bridge_info",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -331,10 +343,7 @@
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"mappings": [], "mappings": [],
@ -376,9 +385,14 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "hue_bridge_info", "expr": "hue_bridge_info",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -391,10 +405,7 @@
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"mappings": [], "mappings": [],
@ -437,9 +448,14 @@
"text": {}, "text": {},
"textMode": "value" "textMode": "value"
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "hue_bridge_info", "expr": "hue_bridge_info",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -452,10 +468,7 @@
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -497,9 +510,14 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "sum(hue_light_state)", "expr": "sum(hue_light_state)",
"format": "table", "format": "table",
"hide": false, "hide": false,
@ -514,10 +532,7 @@
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -559,9 +574,14 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "count(hue_light_state)-sum(hue_light_state)", "expr": "count(hue_light_state)-sum(hue_light_state)",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -584,10 +604,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"decimals": 1, "decimals": 1,
"fill": 0, "fill": 0,
"fillGradient": 4, "fillGradient": 4,
@ -619,7 +636,7 @@
"alertThreshold": false "alertThreshold": false
}, },
"percentage": false, "percentage": false,
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@ -629,9 +646,15 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "10^((hue_sensor_lightlevel-1)/10000)", "expr": "10^((hue_sensor_lightlevel-1)/10000)",
"interval": "", "interval": "",
"legendFormat": "{{name}}", "legendFormat": "{{name}}",
"range": true,
"refId": "A" "refId": "A"
} }
], ],
@ -679,10 +702,7 @@
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"decimals": 1, "decimals": 1,
"fill": 0, "fill": 0,
"fillGradient": 4, "fillGradient": 4,
@ -714,7 +734,7 @@
"alertThreshold": false "alertThreshold": false
}, },
"percentage": false, "percentage": false,
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@ -724,9 +744,15 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "hue_sensor_temperature/100", "expr": "hue_sensor_temperature/100",
"interval": "", "interval": "",
"legendFormat": "{{name}}", "legendFormat": "{{name}}",
"range": true,
"refId": "A" "refId": "A"
} }
], ],
@ -765,10 +791,7 @@
} }
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus",
"uid": "nLstfzWgz"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -923,9 +946,14 @@
} }
] ]
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "hue_sensor_info{type=~\"ZLL.*\"}", "expr": "hue_sensor_info{type=~\"ZLL.*\"}",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -976,10 +1004,8 @@
"type": "table" "type": "table"
}, },
{ {
"datasource": { "datasource": {},
"type": "prometheus", "description": "",
"uid": "nLstfzWgz"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -1172,9 +1198,14 @@
} }
] ]
}, },
"pluginVersion": "8.5.3", "pluginVersion": "9.2.1",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "woSee8Zgk"
},
"editorMode": "code",
"expr": "hue_light_info", "expr": "hue_light_info",
"format": "table", "format": "table",
"instant": true, "instant": true,
@ -1229,20 +1260,20 @@
} }
], ],
"refresh": "5m", "refresh": "5m",
"schemaVersion": 36, "schemaVersion": 37,
"style": "dark", "style": "dark",
"tags": [], "tags": [],
"templating": { "templating": {
"list": [] "list": []
}, },
"time": { "time": {
"from": "now-6h", "from": "now-30m",
"to": "now" "to": "now"
}, },
"timepicker": {}, "timepicker": {},
"timezone": "", "timezone": "",
"title": "Philips Hue", "title": "Philips Hue",
"uid": "X7uYULiRk", "uid": "X7uYULiRk",
"version": 6, "version": 5,
"weekStart": "" "weekStart": ""
} }