Tell the operator when a finding needs them
A finding nobody is told about is a finding nobody has, and the card added earlier only shows them to someone who opens the tab. Only needs_operator is announced — an open finding may still be repaired by the next pass — one notification for all of them, and each is announced once and stays quiet until the fault changes or gets worse. vv_notify() hands the message to common.sh's notify() rather than reimplementing the channels, and calls detect_hosts() explicitly because load_config.sh deliberately does not: without it the Unraid notification arrives and Discord silently never does. It also reports false when no channel is switched on at all, since notify() exits 0 either way and a caller believing that would mark a finding as told and never mention it again. Notification text is folded to ASCII. Unraid's notifier dropped an em dash outright and left the double space behind, which was found by sending one and reading what arrived.
This commit is contained in:
@@ -89,6 +89,17 @@ try {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// An announcement is worth a line whether or not this pass found anything new — a delivery
|
||||
// that failed on an earlier pass is retried here, and "we tried to tell you" is exactly the
|
||||
// thing someone reads this log to check.
|
||||
$ann = $sum['announced'] ?? [];
|
||||
if (($ann['count'] ?? 0) > 0) {
|
||||
rlog(sprintf('%sannounce: %d finding(s) — %s%s',
|
||||
$dryRun ? 'dry-run: ' : '', $ann['count'],
|
||||
($ann['sent'] ?? false) ? 'sent' : ($dryRun ? 'not sent (dry run)' : 'DELIVERY FAILED'),
|
||||
' — ' . ($ann['subject'] ?? '')));
|
||||
}
|
||||
|
||||
// Nothing found and nothing to say. A line every fifteen minutes reporting no news is how a
|
||||
// log stops being read.
|
||||
if ($sum['findings'] === 0) {
|
||||
|
||||
Reference in New Issue
Block a user