function vdt($dt) { global $ago; if ($ago) { return dtago($dt); } return nicedt($dt); }
$r = $NATS->DB->Query($q); while ($row = $NATS->DB->Fetch_Array($r)) { echo "<tr><td>"; echo "<b class=\"al" . $row['alertlevel'] . "\">"; if ($row['testname'] == "") { echo $row['testdesc']; } else { echo $row['testname']; } echo "</b>"; echo "</td>"; echo "<td> <a href=nodeside.edit.php?nstestid=" . $row['nstestid'] . ">"; echo "<img src=images/options/application.png border=0 title=\"" . $NATS->Lang->Item("edit.options") . "\"></a> "; echo "<a href=nodeside.edit.php?action=disable&nstestid=" . $row['nstestid'] . "&nodeid=" . $_REQUEST['nodeid'] . ">"; echo "<img src=images/options/action_delete.png border=0 title=\"" . $NATS->Lang->Item("delete") . "\"></a>"; echo " <i>" . $NATS->Lang->Item("last.tested") . ": " . dtago($row['lastrunx']) . "</i>"; echo "</td></tr>"; } $NATS->DB->Free($r); } echo "<form action=localtest.action.php method=post><input type=hidden name=action value=create>"; echo "<input type=hidden name=nodeid value=\"" . $_REQUEST['nodeid'] . "\">\n"; echo "<tr><td colspan=2> <br></td></tr>"; echo "<tr><td><b>" . $NATS->Lang->Item("add.test") . " :</b></td>"; echo "<td><select name=testtype>"; echo "<option value=wtime>" . $NATS->Lang->Item("web.time") . "</option>"; echo "<option value=wsize>" . $NATS->Lang->Item("web.size") . "</option><option value=ping>" . $NATS->Lang->Item("remote.ping") . "</option>"; echo "<option value=host>" . $NATS->Lang->Item("dns.host") . "</option>"; // New Test Manager List foreach ($NATS->Tests->QuickList as $key => $val) { echo "<option value=" . $key . ">" . $val . "</option>";
echo "<tr><td align=right>" . $NATS->Lang->Item("recorded") . " :</td>"; echo "<td align=left>"; echo "<input type=checkbox name=testrecord value=1" . $s . "> " . hlink("Test:Recorded"); echo "</td></tr>"; if ($row['simpleeval'] == 1) { $s = " checked"; } else { $s = ""; } echo "<tr><td align=right>" . $NATS->Lang->Item("simple.eval") . " :</td>"; echo "<td align=left>"; echo "<input type=checkbox name=simpleeval value=1" . $s . "> " . hlink("Test:SimpleEvaluation"); echo "</td></tr>"; echo "<tr><td colspan=2><hr class=\"nspacer\"></td></tr>"; echo "<tr><td align=right>" . $NATS->Lang->Item("last.checked") . " :</td>"; echo "<td align=left>" . nicedt($row['lastrunx']) . " - " . dtago($row['lastrunx']) . "</td></tr>"; echo "<tr><td align=right>" . $NATS->Lang->Item("last.result") . " :</td>"; echo "<td align=left>"; echo "<b class=\"al" . $row['alertlevel'] . "\">"; echo oText($row['alertlevel']); echo "</b>"; echo "</td></tr>"; echo "<tr><td align=right>" . $NATS->Lang->Item("last.value") . " :</td>"; echo "<td align=left>" . $row['lastvalue'] . "</td></tr>"; echo "<tr><td colspan=2><hr class=\"nspacer\"></td></tr>"; echo "<tr><td> </td><td align=left><input type=submit value=\"" . $NATS->Lang->Item("save.changes") . "\"> "; echo "<a href=node.edit.php?nodeid=" . $row['nodeid'] . ">" . $NATS->Lang->Item("abandon.changes") . "</a>"; echo "</td></tr></form>"; echo "</table>"; End_Round(); echo "<br><br>";
echo "<br><br>"; if ($node['nsenabled'] == 1) { echo "<b class=\"subtitle\">" . $NATS->Lang->Item("nodeside.tests") . "</b><br><br>"; echo "<table class=\"nicetable\">"; $q = "SELECT * FROM fnnstest WHERE nodeid=\"" . ss($_REQUEST['nodeid']) . "\" AND testenabled=1 ORDER BY testtype"; $r = $NATS->DB->Query($q); while ($row = $NATS->DB->Fetch_Array($r)) { echo "<tr><td>"; if ($row['testname'] == "") { echo $row['testdesc']; } else { echo $row['testname']; } echo "</td>"; echo "<td><b class=\"al" . $row['alertlevel'] . "\">" . oText($row['alertlevel']) . "</b></td>"; echo "<td>(" . dtago($row['lastrunx']) . ")</td>"; echo "<td>"; if ($row['testrecord'] == 1) { echo "[ <a href=\"history.test.php?testid=N" . $row['nstestid'] . "\">" . $NATS->Lang->Item("history") . "</a> ]"; } else { echo " "; } echo "</td>"; echo "</tr>"; } echo "</table>"; } ?> <?php
while ($row=$NATS->DB->Fetch_Array($r)) { echo "<tr><td>"; echo "<b class=\"al".$row['alertlevel']."\">"; if ($row['testname']=="") echo $row['testdesc']; else echo $row['testname']; echo "</b>"; echo "</td>"; echo "<td> <a href=nodeside.edit.php?nstestid=".$row['nstestid'].">"; echo "<img src=images/options/application.png border=0 title=\"Edit Test Options\"></a> "; echo "<a href=nodeside.edit.php?action=disable&nstestid=".$row['nstestid']."&nodeid=".$_REQUEST['nodeid'].">"; echo "<img src=images/options/action_delete.png border=0 title=\"Delete Test\"></a>"; echo " <i>Last Tested: ".dtago($row['lastrunx'])."</i>"; echo "</td></tr>"; } $NATS->DB->Free($r); } echo "<form action=localtest.action.php method=post><input type=hidden name=action value=create>"; echo "<input type=hidden name=nodeid value=\"".$_REQUEST['nodeid']."\">\n"; echo "<tr><td colspan=2> <br></td></tr>"; echo "<tr><td><b>Add Test :</b></td>"; echo "<td><select name=testtype>"; echo "<option value=wtime>Web Time</option>"; //echo "<option value=tcp>TCP Port</option>"; echo "<option value=wsize>Web Size</option><option value=ping>Remote Ping</option>"; //echo "<option value=imap>IMAP Connection</option><option value=smtp>SMTP Connection</option>"; //echo "<option value=mysql>MySQL Connect Time</option><option value=mysqlrows>MySQL Row Count</option>";
function edtago($ts) { echo dtago($ts); }
function GetTest($testid, $protect = false) { if ($testid == "") { return false; } $class = $testid[0]; if (is_numeric($class)) { // test ID will stay the same $class = "L"; $anytestid = $testid; } else { //$testid=substr($testid,1); // as it will here also so direct use to graphs can be made $anytestid = substr($testid, 1); // the classless version } $q = ""; switch ($class) { case "L": // local tests $q = "SELECT * FROM fnlocaltest WHERE localtestid=" . ss($anytestid) . " LIMIT 0,1"; break; case "N": // node-side test $q = "SELECT * FROM fnnstest WHERE nstestid=" . ss($anytestid) . " LIMIT 0,1"; break; default: return false; // can't lookup this class } if ($q == "") { return false; } $r = $this->DB->Query($q); if (!($row = $this->DB->Fetch_Array($r))) { return false; } $row['class'] = $class; $row['testid'] = $testid; $row['anytestid'] = $anytestid; $row['alerttext'] = oText($row['alertlevel']); $row['lastrundt'] = nicedt($row['lastrunx']); $row['lastrunago'] = dtago($row['lastrunx'], false); if ($row['testname'] != "") { $row['name'] = $row['testname']; } else { if ($class == "L") { $row['name'] = lText($row['testtype']); // TODO OTHER TESTS if ($row['testparam'] != "") { $row['name'] .= " (" . $row['testparam'] . ")"; } } else { if ($class == "N") { if ($row['testdesc'] != "") { $row['name'] = $row['testdesc']; } else { $row['name'] = $row['testtype']; } } } } if ($protect && $class == "L") { if ($this->Tests->Exists($row['testtype'])) { $this->Tests->Tests[$row['testtype']]->Create(); $this->Tests->Tests[$row['testtype']]->instance->ProtectOutput($row); } } $this->DB->Free($r); return $row; }
$q="SELECT * FROM fntestrun WHERE finishx=0"; $r=$NATS->DB->Query($q); echo "<b>".$NATS->DB->Num_Rows($r)." Open/Running Test Sessions</b><br><br>"; if ($NATS->DB->Num_Rows($r)>0) { echo "<table class=\"nicetable\">"; echo "<tr><td><b>ID</b></td><td><b>Node</b></td><td><b>Started</b></td><td><b>Notes</b></td></tr>"; $nowx=time(); $fifteenx=$nowx-(15*60); $hourx=$nowx-(60*60); while ($row=$NATS->DB->Fetch_Array($r)) { echo "<tr><td><a href=testrun.php?trid=".$row['trid'].">"; echo $row['trid']."</a></td>"; echo "<td><a href=node.php?nodeid=".$row['fnode']."</a></td>"; echo "<td>".nicedt($row['startx'])." - ".dtago($row['startx'])."</td>"; echo "<td>"; if ($row['startx']<$hourx) echo "Error: Over an hour old"; else if($row['startx']<$fifteenx) echo "Warning: Over fifteen minutes old"; else echo " "; echo "</td></tr>"; } echo "</table>"; } $NATS->DB->Free($r); echo "<br><br>"; echo "<b class=\"subtitle\">Environment: PHP Web (Apache Module/PHP-CGI)</b><br><br>"; $env_test_web=1; include("environment.test.php"); echo "<br>";
echo "</td></tr>"; echo "<tr><td colspan=2><hr class=\"nspacer\"></td></tr>"; echo "<tr><td>" . $NATS->Lang->Item("test.interval") . ":</td>"; echo "<td><input type=text size=3 name=testinterval maxlength=8 value=\"" . $row['testinterval'] . "\"> " . $NATS->Lang->Item("minutes") . " " . hlink("Test:Interval"); echo "</td></tr>"; echo "<input type=hidden name=original_testinterval value=\"" . $row['testinterval'] . "\">"; echo "<tr><td valign=top>" . $NATS->Lang->Item("test.due") . ":</td>"; echo "<td>"; if ($row['nextrunx'] > 0) { echo nicedt($row['nextrunx']) . " - " . nicenextx($row['nextrunx']); } else { echo $NATS->Lang->Item("now"); } echo "</td></tr>"; echo "<tr><td valign=top>" . $NATS->Lang->Item("last.tested") . ":</td>"; echo "<td>" . nicedt($row['lastrunx']) . " - " . dtago($row['lastrunx']) . "<br>"; echo "<a href=localtest.action.php?localtestid=" . $_REQUEST['localtestid'] . "&action=invalidate>" . $NATS->Lang->Item("check.asap") . "</a>"; echo "</td></tr>"; echo "<tr><td colspan=2><hr class=\"nspacer\"></td></tr>"; echo "<tr><td>" . $NATS->Lang->Item("custom.attempts") . ":</td>"; echo "<td><input type=text size=3 name=attempts maxlength=2 value=\"" . $row['attempts'] . "\"> " . hlink("Test:Attempts"); echo "</td></tr>"; echo "<tr><td>" . $NATS->Lang->Item("custom.timeout") . ":</td>"; echo "<td><input type=text name=timeout size=3 maxlength=3 value=\"" . $row['timeout'] . "\"> " . $NATS->Lang->Item("seconds") . " " . hlink("Test:Timeout"); echo "</td></tr>"; echo "<tr><td colspan=2><hr class=\"nspacer\"></td></tr>"; echo "<tr><td> </td><td><input type=submit value=\"" . $NATS->Lang->Item("test.save") . "\"> "; echo "<a href=node.edit.php?nodeid=" . $row['nodeid'] . ">" . $NATS->Lang->Item("abandon.changes") . "</a>"; echo "</td></tr></form>"; echo "</table>"; End_Round();
$q="SELECT * FROM fntestrun WHERE trid=".ss($_REQUEST['trid'])." LIMIT 0,1"; $r=$NATS->DB->Query($q); if (!$row=$NATS->DB->Fetch_Array($r)) { echo "<b>Error fetching test run data</b><br><br>"; Screen_Footer(); exit(); } $NATS->DB->Free($r); echo "<table border=0>"; echo "<tr><td>Started : </td>"; echo "<td>".nicedt($row['startx'])." (".dtago($row['startx']).")</td></tr>"; echo "<tr><td>Finished : </td>"; echo "<td>"; if ($row['finishx']>0) echo nicedt($row['finishx'])." (".dtago($row['finishx']).")"; else echo "Still Running (<a href=testrun.php?trid=".$_REQUEST['trid']."&action=finish>Manually Mark Finished</a>)"; echo "</td>"; echo "<tr><td>Node Filter :</td>"; echo "<td>"; if ($row['fnode']=="") echo "All Nodes"; else echo "<a href=node.php?nodeid=".$row['fnode'].">".$row['fnode']."</a>"; echo "</td></tr>"; echo "<tr><td>Sysem Log :</td>"; echo "<td><a href=log.php?f_entry=Tester+".$row['trid'].">Log Events for Tester ".$row['trid']."</a>"; echo "</td></tr>"; echo "<tr><td align=left valign=top>Output : </td>"; echo "<td align=left valign=top>"; echo $row['routput'];
$idwid = $iend - $istart; $iscale = $idwid / $periods; echo "<b>" . $tname . "</b>"; if ($usesubname) { echo "<b> - " . $subtname . "</b>"; } echo "<b> on " . $tnode . "</b>"; echo "<br>"; //echo "<i>node "; //echo "<a href=node.php?nodeid=".$tnode.">".$tnode."</a>"; //echo " - "; echo "<i>"; echo "Last Run : "; if ($tlastrunx > 0) { echo nicedt($tlastrunx) . " - "; echo dtago($tlastrunx); } else { echo "Never"; } echo "</i><br>"; //echo "<b>".$tname." from ".nicedt($startx)." to ".nicedt($finishx); //if ($tunit!="") echo " (".$tunit.")"; // echo " (".nicediff($finishx-$startx).")"; //echo "</b><br><br>"; // table data $q = "SELECT alertlevel,testvalue,recordx FROM fnrecord WHERE "; $q .= "testid=\"" . ss($testid) . "\" AND recordx>=" . ss($startx) . " AND recordx<=" . ss($finishx); //if (!isset($_REQUEST['disp_pass'])) $q.=" AND alertlevel!=0"; $q .= " ORDER BY recordx ASC"; $firstx = 0; $lastx = 0;