feat: SFM event forwarding added. v0.3.0
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Thor Watcher
|
||||
|
||||
**Version:** 0.2.0
|
||||
**Version:** 0.3.0
|
||||
|
||||
Micromate (Series 4) watcher agent for Terra-View fleet management. Runs as a Windows system tray application, scans THORDATA for Micromate unit activity, and sends heartbeat data to Terra-View.
|
||||
Micromate (Series 4) watcher agent for Terra-View fleet management. Runs as a Windows system tray application, scans THORDATA for Micromate unit activity, sends heartbeat data to Terra-View, and (optionally) forwards `.IDFH`/`.IDFW` event files to a seismo-relay SFM server.
|
||||
|
||||
---
|
||||
|
||||
@@ -29,7 +29,7 @@ build.bat
|
||||
```
|
||||
|
||||
Produces:
|
||||
- `dist\thor-watcher-0.2.0.exe` — upload to Gitea release
|
||||
- `dist\thor-watcher-0.3.0.exe` — upload to Gitea release
|
||||
- `dist\thor-watcher.exe` — use with Inno Setup
|
||||
|
||||
Then run Inno Setup Compiler on `installer.iss` to produce `thor-watcher-setup.exe`.
|
||||
@@ -62,6 +62,27 @@ Managed through the Settings dialog (right-click tray icon → Settings). A `con
|
||||
| `log_retention_days` | integer | `30` | Days before log is auto-cleared |
|
||||
| `update_source` | string | `gitea` | Auto-update source: `gitea`, `url`, or `disabled` |
|
||||
| `update_url` | string | `""` | Base URL for `url` mode (e.g. Terra-View server) |
|
||||
| `sfm_forward_enabled` | boolean | `false` | Forward `.IDFH`/`.IDFW` event files to a seismo-relay SFM server |
|
||||
| `sfm_url` | string | `""` | Base URL of the seismo-relay SFM server (e.g. `http://10.0.0.44:8200`) |
|
||||
| `sfm_forward_interval` | integer | `60` | Seconds between forwarder passes |
|
||||
| `sfm_quiescence_seconds` | integer | `5` | Skip files modified within the last N seconds (avoid in-flight files) |
|
||||
| `sfm_missing_report_grace_seconds` | integer | `60` | Forward a binary without its `.txt` sidecar if it hasn't appeared after N seconds |
|
||||
| `sfm_http_timeout` | integer | `60` | HTTP timeout per forward POST |
|
||||
| `sfm_state_file` | string | `""` | Path to the sha256-keyed state file. Blank → `<log_dir>\thor_forwarded.json` |
|
||||
| `sfm_max_forwards_per_pass` | integer | `500` | Cap per pass to drip-feed large backfills |
|
||||
| `sfm_max_event_age_days` | integer | `365` | Skip event files older than this many days |
|
||||
|
||||
---
|
||||
|
||||
## Event Forwarding
|
||||
|
||||
When `sfm_forward_enabled` is true and `sfm_url` is set, Thor Watcher walks the THORDATA tree each `sfm_forward_interval` seconds, finds `.IDFH` (histogram) and `.IDFW` (waveform) event binaries plus their `TXT/<basename>.txt` ASCII sidecars, and POSTs them to seismo-relay's `/db/import/idf_file` endpoint.
|
||||
|
||||
- **Idempotent.** Every forwarded file is recorded by sha256 in `thor_forwarded.json`. Re-scans never re-POST.
|
||||
- **Default off.** Operators must explicitly enable from the Settings → SFM Forward tab.
|
||||
- **Re-pair logic.** If a binary is forwarded before its TXT sidecar appears (after the grace period), it's flagged `had_report=false` and re-forwarded once the TXT arrives so the SFM database row can be refreshed with device-authoritative PPV/ZCFreq/peak values.
|
||||
- **TXT export must be enabled in Thor.** Thor's TXT sidecars are not produced automatically — operators should enable TXT export so the relay can extract rich metadata. Forwards without a TXT are still useful (binary gets indexed; rich fields stay NULL).
|
||||
- **Backfill seeding.** To skip a large historical archive on first deploy, run `python event_forwarder.py --seed-state --thordata C:\THORDATA --state <state file>` before flipping the switch.
|
||||
|
||||
---
|
||||
|
||||
@@ -69,8 +90,8 @@ Managed through the Settings dialog (right-click tray icon → Settings). A `con
|
||||
|
||||
| Color | Meaning |
|
||||
|-------|---------|
|
||||
| Green | Running, API reporting OK |
|
||||
| Amber | Running, API disabled or not configured |
|
||||
| Green | Running, API reporting OK (and SFM forwarder healthy when enabled) |
|
||||
| Amber | Running, API disabled OR SFM forwarder failing while API is healthy |
|
||||
| Red | Running, API failing |
|
||||
| Purple | Error — check logs |
|
||||
| Grey | Starting up |
|
||||
@@ -100,7 +121,7 @@ Posted to `api_url` on each API interval:
|
||||
{
|
||||
"source_id": "THOR-PC",
|
||||
"source_type": "series4_watcher",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"generated_at": "2026-03-20T14:30:00Z",
|
||||
"log_tail": ["...last 25 log lines..."],
|
||||
"units": [
|
||||
|
||||
Reference in New Issue
Block a user