A simple Python HTTP server exporting OwnTracks Recorder stats for Prometheus
Pre-built Docker images are available on Docker Hub: linusgroh/prometheus-owntracks-exporter
docker run -d \
-v "/path/to/owntracks/storage:/owntracks" \
-e OWNTRACKS_STORAGEDIR="/owntracks" \
-e OWNTRACKS_URL="http://owntracks-recorder:8083" \
linusgroh/prometheus-owntracks-exporter
services:
owntracks-recorder:
...
prometheus:
...
prometheus-owntracks-exporter:
image: linusgroh/prometheus-owntracks-exporter
depends_on:
- prometheus
volumes:
- /path/to/owntracks/storage:/owntracks
environment:
OWNTRACKS_STORAGEDIR: /owntracks
OWNTRACKS_URL: http://owntracks-recorder:8083
poetry install --no-root --no-dev
poetry run python main.py
poetry install --no-root
poetry run uvicorn main:app --reload
Configuration is done via environment variables (or by adding a .env
file).
Name | Description | Default |
---|---|---|
DEBUG |
Run the underlying Starlette ASGI app in debug mode | False |
OWNTRACKS_STORAGEDIR |
Path to the OwnTracks Recorder storage directory (OTR_STORAGEDIR , --storagedir ) |
|
OWNTRACKS_URL |
Base URL to the OwnTracks Recorder's HTTP API (without /api/... ) |
|
SERVER_HOST |
HTTP server host | "0.0.0.0" |
SERVER_PORT |
HTTP server port | 80 |
UPDATE_INTERVAL |
Interval in which the metrics are updated (in seconds) | 60 |
scrape_configs:
- job_name: 'owntracks'
static_configs:
- targets: ['prometheus-owntracks-exporter:80']
Name | Description |
---|---|
owntracks_cards_count |
Total number of cards |
owntracks_devices_count |
Total number of devices |
owntracks_last_locations_count |
Total number of last locations |
owntracks_last_received_timestamp |
Timestamp of the last received message |
owntracks_locations_count |
Total number of locations |
owntracks_storagedir_size |
Size of the OwnTracks Recorder's storage directory in bytes |
owntracks_users_count |
Total number of users |
owntracks_version_info |
OwnTracks Recorder version |
owntracks_waypoints_count |
Total number of waypoints |
A simple Grafana dashboard is available in grafana/owntracks.json
.