61 lines
2.6 KiB
PHP
61 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use App\Livewire\Concerns\WithFleetContext;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Attributes\Title;
|
|
use Livewire\Component;
|
|
|
|
#[Layout('layouts.app')]
|
|
#[Title('Clusev — Dashboard')]
|
|
class Dashboard extends Component
|
|
{
|
|
use WithFleetContext;
|
|
|
|
/**
|
|
* Mock fleet data. Replaced by the SSH layer (phpseclib) + Reverb later.
|
|
* Shapes mirror what MetricsPoller/FleetService will return.
|
|
*/
|
|
public array $servers = [];
|
|
|
|
public array $services = [];
|
|
|
|
public array $events = [];
|
|
|
|
/** rolling CPU% series for the live chart placeholder */
|
|
public array $metrics = [];
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->servers = [
|
|
['name' => 'web-01', 'ip' => '10.10.90.136', 'os' => 'Debian 13', 'status' => 'online', 'cpu' => 34, 'mem' => 61],
|
|
['name' => 'db-02', 'ip' => '10.10.90.140', 'os' => 'Debian 12', 'status' => 'warning', 'cpu' => 78, 'mem' => 83],
|
|
['name' => 'cache-03', 'ip' => '10.10.90.141', 'os' => 'Alpine 3.20', 'status' => 'offline', 'cpu' => 0, 'mem' => 0],
|
|
['name' => 'edge-04', 'ip' => '10.10.90.150', 'os' => 'Ubuntu 24.04','status' => 'online', 'cpu' => 12, 'mem' => 39],
|
|
];
|
|
|
|
$this->services = [
|
|
['name' => 'nginx.service', 'status' => 'online', 'desc' => 'A high performance web server'],
|
|
['name' => 'mariadb.service', 'status' => 'online', 'desc' => 'MariaDB 11 database server'],
|
|
['name' => 'redis-server.service','status' => 'online', 'desc' => 'Advanced key-value store'],
|
|
['name' => 'php8.3-fpm.service', 'status' => 'warning', 'desc' => 'The PHP 8.3 FastCGI Process Manager'],
|
|
['name' => 'fail2ban.service', 'status' => 'offline', 'desc' => 'Ban hosts that cause multiple auth errors'],
|
|
];
|
|
|
|
$this->events = [
|
|
['actor' => 'admin', 'action' => 'Dienst neu gestartet', 'target' => 'php8.3-fpm.service', 'when' => 'vor 2 Min'],
|
|
['actor' => 'admin', 'action' => 'SSH-Schlüssel hinzugefügt', 'target' => 'web-01', 'when' => 'vor 18 Min'],
|
|
['actor' => 'system', 'action' => 'Server offline', 'target' => 'cache-03', 'when' => 'vor 1 Std'],
|
|
['actor' => 'admin', 'action' => 'Datei bearbeitet', 'target' => '/etc/nginx/nginx.conf', 'when' => 'vor 3 Std'],
|
|
];
|
|
|
|
$this->metrics = [22, 28, 25, 40, 38, 52, 47, 60, 55, 48, 63, 58, 71, 66, 74];
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.dashboard', ['active' => $this->activeServer()]);
|
|
}
|
|
}
|