Monitors echo/log audit pass
Status conclusions and clean-check summaries → echo: backup_verify (pre-flight passed, all files match), bandwidth_monitor (logged transfer entry), cert_monitor/smart_health (all healthy), system_tuning_monitor (snapshot written), weekly_health_digest (smart no-findings exit, digest sent), zfs_memory_snapshot (all pools ONLINE, all checks within thresholds). Manual-Monitors.md: added Output Tiers section.
This commit is contained in:
@@ -445,6 +445,21 @@ HOST2_ZFS_REPORT_IGNORE_POOLS=()
|
||||
|
||||
---
|
||||
|
||||
## ━━━ OUTPUT TIERS ━━━
|
||||
|
||||
All scripts use a two-tier output model: `echo` lines are always visible; `log`
|
||||
lines only appear when `--log` is passed.
|
||||
|
||||
Most monitors are one-shot scripts that run on a schedule. Without `--log`, phase
|
||||
headers, step conclusions (pre-flight passed, snapshot written, digest sent), and
|
||||
the final status line are visible. Per-drive, per-cert, per-file, and per-domain
|
||||
detail lines inside loops are suppressed.
|
||||
|
||||
`weekly_health_digest.sh` with `profile=smart` exits silently (one `echo` line)
|
||||
when there are no findings worth reporting — no noise on healthy weeks.
|
||||
|
||||
---
|
||||
|
||||
## ━━━ FLAG REFERENCE ━━━
|
||||
|
||||
All monitor scripts support the same four flags:
|
||||
|
||||
@@ -193,7 +193,7 @@ if ! check_remote_array; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Pre-flight passed ✅"
|
||||
echo "Pre-flight passed ✅"
|
||||
|
||||
# ==============================================================================================
|
||||
# ━━━ Backup Verification ━━━
|
||||
@@ -319,7 +319,7 @@ elif [[ "$TOTAL_MISMATCH" -gt 0 || "$TOTAL_MISSING" -gt 0 ]]; then
|
||||
notify "Backup verify FAILED on $(hostname) → $REMOTE_SERVER_NAME — mismatches: $TOTAL_MISMATCH missing: $TOTAL_MISSING — shares: ${SHARES_WITH_ISSUES[*]}" \
|
||||
"Backup Verify" "warning"
|
||||
else
|
||||
log "$ICON_DONE Status: all $TOTAL_CHECKED files match across ${#VERIFY_SHARES[@]} shares ✅"
|
||||
echo "$ICON_DONE Status: all $TOTAL_CHECKED files match across ${#VERIFY_SHARES[@]} shares ✅"
|
||||
fi
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ if [[ "$LOG_TRANSFER_MODE" == true ]]; then
|
||||
# Append entry — format: date|time|profile|duration|status|bytes|warn_flag
|
||||
echo "${TODAY}|${NOW}|${TRANSFER_PROFILE}|${TRANSFER_DURATION}|${TRANSFER_STATUS}|${TRANSFER_BYTES}|${WARN_FLAG}" \
|
||||
>> "$BANDWIDTH_LOG"
|
||||
log "$ICON_BANDWIDTH Logged: $TRANSFER_PROFILE — ${DURATION_FMT} — $TRANSFER_STATUS${WARN_FLAG:+ [$WARN_FLAG]}"
|
||||
echo "$ICON_BANDWIDTH Logged: $TRANSFER_PROFILE — ${DURATION_FMT} — $TRANSFER_STATUS${WARN_FLAG:+ [$WARN_FLAG]}"
|
||||
|
||||
# Trim entries older than retention — atomic write via temp file
|
||||
CUTOFF=$(date -d "${BANDWIDTH_LOG_RETENTION} days ago" '+%Y-%m-%d')
|
||||
|
||||
@@ -277,7 +277,7 @@ elif [[ ${#CRITICAL[@]} -gt 0 || ${#FAILED[@]} -gt 0 ]]; then
|
||||
elif [[ ${#WARNING[@]} -gt 0 ]]; then
|
||||
warn "Status: WARNINGS — renewal recommended"
|
||||
else
|
||||
log "$ICON_DONE Status: all ${#HEALTHY[@]} certs healthy ✅"
|
||||
echo "$ICON_DONE Status: all ${#HEALTHY[@]} certs healthy ✅"
|
||||
fi
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
|
||||
@@ -367,7 +367,7 @@ elif [[ ${#DRIVES_WARN[@]} -gt 0 ]]; then
|
||||
notify "SMART WARNING on $(hostname) — drives showing wear: ${DRIVES_WARN[*]}" \
|
||||
"SMART Health" "warning"
|
||||
else
|
||||
log "$ICON_DONE Status: all ${#DRIVES_OK[@]} drives healthy ✅"
|
||||
echo "$ICON_DONE Status: all ${#DRIVES_OK[@]} drives healthy ✅"
|
||||
fi
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
|
||||
@@ -245,4 +245,4 @@ fi
|
||||
echo "${DATE}|${TIME}|${INOTIFY_USED}|${INOTIFY_LIMIT}|${INOTIFY_PCT}|${INOTIFY_WARN}|${PHPFPM_ACTIVE}|${PHPFPM_MAX}|${PHPFPM_PCT}|${PHPFPM_WARN}" \
|
||||
>> "$TUNING_MONITOR_LOG"
|
||||
|
||||
log "Snapshot written: inotify ${INOTIFY_PCT}% php-fpm ${PHPFPM_PCT}%"
|
||||
echo "Snapshot written: inotify ${INOTIFY_PCT}% php-fpm ${PHPFPM_PCT}%"
|
||||
@@ -341,7 +341,7 @@ fi
|
||||
# ── Smart profile — exit silently if nothing to report ────────────────────────────────────────
|
||||
# ==============================================================================================
|
||||
if [[ "$DIGEST_PROFILE" == "smart" && "$SHOULD_SEND" == false ]]; then
|
||||
log "Profile: smart — no findings worth reporting — silent exit"
|
||||
echo "Profile: smart — no findings worth reporting — silent exit"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -378,5 +378,5 @@ if [[ "$DRY_RUN" == true ]]; then
|
||||
warn "DRY RUN — digest generated but not sent"
|
||||
elif [[ "$SHOULD_SEND" == true ]]; then
|
||||
notify "$NOTIFY_MSG" "Health Digest" "$NOTIFY_SEV"
|
||||
log "Digest sent"
|
||||
echo "Digest sent"
|
||||
fi
|
||||
@@ -227,7 +227,7 @@ else
|
||||
error "One or more ZFS pools are NOT ONLINE: $UNHEALTHY"
|
||||
WARNINGS+=("ZFS pool unhealthy: $UNHEALTHY")
|
||||
else
|
||||
log "All monitored ZFS pools are ONLINE ✅"
|
||||
echo "All monitored ZFS pools are ONLINE ✅"
|
||||
fi
|
||||
|
||||
if [[ ${#ZFS_REPORT_IGNORE_POOLS[@]} -gt 0 ]]; then
|
||||
@@ -349,7 +349,7 @@ echo "$ICON_ZFS Log: $ZFS_REPORT_LOG"
|
||||
echo ""
|
||||
|
||||
if [[ ${#WARNINGS[@]} -eq 0 ]]; then
|
||||
log "$ICON_DONE All checks within thresholds ✅"
|
||||
echo "$ICON_DONE All checks within thresholds ✅"
|
||||
else
|
||||
echo "$ICON_WARN Warnings: ${#WARNINGS[@]}"
|
||||
for w in "${WARNINGS[@]}"; do
|
||||
|
||||
Reference in New Issue
Block a user