2007-04-03 14:10:23 +00:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
include("config.php");
|
|
|
|
include("includes/functions.php");
|
|
|
|
|
2007-04-11 19:24:47 +00:00
|
|
|
$sql = "SELECT * FROM devices AS D, services AS S WHERE D.status = '1' AND S.service_host = D.device_id ORDER by D.device_id DESC";
|
2007-04-03 14:10:23 +00:00
|
|
|
$query = mysql_query($sql);
|
|
|
|
while ($service = mysql_fetch_array($query)) {
|
|
|
|
|
|
|
|
unset($check, $service_status, $time, $status);
|
|
|
|
|
|
|
|
$service_status = $service['service_status'];
|
|
|
|
|
|
|
|
$service_type = strtolower($service[service_type]);
|
|
|
|
|
|
|
|
$service_param = $service['service_param'];
|
|
|
|
|
|
|
|
$checker_script = "includes/services/" . $service_type . "/check.inc";
|
|
|
|
|
|
|
|
if(is_file($checker_script)) {
|
|
|
|
include($checker_script);
|
|
|
|
} else {
|
|
|
|
$status = "2";
|
|
|
|
$check = "Error : Script not found ($checker_script)";
|
|
|
|
}
|
|
|
|
if($service_status != $status) { $updated = ", `service_changed` = '" . time() . "' "; } else { unset($updated); }
|
|
|
|
mysql_query("UPDATE `services` SET `service_status` = '$status', `service_message` = '$check', `service_checked` = '" . time() . "' $updated WHERE `service_id` = '$service[service_id]'");
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|