fix: report skipped rules in event-trigger run; add lm-sensors dep

- run now counts rules skipped because their check produced no number (or
  the line was unparseable) and reports both counts, so an all-skipped pass
  no longer reads as 'evaluated 0 rule(s)'.
- preinstall.sh installs lm-sensors — the sensor example rules in event.env
  need it; howto troubleshooting notes to check 'sensors -u' output for the
  real *_input key before adding a rule.
This commit is contained in:
Your Name
2026-08-09 17:31:59 +00:00
parent 030ec0b456
commit 577d49ac2d
4 changed files with 16 additions and 6 deletions
+1 -1
View File
@@ -584,7 +584,7 @@ Use conventional prefixes: `feat:`, `fix:`, `docs:`, `refactor:`, `chore:`
| `bin/pos-network-scan` | 271 | Parallel ping sweep of CIDR |
| `bin/pos-ssh-load-keys` | 31 | Load all SSH keys into the agent |
| `bin/pos-system-backup` | 126 | Encrypted (AES-256) folder snapshots (tar + gpg) |
| `bin/pos-system-event-trigger` | 212 | State-based rule monitors; alerts via notify when a check crosses a threshold |
| `bin/pos-system-event-trigger` | 217 | State-based rule monitors; alerts via notify when a check crosses a threshold |
| `bin/pos-system-firewall` | 291 | Interactive UFW management |
| `bin/pos-system-health` | 209 | Host health dashboard (disk, RAM, services, backup age, fail2ban, docker); exit 1 if any FAIL |
| `bin/pos-system-nfs-client` | 138 | Mount NFS shares (ephemeral or persistent systemd mount units) |
+5 -1
View File
@@ -46,7 +46,11 @@ Examples:
Behavior:
- The check runs on every pass. Non-numeric/empty output, or an unparseable
line → the rule is skipped with a warning (other rules still run).
line → the rule is skipped with a warning (other rules still run). The
`run` summary reports how many rules evaluated and how many were skipped.
- `sensors` rules need `lm-sensors` installed (`preinstall.sh` installs it;
verify with `sensors -u` before adding a rule — sensor names differ by
chip, check `sensors -u` output for the real `*_input` key).
- Alerts fire **once** when the condition turns true, and once more when it
recovers — a hot CPU for two hours is one message, not twenty.
- State is tracked per rule in `~/.local/share/linux_post_install/eventer/state/`
+9 -4
View File
@@ -64,14 +64,15 @@ set -- "${args[@]}"
# ── run ──────────────────────────────────────────────────────────
run_rules() {
eventer_read_rules
local n fired hash msg line
local n fired hash msg line skipped
n=0
skipped=0
for line in "${RULES[@]}"; do
case "$line" in
""|\#*) continue ;;
esac
eventer_parse_rule "$line" || { warn "skipping unparseable rule: $line"; continue; }
eventer_eval_check || { warn "check produced no number — $RULE_CMD"; continue; }
eventer_parse_rule "$line" || { warn "skipping unparseable rule: $line"; skipped=$((skipped + 1)); continue; }
eventer_eval_check || { warn "check produced no number — $RULE_CMD"; skipped=$((skipped + 1)); continue; }
n=$((n + 1))
if eventer_compare "$VALUE_NUM" "$RULE_OP" "$RULE_NUM"; then fired=1; else fired=0; fi
hash="$(eventer_hash "$line")"
@@ -95,7 +96,11 @@ run_rules() {
log "(dry-run) OK: $RULE_CMD = $VALUE_DISPLAY (no change)"
fi
done
log "evaluated $n rule(s)"
if [ "$skipped" -gt 0 ]; then
log "evaluated $n rule(s), skipped $skipped (no number / unparseable)"
else
log "evaluated $n rule(s)"
fi
}
# ── list ─────────────────────────────────────────────────────────
+1
View File
@@ -33,6 +33,7 @@ PACKAGES=(
nfs-common nfs-kernel-server
hostapd dnsmasq iptables iw
ca-certificates gnupg lsb-release
lm-sensors
python3 python3-pip rclone
libqrencode4 libgtk-3-0
)