\n"; $cl = "data"; // Subnet print "\n"; // Total IPs $subnet_ips = max(0, $row['ip_int_stop'] - $row['ip_int_start'] + 1); if ($subnet_ips > 4 ) { $all_ips = $subnet_ips - 3; } else { $all_ips = $subnet_ips; } print "\n"; // Used (total) $used_all = get_count_records($db_link, 'user_auth', 'deleted = 0 AND ip_int >= ? AND ip_int <= ?', [$row['ip_int_start'], $row['ip_int_stop']]); $total_used_percent = ($all_ips > 0) ? ($used_all / $all_ips) * 100 : 0; $total_class = ''; if ($total_used_percent >= 95) { $total_class = 'error'; } elseif ($total_used_percent >= 85) { $total_class = 'warn'; } print "\n"; // Free (total) $free_all = max(0, $all_ips - $used_all); $free_total_class = ''; if ($all_ips > 0) { $free_total_percent = ($free_all / $all_ips) * 100; if ($free_total_percent <= 5) { $free_total_class = 'error'; } elseif ($free_total_percent <= 15) { $free_total_class = 'warn'; } } print "\n"; // DHCP pool size $dhcp_pool = max(0, $row['dhcp_stop'] - $row['dhcp_start'] + 1); print "\n"; // Used (DHCP) $used_dhcp = 0; if ($dhcp_pool > 0) { $used_dhcp = get_count_records($db_link, 'user_auth', 'deleted = 0 AND ip_int >= ? AND ip_int <= ?', [$row['dhcp_start'], $row['dhcp_stop']]); } $dhcp_used_percent = ($dhcp_pool > 0) ? ($used_dhcp / $dhcp_pool) * 100 : 0; $dhcp_used_class = ''; if ($dhcp_used_percent >= 95) { $dhcp_used_class = 'error'; } elseif ($dhcp_used_percent >= 85) { $dhcp_used_class = 'warn'; } print "\n"; // Free (DHCP) $free_dhcp = max(0, $dhcp_pool - $used_dhcp); $free_dhcp_class = ''; if ($dhcp_pool > 0) { $free_dhcp_percent = ($free_dhcp / $dhcp_pool) * 100; if ($free_dhcp_percent <= 5) { $free_dhcp_class = 'error'; } elseif ($free_dhcp_percent <= 15) { $free_dhcp_class = 'warn'; } } print "\n"; // Free static $free_static = max ( 0, $free_all - $free_dhcp); print "\n"; // Zombie (total) — от общего размера подсети $zombi_total = get_count_records($db_link, 'user_auth', 'deleted = 0 AND ip_int >= ? AND ip_int <= ? AND last_found <= ?', [$row['ip_int_start'], $row['ip_int_stop'], $zombi_threshold]); $zombi_total_class = ''; if ($all_ips > 0) { $zombi_total_ratio = ($zombi_total / $all_ips) * 100; if ($zombi_total_ratio >= 30) { $zombi_total_class = 'error'; } elseif ($zombi_total_ratio >= 20) { $zombi_total_class = 'warn'; } } print "\n"; // Zombie (DHCP) — от размера DHCP-пула $zombi_dhcp = get_count_records($db_link, 'user_auth', 'deleted = 0 AND ip_int >= ? AND ip_int <= ? AND last_found <= ?', [$row['dhcp_start'], $row['dhcp_stop'], $zombi_threshold]); $zombi_dhcp_class = ''; if ($dhcp_pool > 0) { $zombi_dhcp_ratio = ($zombi_dhcp / $dhcp_pool) * 100; if ($zombi_dhcp_ratio >= 30) { $zombi_dhcp_class = 'error'; } elseif ($zombi_dhcp_ratio >= 20) { $zombi_dhcp_class = 'warn'; } } print "\n"; print "\n"; } } ?>

".$zombi_days." ".WEB_days.")"; ?>

".$zombi_days." ".WEB_days.")"; ?>
" . htmlspecialchars($row['subnet']) . "" . $all_ips . "" . $used_all . "" . $free_all . "" . $dhcp_pool . "" . $used_dhcp . "" . $free_dhcp . "" . $free_static . "" . $zombi_total . "" . $zombi_dhcp . "