- ARRAY_START_SCRIPTS: add api_cache_writer.sh so monitor/arrs cache is populated immediately on array start (/tmp is tmpfs — cleared on reboot, so first-boot load was hitting live API for up to 60 seconds until the cron fired) - api/monitor.php + arrs.php: raise cache TTL from 90s to 300s — stale-but-instant beats a 6-second live API wait if the writer is momentarily behind - include/unraid_api.php: replace last inline uptime formatter with vv_format_uptime()
45 lines
1.6 KiB
PHP
45 lines
1.6 KiB
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
require_once dirname(__DIR__) . '/include/config.php';
|
|
|
|
$_vv_cached = vv_cache_read('monitor', 300);
|
|
if ($_vv_cached !== null) { echo json_encode($_vv_cached); exit; }
|
|
unset($_vv_cached);
|
|
|
|
require_once dirname(__DIR__) . '/include/monitor.php';
|
|
require_once dirname(__DIR__) . '/include/vms.php';
|
|
require_once dirname(__DIR__) . '/include/docker_folders.php';
|
|
|
|
// Pre-warm the API cache with one request (shared by all API-first functions below).
|
|
vv_api_data();
|
|
|
|
echo json_encode([
|
|
'system' => vv_system_info(),
|
|
'fallback' => vv_fallback_state(),
|
|
'fallback_active' => vv_fallback_active(),
|
|
'partner' => vv_partner_state(),
|
|
'resources' => vv_system_resources(),
|
|
'cpu' => vv_cpu_per_core(),
|
|
'mem' => vv_memory_breakdown(),
|
|
'net' => vv_network_stats(),
|
|
'gpu' => vv_gpu_stats(),
|
|
'gpu_procs' => vv_gpu_processes(),
|
|
'containers' => vv_docker_containers(),
|
|
'stopped' => vv_docker_stopped(),
|
|
'transcode' => vv_transcode_sessions(),
|
|
'ups' => vv_ups_stats(),
|
|
'parity' => vv_parity_status(),
|
|
'storage' => vv_storage_pools(),
|
|
'array_disks' => vv_array_disks(),
|
|
'disk_io' => vv_disk_io_rates(),
|
|
'watchdog' => vv_watchdog_summary(),
|
|
'scripts' => vv_scripts_status(),
|
|
'rsync' => vv_rsync_status(),
|
|
'thresholds' => vv_disk_thresholds(),
|
|
'vms' => vv_get_vms(),
|
|
'docker_folders' => vv_get_docker_folders(),
|
|
'remote_hosts' => vv_remote_hosts_stats(),
|
|
'_api_status' => vv_api_get_status(),
|
|
'ts' => time(),
|
|
]);
|