Split all site-specific settings (RECIPIENTS, FROM_ADDR, ALERT_SUBJECT,
CA_TIMEOUT, MONITORS) out of EPICS2SMS.sh into a separate config file that
is sourced at startup, so "git pull" no longer clobbers local settings.
- epics2sms.conf is git-ignored (local, per-host).
- epics2sms.conf.example is tracked and documents the format.
- Config path: first CLI arg > EPICS2SMS_CONF env var > epics2sms.conf beside
the script. Missing config or empty RECIPIENTS/MONITORS exits with a clear
error pointing at the template.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add "by <user>" (effective user via id -un) to the startup message so
recipients can see who started the monitor.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Guard the recovery notification on msg_count > 0, so a brief excursion that
never produced an alarm message (e.g. recovered before any send, or all
sends failed) does not emit a lone RESOLVED. Recovery is still logged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a per-monitor msg_delay_s (default 300s): polling continues at the
alarm rate to keep the average and recovery check fresh, but alarm messages
are throttled to at most one per msg_delay_s. The first message of an
episode is still sent immediately.
Also send one "RESOLVED" notification when a monitor returns to normal
(immediate, not throttled or capped).
Config format: pv | dir | threshold | poll_s | alarm_poll_s | n_avg | n_msg | msg_delay_s | text
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
On startup, send one message to all recipients summarising each active
monitor (PV/threshold text, poll and alarm intervals, averaging window,
message cap) so recipients can confirm the monitor is running and what it
watches. Best-effort: a send failure does not stop monitoring.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The caget default (~1s) can be too short for the first connection to a PV,
which then surfaces as "Process variable not connected" and gets skipped.
Add a configurable CA_TIMEOUT (default 5s) and pass it as caget -w.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rewrite epics2sms.sh from a single-PV/single-alert monitor into a driver
that runs multiple independent monitors from a MONITORS config array, each
as its own background loop with isolated state.
Per monitor:
- directional threshold (lt/gt) on a moving average over the last n_avg
samples ("N Mittel"); alarm only fires once the window is full, so a
single spurious reading cannot trigger it
- separate normal and alarm poll intervals; one message is sent per alarm
poll, so alarm_poll_s governs the minimum spacing between messages
- up to n_msg messages per alarm episode ("N Messages"), then silent;
counter resets on recovery
- unreadable/non-numeric reads are logged and skipped
Config format: pv | dir | threshold | poll_s | alarm_poll_s | n_avg | n_msg | text
Recipient updated to 0041797554007@sms.switch.ch. README updated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>