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 ━━━
|
## ━━━ FLAG REFERENCE ━━━
|
||||||
|
|
||||||
All monitor scripts support the same four flags:
|
All monitor scripts support the same four flags:
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ if ! check_remote_array; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Pre-flight passed ✅"
|
echo "Pre-flight passed ✅"
|
||||||
|
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
# ━━━ Backup Verification ━━━
|
# ━━━ 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[*]}" \
|
notify "Backup verify FAILED on $(hostname) → $REMOTE_SERVER_NAME — mismatches: $TOTAL_MISMATCH missing: $TOTAL_MISSING — shares: ${SHARES_WITH_ISSUES[*]}" \
|
||||||
"Backup Verify" "warning"
|
"Backup Verify" "warning"
|
||||||
else
|
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
|
fi
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
|
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ if [[ "$LOG_TRANSFER_MODE" == true ]]; then
|
|||||||
# Append entry — format: date|time|profile|duration|status|bytes|warn_flag
|
# Append entry — format: date|time|profile|duration|status|bytes|warn_flag
|
||||||
echo "${TODAY}|${NOW}|${TRANSFER_PROFILE}|${TRANSFER_DURATION}|${TRANSFER_STATUS}|${TRANSFER_BYTES}|${WARN_FLAG}" \
|
echo "${TODAY}|${NOW}|${TRANSFER_PROFILE}|${TRANSFER_DURATION}|${TRANSFER_STATUS}|${TRANSFER_BYTES}|${WARN_FLAG}" \
|
||||||
>> "$BANDWIDTH_LOG"
|
>> "$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
|
# Trim entries older than retention — atomic write via temp file
|
||||||
CUTOFF=$(date -d "${BANDWIDTH_LOG_RETENTION} days ago" '+%Y-%m-%d')
|
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
|
elif [[ ${#WARNING[@]} -gt 0 ]]; then
|
||||||
warn "Status: WARNINGS — renewal recommended"
|
warn "Status: WARNINGS — renewal recommended"
|
||||||
else
|
else
|
||||||
log "$ICON_DONE Status: all ${#HEALTHY[@]} certs healthy ✅"
|
echo "$ICON_DONE Status: all ${#HEALTHY[@]} certs healthy ✅"
|
||||||
fi
|
fi
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
|
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ elif [[ ${#DRIVES_WARN[@]} -gt 0 ]]; then
|
|||||||
notify "SMART WARNING on $(hostname) — drives showing wear: ${DRIVES_WARN[*]}" \
|
notify "SMART WARNING on $(hostname) — drives showing wear: ${DRIVES_WARN[*]}" \
|
||||||
"SMART Health" "warning"
|
"SMART Health" "warning"
|
||||||
else
|
else
|
||||||
log "$ICON_DONE Status: all ${#DRIVES_OK[@]} drives healthy ✅"
|
echo "$ICON_DONE Status: all ${#DRIVES_OK[@]} drives healthy ✅"
|
||||||
fi
|
fi
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
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}" \
|
echo "${DATE}|${TIME}|${INOTIFY_USED}|${INOTIFY_LIMIT}|${INOTIFY_PCT}|${INOTIFY_WARN}|${PHPFPM_ACTIVE}|${PHPFPM_MAX}|${PHPFPM_PCT}|${PHPFPM_WARN}" \
|
||||||
>> "$TUNING_MONITOR_LOG"
|
>> "$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 ────────────────────────────────────────
|
# ── Smart profile — exit silently if nothing to report ────────────────────────────────────────
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
if [[ "$DIGEST_PROFILE" == "smart" && "$SHOULD_SEND" == false ]]; then
|
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -378,5 +378,5 @@ if [[ "$DRY_RUN" == true ]]; then
|
|||||||
warn "DRY RUN — digest generated but not sent"
|
warn "DRY RUN — digest generated but not sent"
|
||||||
elif [[ "$SHOULD_SEND" == true ]]; then
|
elif [[ "$SHOULD_SEND" == true ]]; then
|
||||||
notify "$NOTIFY_MSG" "Health Digest" "$NOTIFY_SEV"
|
notify "$NOTIFY_MSG" "Health Digest" "$NOTIFY_SEV"
|
||||||
log "Digest sent"
|
echo "Digest sent"
|
||||||
fi
|
fi
|
||||||
@@ -227,7 +227,7 @@ else
|
|||||||
error "One or more ZFS pools are NOT ONLINE: $UNHEALTHY"
|
error "One or more ZFS pools are NOT ONLINE: $UNHEALTHY"
|
||||||
WARNINGS+=("ZFS pool unhealthy: $UNHEALTHY")
|
WARNINGS+=("ZFS pool unhealthy: $UNHEALTHY")
|
||||||
else
|
else
|
||||||
log "All monitored ZFS pools are ONLINE ✅"
|
echo "All monitored ZFS pools are ONLINE ✅"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${#ZFS_REPORT_IGNORE_POOLS[@]} -gt 0 ]]; then
|
if [[ ${#ZFS_REPORT_IGNORE_POOLS[@]} -gt 0 ]]; then
|
||||||
@@ -349,7 +349,7 @@ echo "$ICON_ZFS Log: $ZFS_REPORT_LOG"
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [[ ${#WARNINGS[@]} -eq 0 ]]; then
|
if [[ ${#WARNINGS[@]} -eq 0 ]]; then
|
||||||
log "$ICON_DONE All checks within thresholds ✅"
|
echo "$ICON_DONE All checks within thresholds ✅"
|
||||||
else
|
else
|
||||||
echo "$ICON_WARN Warnings: ${#WARNINGS[@]}"
|
echo "$ICON_WARN Warnings: ${#WARNINGS[@]}"
|
||||||
for w in "${WARNINGS[@]}"; do
|
for w in "${WARNINGS[@]}"; do
|
||||||
|
|||||||
Reference in New Issue
Block a user