Simple Prometheus exporter to monitor the travel distance and duration thanks to Waze API
It has been made to monitor when is the best time to commute to avoid traffic jam.
Having a working Golang environment:
go install github.com/trazfr/prometheus-waze-exporter@latestIt performs a query to Waze to compute 2 main metrics:
waze_travel_distance_meterswaze_travel_time_seconds
It needs a configuration file to define which travel should be monitored.
To run it, just prometheus-waze-exporter config.json
config.json:
{
"addresses": {
"paris": "55 Rue du Faubourg Saint-Honoré, Paris, France",
"versailles": "Place d'Armes, Versailles, France",
"holidays": "Bormes-les-Mimosas, France"
},
"paths": [
{
"from": "paris",
"to": "versailles"
},
{
"from": "versailles",
"to": "paris"
},
{
"from": "paris",
"to": "holidays"
}
],
"listen": ":9091",
"region": "row",
"vehicle": "taxi",
"avoid_toll": true,
"avoid_subscription_road": true,
"avoid_ferry": true,
"sleep": 500
}-
regionmay be:usfor the United Statesilfor Israelrow, this is the default value
-
vehiclemay be:- empty (
""), it is a regular car. This is the default value if not defined taximotorcycle
- empty (
-
avoid_toll,avoid_subscription_roadandavoid_ferryare booleans. Their default value isfalse. -
sleepis an integer. It represents the number of milliseconds to wait between two calls to Waze API. Its default value is 500ms. -
listenis:9091if unset, so you may configure in your scrape config if Prometheus is running on the same server:
- job_name: prometheus-waze-exporter
scrape_timeout: 1m
scrape_interval: 5m
static_configs:
- targets: ['127.0.0.1:9091']