@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)
|
{{ $fpmTranslations[$key] ?? str_replace('_', ' ', $key) }}
({{ str_replace('_', ' ', $key) }})
|
{{ is_bool($val) ? ($val ? 'On' : 'Off') : $val }} |
@endforeach
@else
| 無法讀取 FPM 狀態 |
@endif
{{-- Charts hourly --}}
{{-- Charts daily --}}
{{-- Apache Content --}}
-
-
-
{{-- 即時狀態 --}}
@if ($apache_status['status']['status'] === true)
@foreach ($apache_status['status'] as $key => $val)
|
{{ $apacheTranslations[$key] ?? str_replace('_', ' ', $key) }}
({{ str_replace('_', ' ', $key) }})
|
@if ($key === 'scoreboard')
{!! renderScoreboard($val) !!} |
@else
{{ is_bool($val) ? ($val ? 'On' : 'Off') : $val }} |
@endif
@endforeach
@else
| 無法讀取 Apache 狀態 |
@endif
{{-- access.log --}}
{{-- Top 10 Requests --}}
| # |
請求 |
次數 |
@forelse ($apache_status['top_requests'] as $request => $count)
| {{ $loop->iteration }} |
{{ $request }} |
{{ $count }} |
@empty
| 暫無資料 |
@endforelse
{{-- Top 10 Errors --}}
| # |
錯誤請求 |
次數 |
@forelse ($apache_status['top_errors'] as $request => $count)
| {{ $loop->iteration }} |
{{ $request }} |
{{ $count }} |
@empty
| 暫無資料 |
@endforelse
{{-- other_vhosts_access.log --}}
| # |
請求 |
次數 |
@forelse ($apache_status['top_other_vhosts_requests'] as $request => $count)
| {{ $loop->iteration }} |
{{ $request }} |
{{ $count }} |
@empty
| 暫無資料 |
@endforelse
@endsection
@push('scripts')
@endpush