<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } require_once DASHBOARD_ROOT . '/core/fleet_orchestrator.php'; $dbNodes = FleetOrchestrator::getNodes(); $csrfToken = CSRF::token(); $serviceMap = [ 'dns' => ['pdns','nginx','wireguard','sshd','fail2ban'], 'proxy' => ['nginx','tor','wireguard','sshd','fail2ban'], 'filter' => ['nginx','tor','wireguard','sshd','fail2ban'], 'shield' => ['nginx','tor','wireguard','sshd','fail2ban'], 'origin' => ['nginx','php-fpm','mariadb','wireguard','sshd','fail2ban'], 'payment' => ['nginx','php-fpm','mariadb','sshd','firewalld','amazon-ssm-agent'], 'email' => ['postfix','dovecot','wireguard','sshd','fail2ban'], ]; $nodes = []; foreach ($dbNodes as $n) { $role = $n['node_role'] ?? 'unknown'; $hbTime = $n['last_heartbeat'] ?? null; $hbAge = $hbTime ? max(0, time() - strtotime($hbTime)) : null; $nodes[$n['node_id']] = [ 'db_id' => (int)$n['id'], 'name' => ucfirst($role), 'role' => $role, 'wg_ip' => $n['wg_ip'] ?? '', 'status' => $n['status'] ?? 'provisioning', 'hostname' => $n['hostname'] ?? '', 'cpu' => (float)($n['cpu_usage_pct'] ?? 0), 'mem' => (float)($n['mem_usage_pct'] ?? 0), 'disk' => (float)($n['disk_usage_pct'] ?? 0), 'version' => $n['engine_version'] ?? '', 'hb' => $hbTime ? date('H:i', strtotime($hbTime)) : 'Never', 'hb_age' => $hbAge, 'services' => $serviceMap[$role] ?? ['nginx','sshd'], ]; } $engineStatus = ['running'=>false]; try { if (!defined('C1O2N3S4T5A6N7T8')) define('C1O2N3S4T5A6N7T8', true); if (file_exists(PRIVATE_DIR . '/p1a2y3m4_bridge.php')) { require_once PRIVATE_DIR . '/p1a2y3m4_bridge.php'; $eRes = p1a2y3m4_query('status', []); if (!empty($eRes['ok'])) { $engineStatus = ['running'=>true,'uptime'=>$eRes['uptime']??null,'blacklist_count'=>(int)($eRes['blacklist_count']??0),'ddos_active'=>!empty($eRes['ddos_active']),'watchdog_files'=>(int)($eRes['watchdog_files']??0),'dns_mode'=>$eRes['dns_failover_mode']??'normal']; } } } catch (\Throwable $e) {} 