From 84f133b99bc58a35c7c6121f6fa26d77d5249bcc Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Thu, 21 May 2026 17:28:01 -0400 Subject: [PATCH] Monitors echo/log audit pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Monitors/Manual-Monitors.md | 15 +++++++++++++++ Monitors/backup_verify.sh | 4 ++-- Monitors/bandwidth_monitor.sh | 2 +- Monitors/cert_monitor.sh | 2 +- Monitors/smart_health.sh | 2 +- Monitors/system_tuning_monitor.sh | 2 +- Monitors/weekly_health_digest.sh | 4 ++-- Monitors/zfs_memory_snapshot.sh | 4 ++-- 8 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Monitors/Manual-Monitors.md b/Monitors/Manual-Monitors.md index 803ff9f..7cdb7d2 100644 --- a/Monitors/Manual-Monitors.md +++ b/Monitors/Manual-Monitors.md @@ -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: diff --git a/Monitors/backup_verify.sh b/Monitors/backup_verify.sh index cef25db..07e0222 100644 --- a/Monitors/backup_verify.sh +++ b/Monitors/backup_verify.sh @@ -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 "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" diff --git a/Monitors/bandwidth_monitor.sh b/Monitors/bandwidth_monitor.sh index dafeb88..e49d189 100644 --- a/Monitors/bandwidth_monitor.sh +++ b/Monitors/bandwidth_monitor.sh @@ -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') diff --git a/Monitors/cert_monitor.sh b/Monitors/cert_monitor.sh index de7b990..f0dc4a4 100644 --- a/Monitors/cert_monitor.sh +++ b/Monitors/cert_monitor.sh @@ -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 "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" diff --git a/Monitors/smart_health.sh b/Monitors/smart_health.sh index a8943c6..55b044c 100644 --- a/Monitors/smart_health.sh +++ b/Monitors/smart_health.sh @@ -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 "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" diff --git a/Monitors/system_tuning_monitor.sh b/Monitors/system_tuning_monitor.sh index 07a1f0b..539e407 100644 --- a/Monitors/system_tuning_monitor.sh +++ b/Monitors/system_tuning_monitor.sh @@ -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}%" \ No newline at end of file +echo "Snapshot written: inotify ${INOTIFY_PCT}% php-fpm ${PHPFPM_PCT}%" \ No newline at end of file diff --git a/Monitors/weekly_health_digest.sh b/Monitors/weekly_health_digest.sh index 462e475..4114212 100644 --- a/Monitors/weekly_health_digest.sh +++ b/Monitors/weekly_health_digest.sh @@ -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 \ No newline at end of file diff --git a/Monitors/zfs_memory_snapshot.sh b/Monitors/zfs_memory_snapshot.sh index b8a7083..98b115d 100644 --- a/Monitors/zfs_memory_snapshot.sh +++ b/Monitors/zfs_memory_snapshot.sh @@ -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