['bind' => '10.200.27.20', 'port' => '5000'], 'gali' => ['bind' => '10.200.27.20', 'port' => '5000'], // same as cosmostat 'drive_health' => ['bind' => '172.25.1.18', 'port' => '5001'], // new API ]; /* ---------- Helper: fetch client details ---------- */ function fetchClientDetails(string $bindIp, string $port, string $path = '/client_details'): array { $url = "http://{$bindIp}:{$port}{$path}"; $ctx = stream_context_create([ 'http' => [ 'timeout' => 5, 'header' => "User-Agent: PHP/" . PHP_VERSION . "\r\n" ] ]); $json = @file_get_contents($url, false, $ctx); if ($json === false) { return []; } $data = json_decode($json, true); return (is_array($data)) ? $data : []; } /* ---------- Fetch client details ---------- */ $apiInfo = $apiConfig[$mode]; $clients = fetchClientDetails($apiInfo['bind'], $apiInfo['port']); /* ---------- Handle empty / error ---------- */ if ($clients === []) { die('

Could not retrieve data from the API for mode "' . h($mode) . '".

'); } /* ---------- Ensure each client has a short_id ---------- */ foreach ($clients as &$client) { if (!isset($client['short_id'])) { $client['short_id'] = substr($client['uuid'] ?? '', 0, 8); } } unset($client); /* ---------- Determine selected hosts (Drive Health only) ---------- */ $selectedHosts = $_GET['hosts'] ?? []; // default: whatever was submitted if ($mode === 'drive_health') { if (isset($_GET['action'])) { switch ($_GET['action']) { case 'all': // add every client’s short_id $selectedHosts = array_column($clients, 'short_id'); break; case 'none': $selectedHosts = []; // nothing selected break; // 'apply' does nothing extra – the array above already contains the chosen hosts } } } /* ---------- Determine selected host for other modes ---------- */ $selectedId = $_GET['host'] ?? ''; $selectedIdx = null; foreach ($clients as $idx => $client) { if (isset($client['short_id']) && $client['short_id'] === $selectedId) { $selectedIdx = $idx; break; } } if ($selectedIdx === null) { $selectedIdx = 0; $selectedId = $clients[$selectedIdx]['short_id'] ?? ''; } $client = $clients[$selectedIdx] ?? null; $properties = $client['client_properties'][0] ?? []; $systemProperties = $properties['system_properties'] ?? []; $systemComponents = $properties['system_components'] ?? []; $selectedHost = $clients[$selectedIdx]['hostname'] ?? 'Unknown'; /* ---- Sidebar Renderer ---- */ function renderSidebar(string $mode) { global $clients, $client, $properties, $systemProperties, $systemComponents, $selectedHost, $selectedId, $selectedIdx, $selectedHosts; $modes = [ 'cosmostat' => 'Cosmostat', 'gali' => 'Shuttle Gali', 'drive_health' => 'Drive Health', ]; ?>

No hosts selected.

'; return; } foreach ($selectedHosts as $sid) { // Find the client that matches this short_id $c = null; foreach ($clients as $cl) { if ($cl['short_id'] === $sid) { $c = $cl; break; } } if ($c === null) continue; // safety $hostname = $c['name'] ?? 'Unknown'; echo '
'; echo '

Drive Health - ' . h($hostname) . '

'; if (isset($c['drives']) && is_array($c['drives']) && count($c['drives']) > 0) { echo ''; echo ''; echo ''; foreach ($c['drives'] as $drive) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
Drive LetterModelCapacityPower On HoursHost WritesWear Level
' . h($drive['drive_letter'] ?? '') . '' . h($drive['model'] ?? '') . '' . h($drive['capacity'] ?? '') . '' . h($drive['power_on_hours'] ?? '') . '' . h($drive['host_writes'] ?? '') . '' . h($drive['wear_level'] ?? '') . '
'; } else { echo '

No drive data available for this host.

'; } echo '
'; } return; } /* ---------- Other modes ---------- */ ?>

Matt-Cloud Cosmostat Dashboard

This dashboard shows the local Matt-Cloud system stats.

Component Desriptor

To view the component descriptor, you may
curl -s https:///descriptor

This will return the entire JSON descriptor variable.
The endpoint agent uses this descriptor to build out its local System Object.
The agent then reports back to the Cosmostat Server with all the data found in the descriptor.
Full Source Code can be found at its Gitea page.

System Properties

Live System Metrics

Connecting...

Components

Shuttle Gali

Cosmostat - <?= h($selectedHost) ?> (<?= h($mode) ?>)