@extends('backendTools.layouts.backend') @section('title', '伺服器狀態') @section('header') 伺服器狀態 @endsection @section('content') @php // 列表翻譯對照 $fpmTranslations = [ 'pool' => '連線池', 'process_manager' => '程序管理器', 'start_time' => '啟動時間', 'start_since' => '運行時間(秒)', 'accepted_conn' => '接受的連接數', 'listen_queue' => '等待連接佇列', 'max_listen_queue' => '最大等待連接佇列', 'listen_queue_len' => '等待連接佇列長度', 'idle_processes' => '閒置處理程序', 'active_processes' => '執行中處理程序', 'total_processes' => '總處理程序', 'max_active_processes' => '最大執行中處理程序', 'max_children_reached' => '達到最大子處理程序限制次數', 'slow_requests' => '慢速請求數', 'status' => '狀態', ]; $apacheTranslations = [ 'total_accesses' => '總訪問量', 'total_kbytes' => '總傳輸量 (KB)', 'cpuload' => 'CPU 負載', 'uptime' => '運行時間(秒)', 'reqpersec' => '平均每秒請求數', 'bytespersec' => '平均每秒傳輸量', 'bytesperreq' => '平均每次請求傳輸量', 'busyworkers' => '忙碌的工作執行緒', 'idleworkers' => '閒置的工作執行緒', 'scoreboard' => '計分板', 'status' => '狀態', ]; // apache scoreboard renderer function renderScoreboard($scoreboard) { $legend = [ '_' => ['label' => 'Waiting', 'color' => 'secondary'], 'S' => ['label' => 'Starting up', 'color' => 'info'], 'R' => ['label' => 'Reading Request', 'color' => 'primary'], 'W' => ['label' => 'Sending Reply', 'color' => 'success'], 'K' => ['label' => 'Keepalive', 'color' => 'warning'], 'D' => ['label' => 'DNS Lookup', 'color' => 'dark'], 'C' => ['label' => 'Closing connection', 'color' => 'danger'], 'L' => ['label' => 'Logging', 'color' => 'info'], 'G' => ['label' => 'Gracefully finishing', 'color' => 'light'], 'I' => ['label' => 'Idle cleanup', 'color' => 'light'], '.' => ['label' => 'Open slot', 'color' => 'white'], ]; $visualHtml = '
'; foreach (str_split($scoreboard) as $char) { $state = $legend[$char] ?? ['label' => 'Unknown', 'color' => 'light']; $visualHtml .= '' . $char . ''; } $visualHtml .= '
'; $legendHtml = '
'; foreach ($legend as $char => $state) { $legendHtml .= '' . $char . '' . $state['label'] . ''; } $legendHtml .= '
'; $collapseId = 'scoreboard-details'; $button = ''; $rawText = '
' . e($scoreboard) . '
'; $collapsibleContent = '
' . $visualHtml . $legendHtml . '
'; return $rawText . $button . $collapsibleContent; } @endphp
{{-- PHP-FPM Content --}}
即時狀態
@if ($fpm_status['status']['status'] === true) @foreach ($fpm_status['status'] as $key => $val) @endforeach @else @endif
{{ $fpmTranslations[$key] ?? str_replace('_', ' ', $key) }} ({{ str_replace('_', ' ', $key) }}) {{ is_bool($val) ? ($val ? 'On' : 'Off') : $val }}
無法讀取 FPM 狀態
{{-- Charts hourly --}}
今日每小時平均
{{-- Charts daily --}}
最近 7 天每日平均
{{-- Apache Content --}}
{{-- 即時狀態 --}}
即時狀態
@if ($apache_status['status']['status'] === true) @foreach ($apache_status['status'] as $key => $val) @if ($key === 'scoreboard') @else @endif @endforeach @else @endif
{{ $apacheTranslations[$key] ?? str_replace('_', ' ', $key) }} ({{ str_replace('_', ' ', $key) }}) {!! renderScoreboard($val) !!}{{ is_bool($val) ? ($val ? 'On' : 'Off') : $val }}
無法讀取 Apache 狀態
{{-- access.log --}}
{{-- Top 10 Requests --}}
今日 Top 10 請求
@forelse ($apache_status['top_requests'] as $request => $count) @empty @endforelse
# 請求 次數
{{ $loop->iteration }} {{ $request }} {{ $count }}
暫無資料
{{-- Top 10 Errors --}}
今日 Top 10 錯誤
@forelse ($apache_status['top_errors'] as $request => $count) @empty @endforelse
# 錯誤請求 次數
{{ $loop->iteration }} {{ $request }} {{ $count }}
暫無資料
今日每小時請求
最近 7 天每日請求
{{-- other_vhosts_access.log --}}
今日 Top 10 請求
@forelse ($apache_status['top_other_vhosts_requests'] as $request => $count) @empty @endforelse
# 請求 次數
{{ $loop->iteration }} {{ $request }} {{ $count }}
暫無資料
今日每小時請求
最近 7 天每日請求
@endsection @push('scripts') @endpush