move poller.php (inc os/system) to db* (and others, but poller is biggest change)

git-svn-id: http://www.observium.org/svn/observer/trunk@2298 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-13 11:42:26 +00:00
parent f355e33b64
commit bc0cdd2415
9 changed files with 45 additions and 41 deletions

View File

@@ -5,8 +5,7 @@ include("includes/defaults.inc.php");
include("config.php");
include("includes/functions.php");
$alert_query = mysql_query("SELECT *, A.id as id FROM `alerts` as A, `devices` as D where A.device_id = D.device_id AND alerted = '0'");
while ($alert = mysql_fetch_assoc($alert_query))
foreach (dbFetchRows("SELECT *, A.id AS id FROM `alerts` AS A, `devices` AS D WHERE A.device_id = D.device_id AND alerted = '0'") as $alert)
{
$id = $alert['id'];
$host = $alert['hostname'];
@@ -14,7 +13,8 @@ while ($alert = mysql_fetch_assoc($alert_query))
$msg = $alert['message'];
$alert_text .= "$date $host $msg";
mysql_query("UPDATE `alerts` SET alerted = '1' WHERE `id` = '$id'");
dbUpdate(array('alerted' => '1'), 'alerts', '`id` = ?' array($id))
}
if ($alert_text)
@@ -23,4 +23,4 @@ if ($alert_text)
# `echo '$alert_text' | gnokii --sendsms <NUMBER>`;
}
?>
?>