Offline Services
- = htmlspecialchars($name) ?>
Under Maintenance
- = htmlspecialchars($name) ?>
Upcoming SSL Expiry
- = htmlspecialchars($cert['name']) ?> - = $cert['days'] ?> days remaining
[ 'header' => "Authorization: Basic " . base64_encode("user:$apiToken") . "\r\n", 'method' => 'GET', 'timeout' => 5 ] ]; $context = stream_context_create($options); // Require the new functions.php for PHP logic. require_once __DIR__ . '/src/functions.php'; // Handle AJAX request if (isset($_GET['fetch']) && $_GET['fetch'] === 'metrics') { header('Content-Type: application/json'); echo json_encode(fetchMetrics($metricsUrl, $context)); exit; } // --- AJAX handler for alerts --- if (isset($_GET['fetch']) && $_GET['fetch'] === 'alerts') { header('Content-Type: application/json'); echo json_encode(fetchGrafanaAlerts($grafanaUrl, $grafanaApiKey)); exit; } // --- AJAX handler for holiday info --- if (isset($_GET['fetch']) && $_GET['fetch'] === 'holiday') { header('Content-Type: application/json'); $date = isset($_GET['date']) ? $_GET['date'] : date('Y-m-d'); $holiday = getIndonesianHoliday($date); echo json_encode(['holiday' => $holiday]); exit; } // --- AJAX handler for tasks --- if (isset($_GET['fetch']) && $_GET['fetch'] === 'tasks') { header('Content-Type: application/json'); echo json_encode(fetchTasks($taskApiUrl, $useMockTaskApi, $mockTaskFile)); exit; } // Initial data load $todayHoliday = getIndonesianHoliday(date('Y-m-d')); $data = fetchMetrics($metricsUrl, $context); if ($data['error']) { http_response_code(500); die($data['message']); } // Extract data $up = $data['up']; $down = $data['down']; $pending = $data['pending']; $maintenance = $data['maintenance']; $downMonitors = $data['downMonitors']; $mtMonitors = $data['mtMonitors']; $expiringCerts = $data['expiringCerts']; // <-- Add this line to make $expiringCerts available for the template $lastRefresh = $data['lastRefresh']; ?>