updated weekly health and sunday coffee report, all needed monitor now in both
This commit is contained in:
@@ -690,6 +690,59 @@ fi
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
section "⚙️ SYSTEM HEALTH"
|
||||
|
||||
# inotify + php-fpm weekly stats
|
||||
if [[ -f "${TUNING_MONITOR_LOG:-}" ]] && [[ -s "$TUNING_MONITOR_LOG" ]]; then
|
||||
# inotify weekly stats
|
||||
INOTIFY_PEAK=$(awk -F'|' -v cutoff="$WEEK_START" \
|
||||
'$1 >= cutoff {if ($3+0 > max) max=$3+0} END {print max+0}' "$TUNING_MONITOR_LOG")
|
||||
INOTIFY_AVG=$(awk -F'|' -v cutoff="$WEEK_START" \
|
||||
'$1 >= cutoff {sum+=$3; count++} END {if(count>0) printf "%.0f", sum/count; else print 0}' \
|
||||
"$TUNING_MONITOR_LOG")
|
||||
INOTIFY_LOW=$(awk -F'|' -v cutoff="$WEEK_START" \
|
||||
'BEGIN{min=99999} $1 >= cutoff {if($3+0 < min) min=$3+0} END {print min+0}' \
|
||||
"$TUNING_MONITOR_LOG")
|
||||
INOTIFY_LIMIT_NOW=$(sysctl -n fs.inotify.max_user_instances 2>/dev/null || echo 1024)
|
||||
INOTIFY_NOW=$(find /proc/*/fd -lname 'anon_inode:inotify' 2>/dev/null | wc -l)
|
||||
INOTIFY_NOW="${INOTIFY_NOW//[^0-9]/}"; INOTIFY_NOW="${INOTIFY_NOW:-0}"
|
||||
INOTIFY_NOW_PCT=$(( INOTIFY_NOW * 100 / INOTIFY_LIMIT_NOW ))
|
||||
INOTIFY_WARN_COUNT=$(awk -F'|' -v cutoff="$WEEK_START" \
|
||||
'$1 >= cutoff && $6 == 1 {count++} END {print count+0}' "$TUNING_MONITOR_LOG")
|
||||
|
||||
if [[ "${INOTIFY_WARN_COUNT:-0}" -gt 0 ]]; then
|
||||
issue "inotify: ${INOTIFY_NOW}/${INOTIFY_LIMIT_NOW} now (${INOTIFY_NOW_PCT}%) | week peak: $INOTIFY_PEAK avg: $INOTIFY_AVG low: $INOTIFY_LOW | ⚠️ warnings: $INOTIFY_WARN_COUNT"
|
||||
else
|
||||
line "inotify: ${INOTIFY_NOW}/${INOTIFY_LIMIT_NOW} now (${INOTIFY_NOW_PCT}%) | week peak: $INOTIFY_PEAK avg: $INOTIFY_AVG low: $INOTIFY_LOW ✅"
|
||||
fi
|
||||
|
||||
# php-fpm weekly stats
|
||||
PHPFPM_PEAK=$(awk -F'|' -v cutoff="$WEEK_START" \
|
||||
'$1 >= cutoff {if ($7+0 > max) max=$7+0} END {print max+0}' "$TUNING_MONITOR_LOG")
|
||||
PHPFPM_AVG=$(awk -F'|' -v cutoff="$WEEK_START" \
|
||||
'$1 >= cutoff {sum+=$7; count++} END {if(count>0) printf "%.0f", sum/count; else print 0}' \
|
||||
"$TUNING_MONITOR_LOG")
|
||||
PHPFPM_MAX_NOW="${PHP_MAX_CHILDREN:-250}"
|
||||
PHPFPM_NOW=$(ps aux 2>/dev/null | grep -c "php-fpm: pool" || echo 0)
|
||||
PHPFPM_NOW="${PHPFPM_NOW//[^0-9]/}"; PHPFPM_NOW="${PHPFPM_NOW:-0}"
|
||||
PHPFPM_WARN_COUNT=$(awk -F'|' -v cutoff="$WEEK_START" \
|
||||
'$1 >= cutoff && $10 == 1 {count++} END {print count+0}' "$TUNING_MONITOR_LOG")
|
||||
|
||||
if [[ "${PHPFPM_WARN_COUNT:-0}" -gt 0 ]]; then
|
||||
issue "php-fpm: ${PHPFPM_NOW}/${PHPFPM_MAX_NOW} workers now | week peak: $PHPFPM_PEAK avg: $PHPFPM_AVG | ⚠️ warnings: $PHPFPM_WARN_COUNT"
|
||||
else
|
||||
line "php-fpm: ${PHPFPM_NOW}/${PHPFPM_MAX_NOW} workers now | week peak: $PHPFPM_PEAK avg: $PHPFPM_AVG ✅"
|
||||
fi
|
||||
else
|
||||
# No log yet — just show live values
|
||||
INOTIFY_LIMIT_NOW=$(sysctl -n fs.inotify.max_user_instances 2>/dev/null || echo 1024)
|
||||
INOTIFY_NOW=$(find /proc/*/fd -lname 'anon_inode:inotify' 2>/dev/null | wc -l)
|
||||
INOTIFY_NOW="${INOTIFY_NOW//[^0-9]/}"; INOTIFY_NOW="${INOTIFY_NOW:-0}"
|
||||
INOTIFY_NOW_PCT=$(( INOTIFY_NOW * 100 / INOTIFY_LIMIT_NOW ))
|
||||
PHPFPM_NOW=$(ps aux 2>/dev/null | grep -c "php-fpm: pool" || echo 0)
|
||||
PHPFPM_NOW="${PHPFPM_NOW//[^0-9]/}"; PHPFPM_NOW="${PHPFPM_NOW:-0}"
|
||||
line "inotify: ${INOTIFY_NOW}/${INOTIFY_LIMIT_NOW} (${INOTIFY_NOW_PCT}%) — no weekly data yet"
|
||||
line "php-fpm: ${PHPFPM_NOW}/${PHP_MAX_CHILDREN:-250} workers — no weekly data yet"
|
||||
fi
|
||||
|
||||
# SMART summary
|
||||
if command -v smartctl >/dev/null 2>&1; then
|
||||
SMART_ISSUES=0
|
||||
|
||||
Reference in New Issue
Block a user