Verbose logging: add config dump log() calls to Monitors, Media, Tools, Rsync, Fallback

This commit is contained in:
Gmer4Lfe
2026-06-04 21:37:53 -04:00
parent 369a9e6c19
commit 127b070f7b
33 changed files with 67 additions and 3 deletions
+7
View File
@@ -144,6 +144,10 @@ if [[ ${#VERIFY_SHARES[@]} -eq 0 ]]; then
exit 0
fi
log "$ICON_GEAR Config: sample=${BACKUP_VERIFY_SAMPLE} min-size=${BACKUP_VERIFY_MIN_SIZE} ssh-timeout=${SSH_TIMEOUT}s"
log "$ICON_GEAR Remote: $REMOTE_ID ($REMOTE_SERVER_NAME$REMOTE_SERVER)"
log "$ICON_GEAR Shares: ${VERIFY_SHARES[*]}"
[[ "$DRY_RUN" == true ]] && warn "DRY RUN — showing sample selection only, no checksums computed"
# ==============================================================================================
@@ -177,12 +181,14 @@ resolve_remote_ip
# Connectivity — no point making 100+ SSH calls if remote is unreachable
check_connectivity
log "Connectivity to $REMOTE_SERVER_NAME"
# Version parity — mismatched unRAID could cause md5sum path differences
check_unraid_version_parity || {
warn "Version parity check failed — proceeding with caution"
warn "Checksum results may be unreliable if md5sum path changed between versions"
}
log "Version parity with $REMOTE_SERVER_NAME"
# Remote array — if array is down all files appear "missing" = false alarm
if ! check_remote_array; then
@@ -192,6 +198,7 @@ if ! check_remote_array; then
"Backup Verify" "warning"
exit 1
fi
log "Remote array mounted on $REMOTE_SERVER_NAME"
echo "Pre-flight passed ✅"
+2
View File
@@ -142,6 +142,8 @@ platform_require_cmd \
# detect_hosts() sets MY_ID for report header
detect_hosts
log "$ICON_GEAR Config: log=${BANDWIDTH_LOG} retention=${BANDWIDTH_LOG_RETENTION}d warn=${BANDWIDTH_WARN_GB}GB"
# ==============================================================================================
# ━━━ Status ━━━
# ==============================================================================================
+2
View File
@@ -128,6 +128,8 @@ if [[ ${#CERT_MONITOR_DOMAINS[@]} -eq 0 ]]; then
fi
info "Domains to check: ${#CERT_MONITOR_DOMAINS[@]}"
log "$ICON_GEAR Config: warn=${CERT_WARN_DAYS}d crit=${CERT_CRIT_DAYS}d timeout=${CERT_TIMEOUT}s"
log "$ICON_GEAR Domains: ${CERT_MONITOR_DOMAINS[*]}"
[[ "$DRY_RUN" == true ]] && warn "DRY RUN — results shown but no notifications sent"
+5 -2
View File
@@ -124,7 +124,7 @@ detect_hosts
require_var EMBY_URL
require_var EMBY_API_KEY
log "Emby: $EMBY_URL"
log "$ICON_GEAR Config: url=${EMBY_URL} period=${EMBY_REPORT_DAYS}d top=${EMBY_REPORT_TOP_N}"
[[ "$DRY_RUN" == true ]] && warn "DRY RUN — API queried but no notification sent"
# ==============================================================================================
@@ -190,7 +190,7 @@ SYSTEM_INFO=$(emby_api "System/Info" 2>/dev/null) || {
SERVER_NAME=$(echo "$SYSTEM_INFO" | jq -r '.ServerName // "Unknown"' 2>/dev/null)
SERVER_VERSION=$(echo "$SYSTEM_INFO" | jq -r '.Version // "Unknown"' 2>/dev/null)
log "Connected to: $SERVER_NAME (v$SERVER_VERSION)"
log "$ICON_EMBY Connected to: $SERVER_NAME (v$SERVER_VERSION)"
# ── Active Sessions ───────────────────────────────────────────────────────────────────────────
echo "━━━ $ICON_EMBY Active Sessions ━━━"
@@ -216,6 +216,7 @@ if [[ "$ACTIVE_COUNT" -gt 0 ]]; then
" \(.UserName // "Unknown") → \(.NowPlayingItem.Name // "Unknown") [\(if .TranscodingInfo != null then "transcode" else "direct" end)]"
' 2>/dev/null || true
fi
log "$ICON_EMBY Sessions: $ACTIVE_COUNT active ($DIRECT_NOW direct / $TRANSCODE_NOW transcode)"
echo ""
# ── Library Stats ─────────────────────────────────────────────────────────────────────────────
@@ -229,6 +230,7 @@ SONG_COUNT=$(echo "$ITEMS" | jq '.SongCount // 0' 2>/dev/null || echo 0)
echo " $ICON_EMBY Movies: $MOVIE_COUNT"
echo " $ICON_EMBY Episodes: $EPISODE_COUNT"
echo " $ICON_EMBY Songs: $SONG_COUNT"
log "$ICON_EMBY Library: $MOVIE_COUNT movies $EPISODE_COUNT episodes $SONG_COUNT songs"
echo ""
# ── Activity History ──────────────────────────────────────────────────────────────────────────
@@ -256,6 +258,7 @@ if [[ "$TOTAL_PLAYS" -gt 0 ]]; then
DIRECT_PCT=$(( 100 - TRANSCODE_PCT ))
echo " $ICON_EMBY Direct play: ~${DIRECT_PCT}%"
echo " $ICON_EMBY Transcoded: ~${TRANSCODE_PCT}%"
log "$ICON_EMBY Activity: $TOTAL_PLAYS plays — ~${DIRECT_PCT}% direct / ~${TRANSCODE_PCT}% transcode"
fi
echo ""
+2
View File
@@ -71,6 +71,7 @@ format_delay() {
}
collect_hosts
log "$ICON_HOST Hosts: ${ALL_HOST_IDS[*]} (${#ALL_HOST_IDS[@]} in mesh)"
# ==============================================================================================
# ━━━ Status ━━━
@@ -127,6 +128,7 @@ for h in "${ALL_HOST_IDS[@]}"; do
email_var="${h}_OWNER_EMAIL"; email="${!email_var:-(not set)}"
printf " %-${W_HOST}s %-${W_SERVER}s %-${W_OWNER}s %s\n" \
"$h" "$server" "$owner" "$email"
log "$h: server=$server owner=$owner email=$email"
done
# ── Protected Services ────────────────────────────────────────────────────────────────────────
+4 -1
View File
@@ -123,6 +123,8 @@ acquire_lock
# detect_hosts() sets MY_ID — used in warning output
detect_hosts
log "$ICON_GEAR Config: inotify-warn=${INOTIFY_WARN_PCT:-80}% php-fpm-warn=${PHP_FPM_WARN_PCT:-80}% max-workers=${PHP_MAX_CHILDREN:-250} retention=${TUNING_LOG_RETENTION:-30}d"
DATE=$(date '+%Y-%m-%d')
TIME=$(date '+%H:%M')
INOTIFY_WARN=0
@@ -245,4 +247,5 @@ fi
echo "${DATE}|${TIME}|${INOTIFY_USED}|${INOTIFY_LIMIT}|${INOTIFY_PCT}|${INOTIFY_WARN}|${PHPFPM_ACTIVE}|${PHPFPM_MAX}|${PHPFPM_PCT}|${PHPFPM_WARN}" \
>> "$TUNING_MONITOR_LOG"
echo "Snapshot written: inotify ${INOTIFY_PCT}% php-fpm ${PHPFPM_PCT}%"
echo "Snapshot written: inotify ${INOTIFY_PCT}% php-fpm ${PHPFPM_PCT}%"
log "Entry: ${DATE}|${TIME}|${INOTIFY_USED}/${INOTIFY_LIMIT}(${INOTIFY_PCT}%,warn=${INOTIFY_WARN})|${PHPFPM_ACTIVE}/${PHPFPM_MAX}(${PHPFPM_PCT}%,warn=${PHPFPM_WARN})"
+6
View File
@@ -141,6 +141,9 @@ acquire_lock
# detect_hosts() sets MY_ID and aliases all host-specific vars used in this report
detect_hosts
log "$ICON_GEAR Config: profile=${DIGEST_PROFILE} day=${DIGEST_DAY}"
log "$ICON_GEAR Smart triggers: watchdog=${DIGEST_SMART_ON_WATCHDOG} fallback=${DIGEST_SMART_ON_FALLBACK} cert=${DIGEST_SMART_ON_CERT_WARN} bandwidth=${DIGEST_SMART_ON_BANDWIDTH}"
[[ "$DRY_RUN" == true ]] && warn "DRY RUN — report generated but no notification sent"
# ==============================================================================================
@@ -199,6 +202,7 @@ ISSUES=() # need attention
DIGEST_LINES=() # full report lines
# ── fallback State ────────────────────────────────────────────────────────────────────────────
log "Reading: fallback=$FALLBACK_STATE_FILE skip=$DOCKER_WATCHDOG_FAILED_FILE watchdog=$WATCHDOG_STATE_FILE sys=$SYS_WATCHDOG_STATE_FILE"
if [[ -f "$FALLBACK_STATE_FILE" ]]; then
FALLBACK_STATE=$(grep "^state=" "$FALLBACK_STATE_FILE" 2>/dev/null | cut -d= -f2)
if [[ -n "$FALLBACK_STATE" ]]; then
@@ -323,6 +327,8 @@ if [[ ${#CERT_MONITOR_DOMAINS[@]} -gt 0 ]] && command -v openssl >/dev/null 2>&1
elif [[ "$days_remaining" -le "${CERT_WARN_DAYS:-30}" ]]; then
CERT_ISSUES+=("$domain: ${days_remaining}d warning")
[[ "$DIGEST_SMART_ON_CERT_WARN" == true ]] && SHOULD_SEND=true
else
log "$ICON_CERT $domain: ${days_remaining}d remaining ✅"
fi
fi
done
+1
View File
@@ -143,6 +143,7 @@ done
log "Identity: $MY_ID ($LOCAL_SERVER_NAME)"
log "Ignoring pools: ${ZFS_REPORT_IGNORE_POOLS[*]:-none}"
log "$ICON_GEAR Config: arc-warn=${ZFS_REPORT_ARC_WARN_PCT}% free-warn=${ZFS_REPORT_FREE_WARN_GB}GB avail-warn=${ZFS_REPORT_AVAIL_WARN_GB}GB docker-top=${ZFS_REPORT_DOCKER_TOP}"
# Tee output to log file unless dry run
if [[ "$DRY_RUN" == false ]]; then