Schedule icon
Request icon
Return icon
Switch icon
Log icon
SlackIncomingWebhook icon

Traccar Fleet Tracker Silence Sentinel

Check a Traccar GPS server on a schedule, change nothing, and alert Slack when vehicle trackers go silent, lose their GPS fix, or the server is unreachable.

Categories
BusinessData

A delivery or transport fleet is only as visible as its trackers. A SIM runs out of data, a tracker loses power, a phone app is killed, or the server's tracker port stops accepting connections, and the map keeps showing the last known position as if nothing happened. Dispatch then assigns jobs and promises arrival times from positions that are hours old. This blueprint turns two read-only Traccar API calls into a scheduled fleet visibility gate: /api/devices returns when the server last heard from each tracker, /api/positions returns each tracker's latest GPS fix, a single jq query works out which vehicles are silent and which report without a fresh fix, and the result routes to a quiet log, an informational Slack note or a Slack page.

How it works

  1. fetch_devices (io.kestra.plugin.core.http.Request) reads /api/devices with a bearer token: every device the token's user can see, with lastUpdate (when the server last received anything from the tracker) and disabled. It is a GET with a timeout, three retries, allowFailed: true and allowFailure: true, so an outage never aborts the flow.
  2. fetch_positions reads /api/positions, which returns the latest position of every device, with its fixTime and valid flag. A runIf skips it when the device list is missing or is not JSON.
  3. classify_fleet (io.kestra.plugin.core.debug.Return) checks both responses (a missing response, a non-200 code or a body that is not a JSON array is UNREACHABLE), then joins each enabled device to its latest position in one jq query. A vehicle is silent when the server has not heard from it for silent_minutes, or has never heard from it. A vehicle has no fix when it still reports but its latest fix is older than fix_minutes or flagged invalid. No visible devices is UNREACHABLE; at least critical_silent_count silent vehicles, or one silent for critical_minutes, is CRITICAL; any silent vehicle or missing fix is WARNING; otherwise HEALTHY.
  4. route_by_fleet_status (io.kestra.plugin.core.flow.Switch) logs HEALTHY quietly, posts a Slack note for WARNING, pages Slack for CRITICAL and UNREACHABLE, and logs any unexpected value in defaults.
  5. log_audit_result writes one audit line per run with both HTTP codes and the classification. The flow-level errors block alerts Slack if the flow fails outright.
  6. The fleet_check trigger runs every 15 minutes from 06:00 to 22:00 and ships disabled: true.

What you get

  • A scheduled, read-only fleet visibility check with no Traccar plugin or database access, only the REST API.
  • A status output (HEALTHY / WARNING / CRITICAL / UNREACHABLE) other flows can gate on, and a fleet JSON output with vehicles, silent, no_fix, longest_silent, silent_vehicles and no_fix_vehicles.
  • Slack messages that name the vehicles, for example KA01 EF 3004 Bengaluru hub, TS09 IJ 5006 Hyderabad hub (never reported), and the longest silence in minutes.
  • An audit log line on every run, so fleet visibility history survives a Slack outage.

Who it's for

  • Logistics, delivery and field service teams that track vehicles or staff with Traccar and dispatch from its map.
  • Fleet and telematics engineers who run the Traccar server and need to know when trackers, SIMs or tracker ports fail.
  • Operations teams already using Kestra who want the same alerting for their tracking platform.

Why orchestrate this with Kestra

Traccar can notify about individual device events, but it does not tell you that a third of the fleet has been quiet since a mobile network outage, and its notifications are not an auditable record. Kestra runs the same read-only check on a schedule, classifies the whole fleet in one typed status, keeps every run in the execution history, and routes it to the right channel, while the Switch branches are ready to grow into follow-up (a call list for drivers, a ticket for the telematics team) without changing the check.

Prerequisites

  • A Traccar server (5.x or 6.x) reachable from Kestra.
  • A dedicated Traccar user with the readonly flag, given access to the devices (or groups) to watch, and an API token for it (Settings > Preferences > Token, or POST /api/session/token).
  • A Slack incoming webhook for the WARNING, CRITICAL, UNREACHABLE and flow-failure alerts.

Secrets

  • TRACCAR_TOKEN: API token of the read-only monitoring user, sent as Authorization: Bearer.
  • SLACK_WEBHOOK: Slack incoming webhook used for every alert branch and the flow-failure alert.

In Kestra OSS (no Enterprise secrets backend), secrets are supplied as environment variables prefixed SECRET_ and base64-encoded, then read in flows with {{ secret('NAME') }}, for example SECRET_TRACCAR_TOKEN=$(echo -n '<token>' | base64).

Quick start

  1. To try it without a production fleet, download the Traccar server (the traccar-other zip runs with java -jar tracker-server.jar conf/traccar.xml), open http://localhost:8082, create the first user (it becomes the administrator), add a few devices, and send positions with the OsmAnd protocol on port 5055: curl "http://localhost:5055/?id=<uniqueId>&lat=18.52&lon=73.85".
  2. Create a read-only user, share the devices with it, and create a token for it.
  3. Add TRACCAR_TOKEN and SLACK_WEBHOOK as secrets, set traccar_url, and run the flow. Stop sending positions for one device, wait past silent_minutes (set it to 1 while testing), and run again: the status becomes WARNING and Slack names the vehicle.
  4. Enable fleet_check once pointed at the real server, and adjust the cron to your operating hours.

How to extend

  • Pass groupId= to /api/devices to watch one depot or customer at a time, and run the flow per group with a Loop.
  • Join the silent vehicles to your own dispatch data to alert only on vehicles that have an active job.
  • Store status and the silent vehicle list in the KV store and alert only on changes.
  • Add a speeding or geofence check from /api/reports/events for the same vehicles.

Inputs

  • traccar_url: type STRING, default "https://traccar.example.com".
  • silent_minutes: type INT, default 30.
  • fix_minutes: type INT, default 30.
  • critical_minutes: type INT, default 240.
  • critical_silent_count: type INT, default 3.

Outputs

  • status: one of HEALTHY, WARNING, CRITICAL, UNREACHABLE.
  • fleet: the full classification as JSON, for example {"vehicles":6,"silent":1,"no_fix":2,"longest_silent_minutes":0,"longest_silent":"never reported","silent_vehicles":"TS09 IJ 5006 Hyderabad hub (never reported)","no_fix_vehicles":"GJ05 GH 4005 Surat route, KA01 EF 3004 Bengaluru hub","status":"WARNING"}.

Links

Pitfalls

  • Silence is measured from the device's lastUpdate, the time the server last received anything from it, not from the GPS time inside the message. A tracker that uploads a backlog of old positions is reporting, so its stale data shows up as no fix instead.
  • Traccar returns times in UTC (...+00:00). The query compares them with Kestra's clock, so keep the Kestra host's clock synchronised.
  • Disabled devices are skipped. Disable vehicles that are out of service in Traccar instead of raising silent_minutes, or they will show as silent every run.
  • A device that has never reported (no lastUpdate) counts as silent, so newly added trackers are flagged until they first connect.
  • The check only reads. It never sends commands to devices or changes the server.
See How

New to Kestra?

Use blueprints to kickstart your first workflows.