Schedule icon
Get icon
Request icon
TransformValue icon
If icon
SlackIncomingWebhook icon
Pause icon
Switch icon
Loop icon
Log icon
Set icon

Tile38 geofence drift and stale object guard with operator-gated remediation

Detect Tile38 geofence breaches and stale fleet objects, alert on Slack, and gate eviction or tagging on operator approval before changing Tile38 state.

Categories
Infrastructure

Tile38 geofences define geographic boundaries for roaming objects such as delivery vehicles, field sensors, or IoT assets. When a tracked object drifts outside its expected boundary or stops reporting, the responsible team needs both an alert and a clear remediation path: confirm the object is genuinely out of bounds, then either issue a recovery command or mark it as evicted so downstream systems stop waiting for it. This flow polls a Tile38 instance on a schedule, detects drifted objects and stale objects (evaluating each object's updated timestamp field), alerts the team on Slack, and pauses for operator approval before writing a FSET ... drifted 1 tag or dropping the object from the collection with DEL.

How it works

  1. scheduled_poll (io.kestra.plugin.core.trigger.Schedule) fires every five minutes. concurrency.limit: 1 with behavior: CANCEL ensures that if a run pauses for human review, subsequent scheduled runs cancel immediately instead of creating execution backlog.
  2. load_previous_roster (io.kestra.plugin.core.kv.Get) reads the roster written by the previous successful run. On the first run the key is absent and the task returns null.
  3. query_within_geofence (io.kestra.plugin.core.http.Request) sends a WITHIN command to the Tile38 HTTP API using a POST body and returns every object ID currently inside the boundary.
  4. query_nearby_geofence (io.kestra.plugin.core.http.Request) sends a NEARBY command to retrieve the full fleet roster including coordinates and custom updated timestamp fields.
  5. evaluate_drift_and_staleness (io.kestra.plugin.transform.jsonata.TransformValue) cross-references the two results: objects present in the NEARBY roster but absent from the WITHIN result have drifted out; objects whose ($millis() / 1000 - fields.updated) exceeds inputs.stale_after_seconds are flagged stale.
  6. check_alerts (io.kestra.plugin.core.flow.If) evaluates outputs.evaluate_drift_and_staleness.value.has_alerts and skips everything below on a healthy run.
  7. send_slack_alert (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts drifted and stale IDs with a direct link to the execution so the operator can act from the Kestra UI.
  8. await_operator_decision (io.kestra.plugin.core.flow.Pause) halts execution with pauseDuration: PT4H and behavior: CANCEL, waiting for an operator to choose evict, tag, or skip in the Resume form.
  9. remediate_drifted_objects (io.kestra.plugin.core.flow.Switch) routes the operator's chosen action: evict loops over affected IDs and sends DEL commands, tag loops sending FSET ... drifted 1, and skip closes cleanly with no Tile38 state change.
  10. save_roster (io.kestra.plugin.core.kv.Set) persists the post-remediation roster for drift diffing on the next run.
  11. alert_flow_failure (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) in the top-level errors: block alerts on-call if Tile38 is unreachable or a network failure occurs.

What you get

  • A Slack alert within one poll cycle when any tracked object leaves the geofence or stops reporting, with the execution link for one-click review.
  • A human-gated remediation step: operators choose evict, tag, or skip — nothing is deleted without approval.
  • Concurrency protection: concurrency.limit: 1 stops runaway execution queues while waiting for approval.
  • An auditable execution timeline: every drift event, every operator decision, and every Tile38 command is a named task in the execution log.
  • No alert and no pause on healthy runs.

Who it's for

  • Platform and operations teams running Tile38 for fleet tracking, logistics, or IoT asset management who need an auditable record of every geofence breach response.
  • On-call engineers who need a structured remediation path, not just a raw alert.

Why orchestrate this with Kestra

A cron script can query Tile38 and post to Slack, but it cannot pause mid-execution and wait for a human decision before modifying data. Kestra's Pause task makes that pattern declarative and auditable: the approval step lives in the same YAML as the query and the remediation command, the operator acts from the Kestra UI, and the full decision trail is in the execution log.

Prerequisites

  • A running Tile38 instance with the HTTP API enabled (default port 9851).
  • A fleet collection populated via SET fleet <id> FIELD updated <epoch> POINT <lat> <lon>.
  • A Slack incoming webhook URL.

Secrets

  • TILE38_HTTP_URL: Base URL of the Tile38 HTTP API, e.g. http://tile38-host:9851.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for the alert channel.

Quick start

  1. Add TILE38_HTTP_URL and SLACK_WEBHOOK_URL as Kestra secrets.
  2. Load objects with an epoch timestamp: SET fleet truck-1 FIELD updated 1700000000 POINT 33.45 -112.07.
  3. Set geofence_geojson to a GeoJSON Polygon for the expected operating area.
  4. Run once manually to seed the KV roster.
  5. Enable the schedule trigger.
  6. When an alert fires, open the execution link from Slack, choose the remediation action, and click Resume.

How to extend

  • Wrap the poll in a io.kestra.plugin.core.flow.Loop over multiple collections to cover an entire fleet deployment from one scheduled run.
  • Replace Slack with io.kestra.plugin.core.http.Request to PagerDuty for high-severity assets where a human needs to be paged rather than notified.
  • Append each eviction to a DuckDB table for compliance and capacity-planning reports.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.