From 333bc756ec3b4d71b1e578e6a11f83c7a9693ff0 Mon Sep 17 00:00:00 2001 From: Developer Date: Mon, 20 Apr 2026 18:45:35 -0400 Subject: [PATCH] fix: batch analyzer traffic display - show percentage not raw concurrent requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change traffic indicator to display traffic PERCENTAGE (e.g., 99% of server) - Remove display of raw peak concurrent requests (421) from traffic indicator - Threshold-based severity: 50%+ CRITICAL, 25%+ HIGH, 10%+ MEDIUM, <10% LOW - Shows traffic percentage consistently for both optimized and non-optimized domains - Now displays like '⚠ CRITICAL TRAFFIC (99% of server)' instead of '⚠ CRITICAL TRAFFIC (421)' --- modules/performance/php-fpm-batch-analyzer.sh | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/performance/php-fpm-batch-analyzer.sh b/modules/performance/php-fpm-batch-analyzer.sh index 21630fc..963d13a 100755 --- a/modules/performance/php-fpm-batch-analyzer.sh +++ b/modules/performance/php-fpm-batch-analyzer.sh @@ -280,17 +280,18 @@ for idx in "${sorted_indices[@]}"; do continue fi - # Determine traffic indicator + # Determine traffic indicator based on traffic PERCENTAGE (not peak concurrent) traffic_indicator="" - if [[ "$peak" =~ ^[0-9]+$ ]]; then - if [ "$peak" -ge 20 ]; then - traffic_indicator="${RED}⚠ CRITICAL TRAFFIC (${peak})${NC}" - elif [ "$peak" -ge 10 ]; then - traffic_indicator="${YELLOW}⚠ HIGH TRAFFIC (${peak})${NC}" - elif [ "$peak" -ge 5 ]; then - traffic_indicator="${CYAN}→ MEDIUM TRAFFIC (${peak})${NC}" + traffic_pct="${traffic_percentage_arr[$idx]:-0}" + if [[ "$traffic_pct" =~ ^[0-9]+$ ]]; then + if [ "$traffic_pct" -ge 50 ]; then + traffic_indicator="${RED}⚠ CRITICAL TRAFFIC${NC}" + elif [ "$traffic_pct" -ge 25 ]; then + traffic_indicator="${YELLOW}⚠ HIGH TRAFFIC${NC}" + elif [ "$traffic_pct" -ge 10 ]; then + traffic_indicator="${CYAN}→ MEDIUM TRAFFIC${NC}" else - traffic_indicator="${WHITE}○ LOW TRAFFIC (${peak})${NC}" + traffic_indicator="${WHITE}○ LOW TRAFFIC${NC}" fi else traffic_indicator="${WHITE}○ TRAFFIC UNKNOWN${NC}" @@ -317,7 +318,7 @@ for idx in "${sorted_indices[@]}"; do else cecho "${GREEN}[$idx]${NC} $domain" cecho " Owner: $owner" - cecho " Traffic: $traffic_indicator" + cecho " Traffic: $traffic_indicator (${traffic_percentage_arr[$idx]}% of server)" cecho "" cecho " ${BOLD}Pool Settings:${NC}" cecho " pm.max_children: $current"