Files
html/api/ambre-scan-v11.php
2026-04-22 04:55:03 +02:00

43 lines
1.8 KiB
PHP

<?php
header("Content-Type: application/json");
$out = [];
chdir("/var/www/html");
$out["recent_tags"] = array_filter(array_map("trim", explode("\n", @shell_exec("git tag -l 'wave-*' --sort=-creatordate 2>&1 | head -10"))));
// Check V11 errors via direct fetch sim
$t0 = microtime(true);
$test = @file_get_contents("http://127.0.0.1/api/ambre-multiagent-parallel.php", false, stream_context_create([
"http"=>["method"=>"POST","header"=>"Content-Type: application/json\r\n",
"content"=>json_encode(["goal"=>"compare A avec B sur X, Y, Z en analyse complete","max_agents"=>3]),
"timeout"=>90]
]));
$out["ma_endpoint_ms"] = round((microtime(true)-$t0)*1000);
$out["ma_response_size"] = strlen($test ?: "FAIL");
$out["ma_response_head"] = substr($test ?: "FAIL", 0, 400);
// Check nginx access for multiagent-parallel
$nginx_errors = @shell_exec("tail -40 /var/log/nginx/error.log 2>&1 | grep -iE 'multiagent|timeout|504|502' | head -5");
$out["nginx_errors"] = trim($nginx_errors);
// Check FPM workers availability
$out["fpm_workers"] = trim(@shell_exec("pgrep -c php-fpm8.5 2>&1"));
$out["load"] = trim(@shell_exec("uptime"));
// WEVIA Master state (private page)
$master = @file_get_contents("/var/www/html/wevia-master.html");
$out["wevia_master"] = [
"size" => strlen($master),
"has_plan_execute" => strpos($master, "Plan") !== false && strpos($master, "Execute") !== false,
"has_multiagent" => strpos($master, "multiagent") !== false || strpos($master, "parallel") !== false,
];
// Widget public root /
$root_idx = @file_get_contents("/var/www/html/index.html");
$out["root_index"] = [
"size" => strlen($root_idx ?? ""),
"has_wevia_widget" => strpos($root_idx ?? "", "wevia") !== false,
];
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);