@php $data = $this->getData(); $cpu = $data['cpu'] ?? []; $memory = $data['memory'] ?? []; $disk = $data['disk'] ?? []; $partitions = $disk['partitions'] ?? []; $load = $data['load'] ?? []; $uptime = $data['uptime'] ?? 'N/A'; $range = $this->range; $historyPoints = match ($range) { '5m' => 30, '30m' => 180, 'day' => 24, 'week' => 28, 'month' => 30, default => 30, }; $historyIntervalSeconds = match ($range) { '5m' => 10, '30m' => 10, 'day' => 3600, 'week' => 21600, 'month' => 86400, default => 60, }; $historyLabelFormat = match ($range) { '5m' => 'H:i:s', '30m' => 'H:i:s', 'day' => 'H:00', 'week' => 'M d H:00', 'month' => 'M d', default => 'H:i', }; $cpuCores = max(1, (int)($cpu['cores'] ?? 1)); $load1 = (float)($load['1min'] ?? 0); $load5 = (float)($load['5min'] ?? 0); $load15 = (float)($load['15min'] ?? 0); $ioWait = (float)($cpu['iowait'] ?? 0); $memUsage = $memory['usage'] ?? 0; $history = $this->getHistory( $load1, $ioWait, (float) $memUsage, (float) ($memory['swap_usage'] ?? 0), $partitions, ); $historyLabels = $history['labels'] ?? []; $historyLoad = $history['load'] ?? []; $historyIoWait = $history['iowait'] ?? []; $historyMemory = $history['memory'] ?? []; $historySwap = $history['swap'] ?? []; // Memory values are in MB from agent $memUsedGB = ($memory['used'] ?? 0) / 1024; $memTotalGB = ($memory['total'] ?? 0) / 1024; $swapUsedGB = ($memory['swap_used'] ?? 0) / 1024; $swapTotalGB = ($memory['swap_total'] ?? 0) / 1024; $hasSwap = $swapTotalGB > 0; $diskMounts = collect($partitions) ->map(fn (array $partition) => $partition['mount'] ?? $partition['filesystem'] ?? null) ->filter() ->unique() ->values() ->all(); $diskTotals = []; $diskUsedTotal = 0; $diskTotal = 0; foreach ($partitions as $partition) { $mount = $partition['mount'] ?? $partition['filesystem'] ?? null; if ($mount === null) { continue; } $used = (float) ($partition['used'] ?? 0); $total = (float) ($partition['total'] ?? 0); $diskTotals[$mount] = $total > 0 ? round($total / 1024 / 1024 / 1024, 2) : 0; $diskUsedTotal += $used; $diskTotal += $total; } $diskUsedTotalGB = $diskUsedTotal > 0 ? $diskUsedTotal / 1024 / 1024 / 1024 : 0; $diskTotalGB = $diskTotal > 0 ? $diskTotal / 1024 / 1024 / 1024 : 0; $diskUsedSeries = []; $diskFreeSeries = []; foreach ($diskMounts as $mount) { $partition = collect($partitions)->first(fn (array $row) => ($row['mount'] ?? $row['filesystem'] ?? null) === $mount); $used = $partition ? ((float) ($partition['used'] ?? 0)) / 1024 / 1024 / 1024 : 0; $total = $partition ? ((float) ($partition['total'] ?? 0)) / 1024 / 1024 / 1024 : 0; $diskUsedSeries[] = round($used, 2); $diskFreeSeries[] = round(max(0, $total - $used), 2); } @endphp
{{ __('Last 5 minutes') }} {{ __('Last 30 minutes') }} {{ __('Last day') }} {{ __('Last week') }} {{ __('Last month') }}
{{ __('Last updated') }}:
@if(!empty($data['warning']))
{{ __('Agent unavailable, showing local metrics.') }}
@endif {{-- Main Charts Grid (3 columns) --}}
{{-- CPU Usage Chart --}}
{{ __('Load') }} {{ $cpuCores }} {{ __('cores') }} · {{ __('Load') }}: {{ $load1 }} / {{ $load5 }} / {{ $load15 }}
{{-- Memory Usage Chart --}}
{{ __('Memory') }} {{ number_format($memUsedGB, 1) }} GB {{ __('used') }} / {{ number_format($memTotalGB, 1) }} GB {{ __('total') }} @if($hasSwap) · {{ __('Swap') }} {{ number_format($swapUsedGB, 1) }} GB / {{ number_format($swapTotalGB, 1) }} GB @endif
{{-- Disk Usage Chart --}} @if(!empty($diskMounts))
{{ __('Disk Usage') }} {{ number_format($diskUsedTotalGB, 1) }} GB {{ __('used') }} / {{ number_format($diskTotalGB, 1) }} GB {{ __('total') }}
@endif