30 lines
1.1 KiB
PHP
30 lines
1.1 KiB
PHP
<?php
|
|
// WEVIA Master — Enterprise Model Status Widget
|
|
// Returns live stats for Centre Commande display
|
|
header('Content-Type: application/json');
|
|
header('Access-Control-Allow-Origin: *');
|
|
|
|
$report = '/var/www/html/api/l99-enterprise-test.json';
|
|
$data = file_exists($report) ? json_decode(file_get_contents($report), true) : [];
|
|
|
|
$nonreg = @json_decode(@file_get_contents('https://weval-consulting.com/api/nonreg-api.php?cat=all'), true);
|
|
|
|
echo json_encode([
|
|
'enterprise' => [
|
|
'agents' => $data['agents'] ?? 0,
|
|
'depts' => $data['depts'] ?? 0,
|
|
'links' => $data['links'] ?? 0,
|
|
'score' => $data['score'] ?? 'N/A',
|
|
'js_errors' => $data['js_errors'] ?? -1,
|
|
'work_active' => $data['work_active'] ?? false,
|
|
'last_check' => filemtime($report) ? date('c', filemtime($report)) : null,
|
|
],
|
|
'nonreg' => [
|
|
'pass' => $nonreg['pass'] ?? 0,
|
|
'total' => $nonreg['total'] ?? 0,
|
|
'score' => $nonreg['score'] ?? 0,
|
|
],
|
|
'git' => trim(@shell_exec('cd /var/www/html && git rev-parse --short HEAD 2>/dev/null')),
|
|
'status' => ($data['pass'] ?? false) ? 'HEALTHY' : 'DEGRADED',
|
|
]);
|