3 function plc_site_link($site_name)
5 return "https://" . MONITOR_HOSTNAME . "/db/sites/index.php?site_pattern=" . $site_name;
8 function pcu_link($pcu)
10 return "https://" . MONITOR_HOSTNAME . "/db/sites/pcu.php?id=" . $pcu['pcu_id'];
13 function pcu_site($pcu)
15 if ( array_key_exists('plcsite', $pcu) ):
16 return $pcu['plcsite']['login_base'];
22 function pcu_name($pcu)
24 if ( $pcu['hostname'] != NULL and $pcu['hostname'] != "" ):
25 return $pcu['hostname'];
30 function pcu_entry($pcu)
32 if ( count($pcu['complete_entry']) > 0 ) {
33 return join("<BR>", $pcu['complete_entry']);
39 function format_ports($pcu)
42 #print print_r(is_array($pcu)) . "<BR>";
43 #print print_r(array_key_exists('portstatus', $pcu)) . "<BR>";
44 if ( is_array($pcu) && array_key_exists('portstatus', $pcu) && count(array_keys($pcu['portstatus'])) > 0 )
46 $portstat = $pcu['portstatus'];
48 #foreach ( array('22', '23', '80', '443') $portstat as $port => $state)
49 foreach ( array('22', '23', '80', '443', '9100', '16992') as $port)
51 $state = $portstat[$port];
55 $color = "lightgreen";
67 $str .= "<span style='background-color: $color'>$port</span> ";
68 # . ": " . $state . "<br>";
71 # print print_r(is_array($pcu)) . "<BR>";
72 # print print_r(array_key_exists('portstatus', $pcu)) . "<BR>";
74 #print_r($pcu['portstatus']);
79 $str = "Closed/Filtered";
83 function DNS_to_color($dns)
99 function reboot_to_str($reboot)
113 function reboot_to_color($reboot)
118 return "darkseagreen";
126 case "Unsupported_PCU":
130 if ( strpos($reboot, "error") >= 0)
141 function get_pcuid($pcu) { return $pcu['pcu_id']; }
142 function get_dns($pcu) { return $pcu['dnsmatch']; }
143 function get_dryrun($pcu) { return $pcu['reboot']; }
144 function get_model($pcu) { return $pcu['model']; }
145 function get_category_link($category,$header)
147 return "<a href='printbadpcus.php?category=$category'>$header</a>";
150 include 'database.php';
152 $findbad = $p->load("findbadpcus");
153 $findbadpcus = array_keys($findbad['nodes']);
157 foreach ( $findbadpcus as $pcu_id )
159 if ( is_array($findbad['nodes'][$pcu_id]) )
161 #if ( in_array('values', $findbad['nodes'][$pcu]) )
163 # echo $pcu . " true<BR>";
165 # echo $pcu . " false<br>";
167 if ( array_key_exists('values', $findbad['nodes'][$pcu_id]) )
169 $pculist[] = $findbad['nodes'][$pcu_id]['values'];
173 $total = count($pculist);
177 if ( $_GET['category'] )
179 $category = $_GET['category'];
180 if ( $category == "node_ids" )
182 $newfunc = create_function('$pcu', 'return count($pcu[\'' . $category . '\']);');
183 } else if ( $category == "login_base" )
185 $newfunc = create_function('$pcu', 'return $pcu[\'plcsite\'][\'' . $category . '\'];');
187 $newfunc = create_function('$pcu', 'return $pcu[\'' . $category . '\'];');
189 if ( $newfunc != "" )
191 $fields = array_map($newfunc, $pculist);
192 array_multisort($fields, SORT_ASC, SORT_STRING, $pculist);
194 echo "ERROR create_function == null<BR>";
198 if ( $_REQUEST['id'] )
200 $id = $_REQUEST['id'];
204 #print print_r($_SERVER) . "<BR>";
206 //array_multisort($protocols, SORT_ASC, SORT_STRING, $pculist);
209 <title>PLC PCU Info</title>
213 <?php if ( $id == "all" ): ?>
214 Total PCUs : <?= $total ?>
218 <th><?= get_category_link("pcu_id", "PCU ID") ?></th>
219 <th><?= get_category_link("login_base", "Site") ?></th>
220 <th><?= get_category_link("hostname", "PCU Name") ?></th>
221 <th><?= get_category_link("complete_entry", "Incomplete Fields") ?></th>
222 <th><?= get_category_link("dnsmatch", "DNS Status") ?></th>
223 <th><?= get_category_link("portstatus", "Port Status") ?></th>
224 <th><?= get_category_link("reboot", "Test Results") ?></th>
225 <th><?= get_category_link("model", "Model") ?></th>
226 <th><?= get_category_link("node_ids", "Nodes") ?></th>
229 <?php $reachable_nodes = 0; ?>
230 <?php foreach ( $pculist as $pcu ): ?>
232 <td><?= $count ?></td>
233 <td id='id<?= $pcu['pcu_id'] ?>'><a href='<?= pcu_link($pcu) ?>'><?= $pcu['pcu_id'] ?></a></td>
234 <td><a href='<?= plc_site_link(pcu_site($pcu)) ?>'><?= pcu_site($pcu) ?></a></td>
235 <td><?= pcu_name($pcu) ?></td>
236 <td><?= pcu_entry($pcu) ?></td>
237 <td bgcolor='<?= DNS_to_color($pcu['dnsmatch']) ?>'><?= $pcu['dnsmatch'] ?></td>
238 <td><?= format_ports($pcu) ?></td>
239 <td bgcolor='<?= reboot_to_color($pcu['reboot']) ?>'><?= reboot_to_str($pcu['reboot']) ?></td>
240 <td nowrap><?= $pcu['model'] ?></td>
241 <td><?= count( $pcu['node_ids'] ) ?></td>
244 <?php if ( $pcu['reboot'] == "0" ) $reachable_nodes+=count($pcu['node_ids']); ?>
245 <?php $count += 1; ?>
248 <b>Reachable Nodes:</b> <?= $reachable_nodes ?>
250 <table align=center border=1>
252 <th><?= get_category_link("pcu_id", "PCU ID") ?></th>
253 <th><?= get_category_link("login_base", "Site") ?></th>
254 <th><?= get_category_link("hostname", "PCU Name") ?></th>
255 <th><?= get_category_link("complete_entry", "Incomplete Fields") ?></th>
256 <th><?= get_category_link("dnsmatch", "DNS Status") ?></th>
257 <th><?= get_category_link("portstatus", "Port Status") ?></th>
258 <th><?= get_category_link("reboot", "Test Results") ?></th>
259 <th><?= get_category_link("model", "Model") ?></th>
260 <th><?= get_category_link("node_ids", "Nodes") ?></th>
263 <?php $reachable_nodes = 0; ?>
264 <?php foreach ( $pculist as $pcu ): ?>
265 <?php if ( $pcu['pcu_id'] == $id ): ?>
267 <td id='id<?= $pcu['pcu_id'] ?>'><a href='<?= pcu_link($pcu) ?>'><?= $pcu['pcu_id'] ?></a></td>
268 <td><a href='<?= plc_site_link(pcu_site($pcu)) ?>'><?= pcu_site($pcu) ?></a></td>
269 <td><?= pcu_name($pcu) ?></td>
270 <td><?= pcu_entry($pcu) ?></td>
271 <td bgcolor='<?= DNS_to_color($pcu['dnsmatch']) ?>'><?= $pcu['dnsmatch'] ?></td>
272 <td><?= format_ports($pcu) ?></td>
273 <td bgcolor='<?= reboot_to_color($pcu['reboot']) ?>'><?= reboot_to_str($pcu['reboot']) ?></td>
274 <td nowrap><?= $pcu['model'] ?></td>
275 <td><?= count( $pcu['node_ids'] ) ?></td>
281 <table border=1 align=center>
282 <tr><th colspan=2>Legend for 'DNS Status'</th></tr>
284 <tr><td bgcolor=lightgreen>DNS-OK</td>
285 <td>This indicates that the DNS name and registered IP address match.</td>
287 <tr><td bgcolor=lightgrey>DNS-MISMATCH</td>
288 <td>Sometimes, the registered IP and DNS IP address do not match. In these cases it is not clear which is correct,
289 so an error is flagged.</td>
291 <tr><td bgcolor=lightgrey>DNS-NOENTRY</td>
292 <td>While a hostname is provided in the registration, the hostname is not actually registered in DNS.</td>
294 <tr><td bgcolor=white>NOHOSTNAME</td>
295 <td>While we prefer that a hostname be registered, it is not
296 strictly required, since simply the IP address, if it is static, is enough to access the PCU.</td>
300 <tr><th colspan=2>Legend for 'Port Status'</th></tr>
302 <tr><td bgcolor=lightgreen>Open</td>
303 <td>Green port numbers are believed to be open.</td>
305 <tr><td bgcolor=gold>Filtered</td>
306 <td>Gold port numbers are believed to be filtered or simply offline.</td>
308 <tr><td bgcolor=indianred>Closed</td>
309 <td>Finally, red ports appear to be closed.</td>
313 <tr><th colspan=2>Legend for 'Test Results'</th></tr>
315 <tr><td bgcolor=darkseagreen>OK</td>
316 <td>The PCU is accessible, and short of actually rebooting the node, everything appears to work.</td>
318 <tr><td bgcolor=lightgrey>NetDown</td>
319 <td>The PCU is inaccessible from the PlanetLab address block 128.112.139.0/25, or it is simply offline.</td>
321 <tr><td bgcolor=lightgrey>Not_Run</td>
322 <td>Previous errors, such as DNS or an incomplete configuration prevented the actual test from begin performed.</td>
324 <tr><td bgcolor=indianred>Other Errors</td>
325 <td>Other errors are reported by the test that are more specific to the block encountered by the script.</td>