4 function pcu_link($pcu)
6 return "https://www.planet-lab.org/db/sites/pcu.php?id=" . $pcu['pcu_id'];
9 function pcu_name($pcu)
11 if ( $pcu['hostname'] != NULL and $pcu['hostname'] != "" ):
12 return $pcu['hostname'];
17 function pcu_entry($pcu)
19 if ( count($pcu['complete_entry']) > 0 ) {
20 return join("<BR>", $pcu['complete_entry']);
26 function format_ports($pcu)
29 #print print_r(is_array($pcu)) . "<BR>";
30 #print print_r(array_key_exists('portstatus', $pcu)) . "<BR>";
31 if ( is_array($pcu) && array_key_exists('portstatus', $pcu) && count(array_keys($pcu['portstatus'])) > 0 )
33 $portstat = $pcu['portstatus'];
35 #foreach ( array('22', '23', '80', '443') $portstat as $port => $state)
36 foreach ( array('22', '23', '80', '443') as $port)
38 $state = $portstat[$port];
42 $color = "lightgreen";
54 $str .= "<span style='background-color: $color'>$port</span> ";
55 # . ": " . $state . "<br>";
58 # print print_r(is_array($pcu)) . "<BR>";
59 # print print_r(array_key_exists('portstatus', $pcu)) . "<BR>";
61 #print_r($pcu['portstatus']);
66 $str = "Closed/Filtered";
70 function DNS_to_color($dns)
87 function reboot_to_color($reboot)
92 return "darkseagreen";
100 case "Unsupported_PCU":
104 if ( strpos($reboot, "error") >= 0)
115 function get_pcuid($pcu) { return $pcu['pcu_id']; }
116 function get_dns($pcu) { return $pcu['dnsmatch']; }
117 function get_dryrun($pcu) { return $pcu['reboot']; }
118 function get_model($pcu) { return $pcu['model']; }
119 function get_category_link($category,$header)
121 return "<a href='printbadpcus.php?category=$category'>$header</a>";
124 include 'soltesz.php';
126 $findbad = $p->load("findbadpcus");
127 $findbadpcus = array_keys($findbad['nodes']);
131 foreach ( $findbadpcus as $pcu_id )
133 if ( is_array($findbad['nodes'][$pcu_id]) )
135 #if ( in_array('values', $findbad['nodes'][$pcu]) )
137 # echo $pcu . " true<BR>";
139 # echo $pcu . " false<br>";
141 if ( array_key_exists('values', $findbad['nodes'][$pcu_id]) )
143 $pculist[] = $findbad['nodes'][$pcu_id]['values'];
147 $total = count($pculist);
151 if ( $_GET['category'] )
153 $category = $_GET['category'];
154 if ( $category == "node_ids" )
156 $newfunc = create_function('$pcu', 'return count($pcu[\'' . $category . '\']);');
158 $newfunc = create_function('$pcu', 'return $pcu[\'' . $category . '\'];');
160 if ( $newfunc != "" )
162 $fields = array_map($newfunc, $pculist);
163 array_multisort($fields, SORT_ASC, SORT_STRING, $pculist);
165 echo "ERROR create_function == null<BR>";
170 //array_multisort($protocols, SORT_ASC, SORT_STRING, $pculist);
173 <title>PLC PCU Info</title>
177 Total PCUs : <?= $total ?>
181 <th><?= get_category_link("pcu_id", "PCU ID") ?></th>
182 <th><?= get_category_link("hostname", "Hostname") ?></th>
183 <th><?= get_category_link("complete_entry", "Incomplete Fields") ?></th>
184 <th><?= get_category_link("dnsmatch", "DNS Status") ?></th>
185 <th><?= get_category_link("portstatus", "Port Status") ?></th>
186 <th><?= get_category_link("reboot", "Dry Run Results") ?></th>
187 <th><?= get_category_link("model", "Model") ?></th>
188 <th><?= get_category_link("node_ids", "Nodes") ?></th>
191 <?php $reachable_nodes = 0; ?>
192 <?php foreach ( $pculist as $pcu ): ?>
194 <td><?= $count ?></td>
195 <td id='id<?= $pcu['pcu_id'] ?>'><a href='<?= pcu_link($pcu) ?>'><?= $pcu['pcu_id'] ?></a></td>
196 <td><?= pcu_name($pcu) ?></td>
197 <td><?= pcu_entry($pcu) ?></td>
198 <td bgcolor='<?= DNS_to_color($pcu['dnsmatch']) ?>'><?= $pcu['dnsmatch'] ?></td>
199 <td><?= format_ports($pcu) ?></td>
200 <td bgcolor='<?= reboot_to_color($pcu['reboot']) ?>'><?= $pcu['reboot'] ?></td>
201 <td nowrap><?= $pcu['model'] ?></td>
202 <td><?= count( $pcu['node_ids'] ) ?></td>
205 <?php if ( $pcu['reboot'] == "0" ) $reachable_nodes+=count($pcu['node_ids']); ?>
206 <?php $count += 1; ?>
210 <b>Reachable Nodes:</b> <?= $reachable_nodes ?>