← Retour
<?php
// Status Page - Check services depuis O2switch (monitoring externe)
// URL: https://status.nowhere84.com/
header("Content-Type: application/json");
header("Access-Control-Allow-Origin: *");
header("Cache-Control: no-cache, must-revalidate");
// Services via reverse proxy nginx (domaines publics)
$services = [
"nginx" => ["url" => "https://dashboard.33800.nowhere84.com/", "name" => "Dashboard"],
"grafana" => ["url" => "https://grafana.33800.nowhere84.com/", "name" => "Grafana"],
"gitlab" => ["url" => "https://gitlab.33800.nowhere84.com/", "name" => "GitLab"],
"ntfy" => ["url" => "https://ntfy.33800.nowhere84.com/", "name" => "Notifications"],
"portainer" => ["url" => "https://portainer.33800.nowhere84.com/", "name" => "Portainer"],
"pihole" => ["url" => "https://pihole.33800.nowhere84.com/admin/", "name" => "Pi-hole"]
];
$results = [];
$all_up = true;
foreach ($services as $id => $svc) {
$start = microtime(true);
$ch = curl_init($svc["url"]);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_NOBODY => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_FOLLOWLOCATION => true
]);
curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$latency = round((microtime(true) - $start) * 1000);
curl_close($ch);
$up = $code >= 200 && $code < 500;
if (!$up) $all_up = false;
$results[$id] = [
"name" => $svc["name"],
"status" => $up ? "up" : "down",
"code" => $code,
"latency_ms" => $latency
];
}
echo json_encode([
"timestamp" => date("c"),
"overall" => $all_up ? "operational" : "degraded",
"checked_from" => "o2switch",
"services" => $results
], JSON_PRETTY_PRINT);