option('server')) { $this->checkSpecificServer($serverId, $monitoringService); } else { $this->checkAllServers($monitoringService); } } /** * Check all active servers */ private function checkAllServers(UptimeMonitoringService $monitoringService): void { $this->info('Starting uptime check for all active servers...'); try { $monitoringService->checkAllServers(); $this->info('Uptime check completed successfully!'); } catch (\Exception $e) { $this->error('Uptime check failed: ' . $e->getMessage()); } } /** * Check a specific server */ private function checkSpecificServer(string $serverId, UptimeMonitoringService $monitoringService): void { $this->info("Starting uptime check for server ID: {$serverId}..."); try { $server = \Paymenter\Extensions\Others\UptimeLab\Models\UptimeServer::find($serverId); if (!$server) { $this->error("Server with ID {$serverId} not found."); return; } $checkResult = $monitoringService->checkServerStatus($server); $monitoringService->updateServerStatus($server, $checkResult); $status = $checkResult['online'] ? 'ONLINE' : 'OFFLINE'; $responseTime = $checkResult['response_time'] ? $checkResult['response_time'] . 'ms' : 'N/A'; $this->info("Server: {$server->name}"); $this->info("Status: {$status}"); $this->info("Response Time: {$responseTime}"); $this->info("Uptime check completed successfully!"); } catch (\Exception $e) { $this->error('Uptime check failed: ' . $e->getMessage()); } } }