Exposes Nature Remo and Nature Remo E lite devices metrics to Prometheus.
This exporter is configurable via environment variables:
Either OAUTH_TOKEN_FILE
(recommended) or OAUTH_TOKEN
should be set.
OAUTH_TOKEN_FILE
The path to the file where the OAuth token is stored. Usually you will mount a secret here.OAUTH_TOKEN
The OAuth token to be used for requests. Get one from here
METRICS_PATH
The metrics URL path. Default/metrics
.API_BASE_URL
The Remo API base URL. Defaulthttps://api.nature.global
.PORT
The port to be used by the exporter. Default9352
.CACHE_INVALIDATION_SECONDS
This exporter caches results for this perios of seconds. Default60
.
The following is a sample metrics you can get from this exporter:
# HELP remo_humidity The humidity of the remo device
# TYPE remo_humidity gauge
remo_humidity{id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",name="Living Remo"} 50
# HELP remo_illumination The illumination of the remo device
# TYPE remo_illumination gauge
remo_illumination{id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",name="Living Remo"} 141.8
# HELP remo_temperature The temperature of the remo device
# TYPE remo_temperature gauge
remo_temperature{id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",name="Living Remo"} 28.2
# HELP remo_motion The motion of the remo device
# TYPE remo_motion gauge
remo_motion{id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",name="Living Remo"} 1.568608471e+09
If you have a Nature Remo E lite, you can also get the following metrics:
# HELP remo_cumulative_electric_energy_kilowatt The cumulative electric energy of the remo e lite
# TYPE remo_cumulative_electric_energy_kilowatt counter
remo_cumulative_electric_energy_kilowatt{id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",name="Remo E lite"} 5094.8
# HELP remo_measured_instantaneous_energy_watt The measured instantaneous energy of the remo e lite
# TYPE remo_measured_instantaneous_energy_watt gauge
remo_measured_instantaneous_energy_watt{id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",name="Remo E lite"} 529
There's a sample docker-compose.yml
to be used to test this exporter with prometheus and grafana. Hit the command below:
REMO_OAUTH_TOKEN=<YOUR_OAUTH_TOKEN> docker-compose up
Create a file which contains the oauth token.(e.g. token-file
)
# token-file (be sure not to contain a new line!)
<YOUR-OAUTH-TOKEN>
Create the secret
docker secret create api-keys token-file
./swarm/deploy_stack.sh
The following is an example url for the NodePort(30452):
http://localhost:30452/metrics
# This creates a remo namespace
kubectl apply -f k8s/namespace.yaml
Create a file which contains the oauth token.(e.g. api-keys
)
# api-keys (be sure not to contain a new line!)
<YOUR-OAUTH-TOKEN>
Create the secret
kubectl -n remo create secret generic api-keys --from-file=api-keys
# deploy common resources
kubectl apply -f ./k8s/yaml
# if arch is amd64
kubectl apply -f ./k8s/yaml-amd64
# if arch if armhf
kubectl apply -f ./k8s/yaml-armhf
The following is an example url for the NodePort(30452):
http://localhost:30452/metrics
The following is what it would look like with integration with Grafana:
This project uses mockgen to create mocks. The following is an example of creating mocks.
mockgen -source ./config/reader.go -destination ./mocks/reader.go -package mocks