Commit 6fc341a8 authored by Leigh Stoller's avatar Leigh Stoller

Convert to using new node_status table.

parent fc56d4d6
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -79,10 +79,11 @@ if ($isadmin || !strcmp($showtype, "widearea")) {
# Suck out info for all the nodes.
#
$query_result =
DBQueryFatal("select n.node_id,n.phys_nodeid,n.type,n.status, ".
DBQueryFatal("select n.node_id,n.phys_nodeid,n.type,ns.status, ".
" n.def_boot_osid,r.pid,r.eid,nt.class,r.vname ".
" from nodes as n ".
"left join node_types as nt on n.type=nt.type ".
"left join node_status as ns on n.node_id=ns.node_id ".
"left join reserved as r on n.node_id=r.node_id ".
"where $role $clause ".
"ORDER BY priority");
......@@ -174,12 +175,18 @@ while ($row = mysql_fetch_array($query_result)) {
echo " <td>$type ($class)</td>\n";
if ($status == "up")
if (!$status)
echo "<td align=center>
<img src='/autostatus-icons/blueball.gif' alt=unk></td>\n";
elseif ($status == "up")
echo "<td align=center>
<img src='/autostatus-icons/greenball.gif' alt=up></td>\n";
else
elseif ($status == "down")
echo "<td align=center>
<img src='/autostatus-icons/redball.gif' alt=down></td>\n";
else
echo "<td align=center>
<img src='/autostatus-icons/yellowball.gif' alt=unk></td>\n";
# Admins get pid/eid/vname, but mere users yes/no.
if ($isadmin) {
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
require("defs.php3");
......@@ -12,15 +12,16 @@ require("defs.php3");
PAGEHEADER("Node Up/Down Status");
$query_result =
DBQueryFatal("SELECT node_id, nodes.type, status FROM nodes ".
"left join node_types on node_types.type=nodes.type ".
"WHERE node_types.class!='shark' and node_types.isvirtnode=0 ".
"ORDER BY nodes.type,priority");
DBQueryFatal("SELECT n.node_id, n.type, ns.status FROM nodes as n ".
"left join node_types as nt on nt.type=n.type ".
"left join node_status as ns on ns.node_id=n.node_id ".
"WHERE nt.class!='shark' and role='testnode'".
"ORDER BY n.type,n.priority");
$num_up = 0;
$num_pd = 0;
$num_down = 0;
$num_unpingable = 0;
$num_unk = 0;
while ($r = mysql_fetch_array($query_result)) {
$status = $r["status"];
......@@ -30,19 +31,18 @@ while ($r = mysql_fetch_array($query_result)) {
$num_up++;
break;
case "possibly down":
case "unpingable":
$num_pd++;
break;
case "down":
$num_down++;
break;
case "unpingable":
$num_unpingable++;
break;
default:
$num_unk++;
break;
}
}
$num_total = ($num_up + $num_unpingable + $num_down + $num_pd);
$num_total = ($num_up + $num_down + $num_pd + $num_unk);
mysql_data_seek($query_result, 0);
?>
......@@ -50,10 +50,10 @@ mysql_data_seek($query_result, 0);
<table>
<tr><td align="right">
<b>Up</b></td><td align="left"><? echo $num_up ?></td></tr>
<tr><td align="right">
<b>Unpingable</b></td><td align="left"><? echo $num_unpingable ?></td></tr>
<tr><td align="right">
<b>Possibly Down</b></td><td align="left"><? echo $num_pd ?></td></tr>
<tr><td align="right">
<b>Unknown</b></td><td align="left"><? echo $num_unk ?></td></tr>
<tr><td align="right"><b>Down</b></td><td align="left">
<?
if ($num_down > 0) {
......@@ -72,20 +72,21 @@ else {
<b>
<?php
# Is there a better way to get 2 digit precision?
printf("%.2f",(($num_up + $num_unpingable)/$num_total) *100);
printf("%.2f",(($num_up)/$num_total) *100);
?>
% up or unpingable</b>
% up </b>
<h3>Key:</h3>
<ul>
<li>
<img src="/autostatus-icons/greenball.gif" alt="up"> - Up<br>
</li><li>
<img src="/autostatus-icons/yellowball.gif" alt="possibly down"> - Possibly down<br>
<img src="/autostatus-icons/yellowball.gif" alt="Possibly Down"> -
Possibly Down<br>
</li><li>
<img src="/autostatus-icons/redball.gif" alt="down"> - Down<br>
</li><li>
<img src="/autostatus-icons/blueball.gif" alt="unpingable"> - Unpingable: Running an operating system that does not respond to pings<br>
<img src="/autostatus-icons/blueball.gif" alt="Unknown"> - Unknown<br>
</li>
</ul>
......@@ -108,7 +109,8 @@ while ($r = mysql_fetch_array($query_result)) {
}
print("<h3>$type</h3>\n");
print("<table class=\"nogrid\" cellspacing=0 border=0 cellpadding=5>\n");
print("<table class=\"nogrid\" ".
"cellspacing=0 border=0 cellpadding=5>\n");
$lasttype = $type;
$column = 0;
......@@ -138,17 +140,15 @@ while ($r = mysql_fetch_array($query_result)) {
case "up":
print("<img src=\"/autostatus-icons/greenball.gif\" alt=\"up\">");
break;
case "unpingable":
case "possibly down":
print("<img src=\"/autostatus-icons/yellowball.gif\" alt=\"possibly down\">");
break;
case "down":
print("<img src=\"/autostatus-icons/redball.gif\" alt=\"down\">");
break;
case "unpingable":
print("<img src=\"/autostatus-icons/blueball.gif\" alt=\"unpingable\">");
break;
default:
print("<b>Unknown</b>");
print("<img src=\"/autostatus-icons/blueball.gif\" alt=\"Unknown\">");
break;
}
print("&nbsp;$node_id</nobr></td>");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment