Google Home Exporter
- 2 minutes read - 315 wordsI’m obsessing over Prometheus exporters. First came Linode Exporter, then GCP Exporter and, on Sunday, I stumbled upon a reverse-engineered API for Google Home devices and so wrote a very basic Google Home SDK and a similarly basic Google Home Exporter:
The SDK only implements /setup/eureka_info
and then only some of the returned properties. There’s not a lot of metric-like data to use besides SignalLevel
(signal_level
) and NoiseLevel
(noise_level
). I’m not clear on the meaning of some of the properties.
As the API documentation explains, given a Google Home device endpoint ({IP}
), you should be able to curl --request GET http://${IP}:8008/setup/eureka_info
. The Golang SDK represents just a subset of this, sufficient to do something useful with the data in the Home Exporter and, since I was unmarshaling anyway, why not package that as a basic SDK!?
As the Home Exporter’s README hopefully conveys, you can run the exporter directly:
PORT="9999"
go run github.com/DazWilkin/home-exporter \
--device="${IP}:8008" \
--endpoint=":${PORT}" \
--metricsPath="/metrics"
And then curl --request GET "http://localhost:9999"
As a Docker container:
PORT="9999"
docker run \
--rm --interactive --tty \
--publish=${PORT}:9999
dazwilkin/home-exporter:5b5417c279b1f045bd817caa9112afed26dc20f3
--device=${IP}:8008 \
--endpoint=:9999 \
--metricsPath=/metrics
NB The Docker container image port is fixed at :9999
but you may publish this on your host port ({$PORT}
)
Or using Docker Compose. Using Docker Compose bundles cAdvisor and Prometheus. You’ll need to configure (including renaming|duplicating) exporter-X
and these services’ --device=
and ports
to represent your Google Home devices and their IP addresses, and, if you wish to publish the Exporter’s metrics to your host (you do not need to do this), you’ll need to ensure you don’t have any port collisions.
At this point, I think I may have written Prometheus Exporters for the majority of the technologies that I wish to measure. I’m going to try reflashing an old router with DD-WRT to see whether I can pull metrics for that too. But, then I’m really done :-)