Files
html/api/infra-load.php
Opus f6d126436c fix(vnc-picker + cockpit w322): UX force Inter + live CDP status + health bar
CAUSE RACINE (capture Yacine 17:31):
1. VNC Picker: ABCDEF initiales italiques serif (--font-display local)
   ne sont pas override par w321 (specificite CSS local > w321 global)
2. 8 providers NOT STARTED alors que CDP 8/8 effectivement UP
   (JS frontend ne polle pas lapi cdp-status.php = etat FIGE)
3. Cockpit health bar S204 - CDP -/8 WTP - S95 S151 (tous vides)
   (poller existant ne marche pas bien)

FIX wave 322:
A) vnc-picker.html:
   - w322-vnc-ux-force CSS:
     * --font-display override Inter (pas serif italic)
     * .letter/.initial gradient indigo->purple (WTP)
     * font-style:normal forced partout
     * cards bg #0e111c border WTP
     * buttons indigo WTP-style
   - w322-cdp-live-poller JS:
     * fetch /api/cdp-status.php every 5s
     * match card par slug/data-slug/name
     * update data-cdp-status attribute + class cdp-up/down
     * injecte HTML live RUNNING/OFFLINE/STARTING avec couleurs

B) wevia-cockpit.html:
   - w322-cockpit-health-fix JS:
     * poll cdp-status + wtp-orphans + infra-load 10s
     * update h-cdp, h-wtp, h-load, h-providers
     * dot class ok/warn/err selon threshold

C) /api/infra-load.php NEW:
   - endpoint simple: load_1/5/15, ram_total_mb, ram_used_mb, disk_pct
   - evite appel agent-exec lourd (qui saturait S204)
   - consume par cockpit health bar

Zero regression (JS+CSS additive, endpoints nouveaux)
chattr +i toggle, GOLD backups
CF purge 4 URLs
2026-04-24 18:33:47 +02:00

23 lines
742 B
PHP

<?php
// /api/infra-load.php - simple infra load endpoint for health bar
header('Content-Type: application/json');
header('Cache-Control: no-store');
$up = trim(shell_exec('uptime 2>&1'));
preg_match('/load average:\s*([\d.]+),\s*([\d.]+),\s*([\d.]+)/', $up, $m);
$free = shell_exec('free -m 2>&1');
preg_match('/Mem:\s+(\d+)\s+(\d+)/', $free, $mf);
$disk = shell_exec('df -h / 2>&1 | tail -1');
preg_match('/(\d+)%/', $disk, $dm);
echo json_encode([
'ok' => true,
'ts' => date('c'),
'load_1' => floatval($m[1] ?? 0),
'load_5' => floatval($m[2] ?? 0),
'load_15' => floatval($m[3] ?? 0),
'ram_total_mb' => intval($mf[1] ?? 0),
'ram_used_mb' => intval($mf[2] ?? 0),
'disk_pct' => intval($dm[1] ?? 0),
'uptime_raw' => $up
]);