i am making a site that needs to give a list of the differtent status for different services the status
comes from a database that get a new row every 5 min.
The following script gets the information
from this table and another one it needs to see wich services to check the problem is that it takes 19 sec to load
and i really need to cut this time down.
any good on how to do this
Code: Select all
<?php
$rs = $db->Execute("SELECT b.servernaam, a.displaynaam, a.servicenaam, b.status, b.lastcheck
FROM dbo.*****_log_Services a LEFT OUTER JOIN
*****_services_status b ON a.computernaam = b.servernaam AND a.servicenaam = b.servicenaam LEFT OUTER JOIN
*****_services_status c ON b.servernaam = c.servernaam AND b.servicenaam = c.servicenaam AND b.lastcheck < c.lastcheck
WHERE (a.controleren = 1) AND (c.lastcheck IS NULL)");
// Kop tekstblok
header("Refresh: 300;");
head("Status van de services","m");
// XHTML
echo ('<table>
<tr>
<th>Status</th>
<th>ServerName</th>
<th>Displaynaam</th>
<th>Servicenaam</th>
<th>LastCheck</th>
</tr>');
// LUS
while (!$rs->EOF) {
// ZET RECORD IN EEN ARRAY
$a_Row = $rs->fields;
// ============= \\
// PING COMPUTER \\
// ============= \\
// VARIABELEN OPSLAAN
$s_ServerName = $a_Row['servernaam'];
$s_Displaynaam = $a_Row['displaynaam'];
$s_service = $a_Row['servicenaam'];
$s_Status = $a_Row['status'];
$s_LastCheck = $a_Row['lastcheck'];
// VARIABLE ADODB OMZETTEN NAAR EEN STRING
settype($s_ServerName, "string");
settype($s_Displaynaam, "string");
settype($s_service, "string");
settype($s_Status, "string");
settype($s_LastCheck, "string");
echo "\n <tr>";
if ($s_Status == "")
{
echo "\n <td class=\"pijl\"><img src=\"skin/".$s_MenuSkin."/No_Status_Available.gif\" title=\"No Status Available\" /></td>";
}
else
{
echo "\n <td class=\"pijl\"><img src=\"skin/".$s_MenuSkin."/".$s_Status.".gif\" title=\"".$s_Status."\" /></td>";
}
echo('
<td>'.$s_ServerName.' </td>
<td>'.$s_Displaynaam.'</td>
<td>'.$s_service.' </td>
<td>'.$s_LastCheck.' </td>
</tr>
');
// Ga naar volgend record
$rs->MoveNext();
}
// XHTML
echo "\n</table>";
$rs = $db->Execute("SELECT computernaam FROM *****_computers WHERE (computernaam LIKE 'sr0%') OR (computernaam LIKE 'dc0%')");
echo ('<form action=index.php?pagename=servicestatussort method="POST">
<table>
<tr>
<th>
<td>
<select name="servernaam">
<option value= "0" selected> Kies server:
');
while (!$rs->EOF)
{
$value = $rs->Fields['computernaam']->value;
echo "<option value=$value>$value";
$rs->movenext();
}
echo ('</select></td></th>
</table>
<input type=submit value=submit>
</form>');
foot();
?>the ***** are the name of the db and company i work for