#!/usr/bin/env php execute( "INSERT INTO server_stats (cpu_usage, ram_usage, disk_usage, load_avg, net_in_kb, net_out_kb) VALUES (?,?,?,?,?,?)", [$cpuPct, $ramPct, $diskPct, $load[0], $netIn, $netOut] ); // Prune rows older than 30 days $db->execute("DELETE FROM server_stats WHERE recorded_at < DATE_SUB(NOW(), INTERVAL 30 DAY)"); // Proxy health check — restart nginx on remote proxy VM if it's stopped require_once NOVACPX_LIB . '/ProxyManager.php'; ProxyManager::healthCheck();