Files
sld-web-health-check/check_content.php

32 lines
581 B
PHP

#!/usr/bin/php
<?php
$jsonFile = __DIR__ . '/web_check.json';
if (!file_exists($jsonFile)) {
echo "CRITICAL - JSON file not found\n";
exit(2);
}
$data = json_decode(file_get_contents($jsonFile), true);
if (!$data) {
echo "CRITICAL - Invalid JSON\n";
exit(2);
}
$problems = [];
foreach ($data as $site) {
if ($site['wordcheck_ok'] != 1) {
$problems[] = $site['domain'];
}
}
if (!empty($problems)) {
echo "CRITICAL - Content problems on: " . implode(', ', $problems) . "\n";
exit(2);
}
echo "OK - All content checks passed\n";
exit(0);