Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/issyl0/withings-exporter
Prometheus Exporter for Withings API (currently only scales)
https://github.com/issyl0/withings-exporter
metrics prometheus-exporter
Last synced: 25 days ago
JSON representation
Prometheus Exporter for Withings API (currently only scales)
- Host: GitHub
- URL: https://github.com/issyl0/withings-exporter
- Owner: issyl0
- License: mit
- Created: 2020-09-02T17:07:46.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-15T03:42:36.000Z (over 1 year ago)
- Last Synced: 2024-06-19T05:55:14.871Z (5 months ago)
- Topics: metrics, prometheus-exporter
- Language: Go
- Homepage:
- Size: 62.5 KB
- Stars: 8
- Watchers: 5
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Prometheus Exporter for the Withings Body Smart Scales
I have a Withings Body+ smart scale. And I wanted to build my first Prometheus exporter.
## What this does
- Outputs a gauge metric for `withings_current_weight`, taking the most recent recorded weight. The API returns the weight in kilograms.
- Outputs a gauge metric for `withings_current_hydration`, taking the most recent
recorded hydration level.
- OAuth token refresh.
- Metrics refresh after 30 minutes.
- Customizable `--metrics-port` and `--scrape-interval`. See `--help` for
default values.
- Outputs all of the usual Go Prometheus client metrics.## Future plans
- Some other metrics that the [Withings Measures API](https://developer.withings.com/oauth2/#operation/measure-getmeas) has that the Body+ scales can provide.
## Running the exporter
```sh
cd /path/to/repo
go build .
./withings-exporter
```or
```sh
cd /path/to/repo
go run main.go metrics.go types.go
````--help` output:
```
usage: withings-exporter []Flags:
--help Show context-sensitive help (also try --help-long and
--help-man).
--metrics-port=8080 The port to bind to for serving metrics
--scrape-interval=1800 Time in seconds between scrapes
```## Authentication
- Create a [Withings account](https://account.withings.com/connectionuser/account_create). (You should already have one if you have a Withings product and use the HealthMate app!)
- Make a [Withings API Application](https://developer.withings.com/dashboard/). Use ``http://localhost`` as the callback URL.
- Set `WITHINGS_APP_CLIENT_ID` and `WITHINGS_APP_CLIENT_SECRET` based off that application you created.
- Follow the instructions when you run the exporter to authorize your account to connect with the application. Access tokens are valid for three hours, then this auto-refreshes.