switch to poller.php away from poll-device.php. increase syslog table read speed a bit by using php-side device info cache

git-svn-id: http://www.observium.org/svn/observer/trunk@1255 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-06-23 19:17:06 +00:00
parent f98cf66756
commit a4b9c5dbcb
4 changed files with 236 additions and 308 deletions

View File

@@ -93,10 +93,14 @@ echo("
");
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog,devices WHERE syslog.device_id = devices.device_id ORDER BY seq DESC LIMIT 20";
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from `syslog` ORDER BY seq DESC LIMIT 20";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); }
while($entry = mysql_fetch_array($query))
{
$entry = array_merge($entry, device_by_id_cache($entry['device_id']));
include("includes/print-syslog.inc");
}
echo("</table>");

View File

@@ -60,11 +60,11 @@ if($_POST['device']) {
}
if($_SESSION['userlevel'] >= '5') {
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog AS S, devices AS D
WHERE S.device_id = D.device_id $where ORDER BY timestamp DESC LIMIT 1000";
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog
WHERE 1 $where ORDER BY timestamp DESC LIMIT 1000";
} else {
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog AS S, devices AS D, devices_perms AS P
WHERE S.device_id = P.device_id AND P.user_id = " . $_SESSION['user_id'] . " AND S.device_id = D.device_id $where ORDER BY timestamp DESC LIMIT 1000";
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog AS S, devices_perms AS P
WHERE S.device_id = P.device_id AND P.user_id = " . $_SESSION['user_id'] . " $where ORDER BY timestamp DESC LIMIT 1000";
}
$query = mysql_query($sql);