Exemplos de Uso
$
<?php
header("Content-Type: application/json");
$
$status = ["status" => "ok", "timestamp" => time()];
$
// Checar banco
try {
$pdo = new PDO("mysql:host=localhost;dbname=teste", "user", "pass");
$status["database"] = "ok";
} catch (Exception $e) {
$status["database"] = "error";
$status["status"] = "degraded";
http_response_code(503);
}
$
// Checar disco
$free = disk_free_space("/");
$status["disk_free_gb"] = round($free/1024/1024/1024, 2);
$
echo json_encode($status);