Watchdog is a Go-based service that monitors OneBusAway (OBA) REST API servers. It exposes a comprehensive set of Prometheus metrics for monitoring:
- GTFS Static and GTFS-RT data integrity
- Vehicle telemetry
- Agency and stop coverage
- Overall operational health See the full list of metrics and interpretation guide here
- Go 1.23+
Watchdog requires a configuration file (config.json) before running. Even placeholder data is necessary to start the service.
[
{
"name": "Test Server 1",
"id": 1,
"oba_base_url": "https://test1.example.com",
"oba_api_key": "test-key-1",
"gtfs_url": "https://gtfs1.example.com",
"trip_update_url": "https://trip1.example.com",
"vehicle_position_url": "https://vehicle1.example.com",
"gtfs_rt_api_key": "api-key-1",
"gtfs_rt_api_value": "api-value-1",
"agency_id": "agency-1"
}
]- Copy or rename
config.json.template→config.json - Fill in your server values
- Run with:
go run ./cmd/watchdog/ --config-file path/to/config.jsonNote:
⚠️ The file must be namedconfig.jsonconfig.jsonis Git-ignored (to protect secrets)
- Prepare
config.jsonas above - Host it publicly (or on a private server)
- Run with:
go run ./cmd/watchdog/ --config-url http://example.com/config.jsonIf authentication is required, set:
export CONFIG_AUTH_USER="username"
export CONFIG_AUTH_PASS="password"- Fetch Interval → default
30s(--fetch-interval <seconds>) - Environment →
development(default),staging,production(--env <value>) - Port → default
4000(--port <number>)
9090 and Grafana on 3000. Don’t use those ports.
- Sentry DSN
export SENTRY_DSN="your_sentry_dsn"- Config Auth (for remote configs)
export CONFIG_AUTH_USER="username"
export CONFIG_AUTH_PASS="password"It may take a few minutes for Watchdog to start exposing data to Prometheus, since initial setup includes tasks such as downloading the GTFS bundle.
Run Watchdog with Prometheus + Grafana:
docker compose up --buildServices:
- Watchdog →
4000 - Prometheus →
9090 - Grafana →
3000
Stop services:
docker compose downRestart services:
docker compose restartGrafana auto-loads a Go runtime dashboard. Prometheus is pre-configured to scrape Watchdog.
See Endpoints to access metrics, health checks, Grafana, and Prometheus.
go run ./cmd/watchdog/ --config-file path/to/config.jsongo run ./cmd/watchdog/ \
--config-url http://example.com/config.jsonSee Endpoints to access metrics and health checks.
docker build -t watchdog .docker run -d \
--name watchdog \
-v ./config.json:/app/config.json \
-p 4000:4000 \
watchdog \
--config-file /app/config.jsondocker run -d \
--name watchdog \
-e CONFIG_AUTH_USER=admin \
-e CONFIG_AUTH_PASS=password \
-p 4000:4000 \
watchdog \
--config-url http://example.com/config.jsonSee Endpoints to access metrics and health checks.
During development (using localhost):
- Watchdog Metrics: http://localhost:4000/metrics
- Watchdog Health Check: http://localhost:4000/v1/healthcheck
- Grafana: http://localhost:3000/login → default user/pass:
admin/admin - Prometheus Targets: http://localhost:9090/targets
- Prometheus Query: http://localhost:9090/query
During production (replace <server-ip-or-domain>):
- Watchdog Metrics:
http://<server-ip-or-domain>:4000/metrics - Watchdog Health Check:
http://<server-ip-or-domain>:4000/v1/healthcheck - Grafana:
http://<server-ip-or-domain>:3000/login - Prometheus Targets:
http://<server-ip-or-domain>:9090/targets - Prometheus Query:
http://<server-ip-or-domain>:9090/query
go test ./...- Copy
integration_config.json.template→integration_config.json - Fill in OBA server values
- Run:
go test -tags=integration ./internal/integration \
-integration-config path/to/integration_config.jsonNote:
⚠️ the file must be namedintegration_config.json- It’s Git-ignored for safety
Refer to CONTRIBUTING.md for detailed contribution guidelines.