Scrapy Price Drop Watch and Re-Verification Gate
Scrape a product listing page's lowest price with a minimal Scrapy spider, alert Slack on a threshold breach, and optionally re-scrape to confirm it before alerting.
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.
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.
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.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.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.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.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.fleet_check trigger runs every 15 minutes from 06:00 to 22:00 and ships disabled: true.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.KA01 EF 3004 Bengaluru hub, TS09 IJ 5006 Hyderabad hub (never reported), and the longest silence in minutes.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.
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).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).
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".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.fleet_check once pointed at the real server, and adjust the cron to your operating hours.groupId= to /api/devices to watch one depot or customer at a time, and run the flow per group with a Loop.status and the silent vehicle list in the KV store and alert only on changes./api/reports/events for the same vehicles.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.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"}.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....+00:00). The query compares them with Kestra's clock, so keep the Kestra host's clock synchronised.silent_minutes, or they will show as silent every run.lastUpdate) counts as silent, so newly added trackers are flagged until they first connect.