Added php files for nagios monitoring

This commit is contained in:
2026-02-12 22:44:33 +00:00
parent ecaf54e2fb
commit 573421700d
6 changed files with 263 additions and 64 deletions

31
check_content.php Normal file
View File

@@ -0,0 +1,31 @@
#!/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);