0 ) {
return join("
", $pcu['complete_entry']);
} else {
return " ";
}
}
function format_ports($pcu)
{
$str = "";
#print print_r(is_array($pcu)) . "
";
#print print_r(array_key_exists('portstatus', $pcu)) . "
";
if ( is_array($pcu) && array_key_exists('portstatus', $pcu) && count(array_keys($pcu['portstatus'])) > 0 )
{
$portstat = $pcu['portstatus'];
#foreach ( array('22', '23', '80', '443') $portstat as $port => $state)
foreach ( array('22', '23', '80', '443', '9100', '16992') as $port)
{
$state = $portstat[$port];
switch ($state)
{
case "open":
$color = "lightgreen";
break;
case "filtered":
$color = "gold";
break;
case "closed":
$color = "indianred";
break;
default:
$color = "white";
break;
}
$str .= "$port ";
# . ": " . $state . "
";
}
} else {
# print print_r(is_array($pcu)) . "
";
# print print_r(array_key_exists('portstatus', $pcu)) . "
";
#echo "
";
#print_r($pcu['portstatus']);
#echo "
";
}
if ( $str == "" )
{
$str = "Closed/Filtered";
}
return $str;
}
function DNS_to_color($dns)
{
switch ($dns)
{
case "DNS-OK":
return 'lightgreen';
case "NOHOSTNAME":
return 'white';
case "DNS-MISMATCH":
return 'gold';
case "NO-DNS-OR-IP":
case "DNS-NOENTRY":
return 'indianred';
}
return 'white';
}
function reboot_to_str($reboot)
{
$ret = $reboot;
switch ($reboot)
{
case "0":
$ret = "OK";
break;
default:
break;
}
return $ret;
}
function reboot_to_color($reboot)
{
switch ($reboot)
{
case "0":
return "darkseagreen";
break;
case "NetDown":
return "lightgrey";
break;
case "Not_Run":
return "lightgrey";
break;
case "Unsupported_PCU":
return "indianred";
break;
default:
if ( strpos($reboot, "error") >= 0)
{
return "indianred";
} else {
return 'white';
}
break;
}
return "white";
}
function get_pcuid($pcu) { return $pcu['pcu_id']; }
function get_dns($pcu) { return $pcu['dnsmatch']; }
function get_dryrun($pcu) { return $pcu['reboot']; }
function get_model($pcu) { return $pcu['model']; }
function get_category_link($category,$header)
{
return "$header";
}
include 'database.php';
$p = new Pickle();
$findbad = $p->load("findbadpcus");
$findbadpcus = array_keys($findbad['nodes']);
$pculist = array();
$c = 0;
foreach ( $findbadpcus as $pcu_id )
{
if ( is_array($findbad['nodes'][$pcu_id]) )
{
#if ( in_array('values', $findbad['nodes'][$pcu]) )
#{
# echo $pcu . " true
";
#} else{
# echo $pcu . " false
";
#}
if ( array_key_exists('values', $findbad['nodes'][$pcu_id]) )
{
$pculist[] = $findbad['nodes'][$pcu_id]['values'];
}
}
}
$total = count($pculist);
if ( $_GET['category'] )
{
$category = $_GET['category'];
if ( $category == "node_ids" )
{
$newfunc = create_function('$pcu', 'return count($pcu[\'' . $category . '\']);');
} else if ( $category == "login_base" )
{
$newfunc = create_function('$pcu', 'return $pcu[\'plcsite\'][\'' . $category . '\'];');
} else {
$newfunc = create_function('$pcu', 'return $pcu[\'' . $category . '\'];');
}
if ( $newfunc != "" )
{
$fields = array_map($newfunc, $pculist);
array_multisort($fields, SORT_ASC, SORT_STRING, $pculist);
} else {
echo "ERROR create_function == null
";
}
}
if ( $_REQUEST['id'] )
{
$id = $_REQUEST['id'];
} else{
$id = "all";
}
#print print_r($_SERVER) . "
";
//array_multisort($protocols, SORT_ASC, SORT_STRING, $pculist);
?>
PLC PCU Info
Total PCUs : = $total ?>
Count |
= get_category_link("pcu_id", "PCU ID") ?> |
= get_category_link("login_base", "Site") ?> |
= get_category_link("hostname", "PCU Name") ?> |
= get_category_link("complete_entry", "Incomplete Fields") ?> |
= get_category_link("dnsmatch", "DNS Status") ?> |
= get_category_link("portstatus", "Port Status") ?> |
= get_category_link("reboot", "Test Results") ?> |
= get_category_link("model", "Model") ?> |
= get_category_link("node_ids", "Nodes") ?> |
= $count ?> |
'>= $pcu['pcu_id'] ?> |
= pcu_site($pcu) ?> |
= pcu_name($pcu) ?> |
= pcu_entry($pcu) ?> |
'>= $pcu['dnsmatch'] ?> |
= format_ports($pcu) ?> |
'>= reboot_to_str($pcu['reboot']) ?> |
= $pcu['model'] ?> |
= count( $pcu['node_ids'] ) ?> |
Reachable Nodes: = $reachable_nodes ?>
= get_category_link("pcu_id", "PCU ID") ?> |
= get_category_link("login_base", "Site") ?> |
= get_category_link("hostname", "PCU Name") ?> |
= get_category_link("complete_entry", "Incomplete Fields") ?> |
= get_category_link("dnsmatch", "DNS Status") ?> |
= get_category_link("portstatus", "Port Status") ?> |
= get_category_link("reboot", "Test Results") ?> |
= get_category_link("model", "Model") ?> |
= get_category_link("node_ids", "Nodes") ?> |
'>= $pcu['pcu_id'] ?> |
= pcu_site($pcu) ?> |
= pcu_name($pcu) ?> |
= pcu_entry($pcu) ?> |
'>= $pcu['dnsmatch'] ?> |
= format_ports($pcu) ?> |
'>= reboot_to_str($pcu['reboot']) ?> |
= $pcu['model'] ?> |
= count( $pcu['node_ids'] ) ?> |
Legend for 'DNS Status' |
DNS-OK |
This indicates that the DNS name and registered IP address match. |
DNS-MISMATCH |
Sometimes, the registered IP and DNS IP address do not match. In these cases it is not clear which is correct,
so an error is flagged. |
DNS-NOENTRY |
While a hostname is provided in the registration, the hostname is not actually registered in DNS. |
NOHOSTNAME |
While we prefer that a hostname be registered, it is not
strictly required, since simply the IP address, if it is static, is enough to access the PCU. |
Legend for 'Port Status' |
Open |
Green port numbers are believed to be open. |
Filtered |
Gold port numbers are believed to be filtered or simply offline. |
Closed |
Finally, red ports appear to be closed. |
Legend for 'Test Results' |
OK |
The PCU is accessible, and short of actually rebooting the node, everything appears to work. |
NetDown |
The PCU is inaccessible from the PlanetLab address block 128.112.139.0/25, or it is simply offline. |
Not_Run |
Previous errors, such as DNS or an incomplete configuration prevented the actual test from begin performed. |
Other Errors |
Other errors are reported by the test that are more specific to the block encountered by the script. |