}
-$first_time_configuration = 'false';
+$first_time_configuration = false;
if (plc_is_admin())
$default_configuration = "ID:f|hostname:f|ST:f|AU:f";
//$extra_default = "LCN|DN|R|L|OS|MS|SN";
$column_configuration = "";
$slice_column_configuration = "";
+$show_configuration = "";
+$show_columns_message = '1';
+
$PersonTags=$api->GetPersonTags (array('person_id'=>$plc->person['person_id']));
//print_r($PersonTags);
$column_configuration = $ptag['value'];
$conf_tag_id = $ptag['person_tag_id'];
}
+ if ($ptag['tagname'] == 'showconf')
+ {
+ $show_configuration = $ptag['value'];
+ $show_tag_id = $ptag['person_tag_id'];
+ }
}
//print("column configuration = ".$column_configuration);
$nodesconf_exists = false;
if ($column_configuration == "")
{
+ $first_time_configuration = true;
$column_configuration = "nodes;default";
$nodesconf_exists = true;
}
//print("full configuration = ".$full_configuration);
// fetch nodes
-$node_fixed_columns=array('hostname','node_type','site_id','node_id','boot_state','last_contact','interface_ids','peer_id', 'slice_ids');
+$node_fixed_columns=array('node_type','site_id','boot_state','last_contact','interface_ids','peer_id', 'slice_ids');
$fix_columns = array();
if (plc_is_admin())
$tag_columns = $visibletags->headers();
$extra_columns = array();
-$extra_columns[]=array('tagname'=>'sitename', 'header'=>'SN', 'type'=>'string', 'title'=>'Site name', 'fetched'=>true);
-$extra_columns[]=array('tagname'=>'domain', 'header'=>'DN', 'type'=>'string', 'title'=>'Toplevel domain name', 'fetched'=>true);
-$extra_columns[]=array('tagname'=>'ipaddress', 'header'=>'IP', 'type'=>'string', 'title'=>'IP Address', 'fetched'=>true);
-$extra_columns[]=array('tagname'=>'fcdistro', 'header'=>'OS', 'type'=>'string', 'title'=>'Operating system', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'sitename', 'header'=>'SN', 'type'=>'string', 'title'=>'Site name', 'fetched'=>true, 'source'=>'myplc');
+$extra_columns[]=array('tagname'=>'domain', 'header'=>'DN', 'type'=>'string', 'title'=>'Toplevel domain name', 'fetched'=>true, 'source'=>'myplc');
+$extra_columns[]=array('tagname'=>'ipaddress', 'header'=>'IP', 'type'=>'string', 'title'=>'IP Address', 'fetched'=>true, 'source'=>'myplc');
+$extra_columns[]=array('tagname'=>'fcdistro', 'header'=>'OS', 'type'=>'string', 'title'=>'Operating system', 'fetched'=>false, 'source'=>'myplc');
+$extra_columns[]=array('tagname'=>'uptime', 'header'=>'UT', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Continuous uptime until now', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'date_created', 'header'=>'DA', 'source'=>'myplc', 'type'=>'date', 'title'=>'Date added', 'fetched'=>false);
+//$extra_columns[]=array('tagname'=>'hopcount', 'header'=>'HC', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Hop count from reference node', 'fetched'=>false);
+
$ConfigureColumns =new PlekitColumns($full_configuration, $fix_columns, $tag_columns, $extra_columns);
}
// go
+//print("getting nodes ".$node_columns);
+//print_r($node_columns);
$nodes=$api->GetNodes($node_filter,$node_columns);
+//print("<p> GOT NODES </p>");
+//print_r($nodes);
+
+$ConfigureColumns->fetch_live_data($nodes);
+
+$show_conf = explode(";",$show_configuration);
+foreach ($show_conf as $ss) {
+ if ($ss =="columns")
+ $show_columns_message = '0';
+}
+
+
+
// build site_ids - interface_ids
$site_ids=array();
$interface_ids=array();
//$info_header["?"] = "none";
$headers = array_merge($ConfigureColumns->get_headers(),$info_header);
-//print("<p>HEADERS");
-//print_r($headers);
+if ($first_time_configuration)
+$column_conf_visible = '1';
+else
+$column_conf_visible = '0';
$toggle_nodes=new PlekitToggle('nodes-column-configuration',
"Node table layout",
- array('visible'=>'1'));
+ array('visible'=>$column_conf_visible, 'info_div'=>'note_columns_div'));
$toggle_nodes->start();
print("<div id='debug'></div>");
print("<input type='hidden' id='slice_id' value='nodes' />");
print("<input type='hidden' id='person_id' value='".$plc->person['person_id']."' />");
print("<input type='hidden' id='conf_tag_id' value='".$conf_tag_id."' />");
+print("<input type='hidden' id='show_tag_id' value='".$show_tag_id."' />");
+print("<input type='hidden' id='show_configuration' value='".$show_configuration."' />");
print("<input type='hidden' id='column_configuration' value='".$slice_column_configuration."' />");
print("<br><input type='hidden' size=80 id='full_column_configuration' value='".$column_configuration."' />");
-//print("<input type='hidden' id='previousConf' value='".$slice_column_configuration."'></input>");
print("<input type='hidden' id='defaultConf' value='".$default_configuration."'></input>");
+
+if ($show_columns_message == '0')
+$note_display = "display:none;";
+else
+$note_display = "";
+
+
+print <<<EOF
+<div id='note_columns_div' style="align:center; background-color:#CAE8EA; padding:4px; width:800px; $note_display">
+<table align=center><tr><td valign=top>
+This tab allows you to customize the columns in the node tables, below. Information on the nodes comes from a variety of monitoring sources. If you, as either a user or a provider of monitoring data, would like to see additional columns made available, please send us your request in mail to <a href="mailto:support@myslice.info">support@myslice.info</a>. You can find more information about the MySlice project at <a href="http://trac.myslice.info">http://trac.myslice.info</a>.
+</td><td valign=top><span onClick=closeMessage('columns')><img class='reset' src="/planetlab/icons/clear.png" alt="hide message permanently"></span>
+</td></tr></table>
+</div>
+EOF;
+
$ConfigureColumns->configuration_panel_html(true);
$ConfigureColumns->javascript_init();
$toggle_nodes->end();
if (plc_is_admin()) $table->cell(l_node_t($node_id,$node_id));
$table->cell (l_node_t($node_id,$hostname));
$peers->cell ($table,$peer_id);
- //$table->cell (topdomain($hostname));
+
+ //prefetch some columns
$node['domain'] = topdomain($hostname);
- //$table->cell (l_site_t($site_id,$login_base));
$node['sitename'] = l_site_t($site_id,$login_base);
- //$table->cell (l_interface_t($interface_id,$ip),array('only-if'=> !$peer_id));
- $node['ipaddress'] = l_interface_t($interface_id,$ip);
+ if ($interface_id)
+ $node['ipaddress'] = l_interface_t($interface_id,$ip);
+ else
+ $node['ipaddress'] = "n/a";
+
list($label,$class) = Node::status_label_class_($node);
$table->cell ($label,array('class'=>$class));
//$table->cell (count($node['slice_ids']));
<?php
+// $Id$
+
// Require login
require_once 'plc_login.php';
$visibletags->columns();
$tag_columns = $visibletags->headers();
-// extra columns that are not tags (for the moment not sorted correctly)
-
$extra_columns = array();
$extra_columns[]=array('tagname'=>'sitename', 'header'=>'SN', 'type'=>'string', 'title'=>'Site name', 'fetched'=>true);
$extra_columns[]=array('tagname'=>'domain', 'header'=>'DN', 'type'=>'string', 'title'=>'Toplevel domain name', 'fetched'=>true);
$extra_columns[]=array('tagname'=>'ipaddress', 'header'=>'IP', 'type'=>'string', 'title'=>'IP Address', 'fetched'=>true);
$extra_columns[]=array('tagname'=>'fcdistro', 'header'=>'OS', 'type'=>'string', 'title'=>'Operating system', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'uptime', 'header'=>'UT', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Continuous uptime until now', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'date_created', 'header'=>'DA', 'source'=>'myplc', 'type'=>'date', 'title'=>'Date added', 'fetched'=>false);
+
//Get user's column configuration
//print_r($node_columns);
$all_nodes=$api->GetNodes(NULL,$node_columns);
+$ConfigureColumns->fetch_live_data($all_nodes);
+
//print("<br>person show configuration = ".$show_configuration);
$show_conf = explode(";",$show_configuration);
print <<<EOF
<div id='note_columns_div' style="align:center; background-color:#CAE8EA; padding:4px; width:800px; $note_display">
<table align=center><tr><td valign=top>
-This tab allows you to customize the columns in the node tables, below. Information on the nodes comes from a variety of monitoring sources. If you, as either a user or a provider of monitoring data, would like to see additional columns made available, please send us your request in mail to <a href="mailto:devel@planet-lab.org">devel@planet-lab.org</a>
+This tab allows you to customize the columns in the node tables, below. Information on the nodes comes from a variety of monitoring sources. If you, as either a user or a provider of monitoring data, would like to see additional columns made available, please send us your request in mail to <a href="mailto:support@myslice.info">support@myslice.info</a>. You can find more information about the MySlice project at <a href="http://trac.myslice.info">http://trac.myslice.info</a>.
</td><td valign=top><span onClick=closeMessage('columns')><img class='reset' src="/planetlab/icons/clear.png" alt="hide message permanently"></span>
</td></tr></table>
</div>
//extra columns
$node['domain'] = topdomain($hostname);
$node['sitename'] = l_site_t($node['site_id'],$site_hash[$node['site_id']]);
-$node['ipaddress'] = l_interface_t($interface_id,$ip);
-
+if ($interface_id)
+ $node['ipaddress'] = l_interface_t($interface_id,$ip);
+ else
+ $node['ipaddress'] = "n/a";
//foreach ($visiblecolumns as $tagname) $table->cell($node[$tagname]);
$ConfigureColumns->cells($table, $node);
var $tag_columns = array();
var $extra_columns = array();
+var $comon_live_data = "";
+var $tophat_live_data = "";
+var $live_data = array();
+
var $table_ids;
var $HopCount = array();
function PlekitColumns ($column_configuration, $fix_columns, $tag_columns, $extra_columns=NULL, $this_table_headers=NULL) {
+ if ($column_configuration != NULL) {
$this->fix_columns = $fix_columns;
$this->tag_columns = $tag_columns;
$this->extra_columns = $extra_columns;
$this->parse_configuration($column_configuration);
$this->visible_headers = $this->get_visible();
+ }
//print("<p>VISIBLE<p>");
//print_r($this->visible_headers);
function prepare_headers() {
foreach ($this->fix_columns as $column) {
-$this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'], 'fixed'=>true, 'visible'=>false);
+$this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'], 'fixed'=>true, 'visible'=>false, 'source'=>'myplc');
}
$tmp_headers = array();
$headerId = $column['header'];
//$this->all_headers[$headerId]=array('header'=>$headerId,'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'],'visible'=>false);
-$tmp_headers[$headerId]=array('header'=>$headerId,'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'],'visible'=>false);
+$tmp_headers[$headerId]=array('header'=>$headerId,'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'],'visible'=>false, 'source'=>'myplc');
}
if ($this->extra_columns)
foreach ($this->extra_columns as $column) {
//$this->all_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'], 'fetched'=>$column['fetched'],'visible'=>false);
-$tmp_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'], 'fetched'=>$column['fetched'], 'visible'=>false);
+$tmp_headers[$column['header']]=array('header'=>$column['header'],'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'], 'fetched'=>$column['fetched'], 'visible'=>false, 'source'=>$column['source']);
usort ($tmp_headers, create_function('$col1,$col2','return strcmp($col1["label"],$col2["label"]);'));
}
function node_tags() {
- $fetched_tags = array('node_id');
+ $fetched_tags = array('node_id','hostname');
foreach ($this->all_headers as $h)
{
- if ($h['visible'] == true && $h['tagname'] != "" && !$h['fetched'])
+ if ($h['visible'] == true && $h['tagname'] != "" && !$h['fetched'] && $h['source']=="myplc")
$fetched_tags[] = $h['tagname'];
}
$columns_conf = explode("|", $column_configuration);
+
foreach ($columns_conf as $c)
{
$conf = explode(":",$c);
if ($conf[0] == "default")
continue;
+ if (!$this->all_headers[$conf[0]])
+ continue;
+
$this->all_headers[$conf[0]]['visible']=true;
+
+ if ($this->all_headers[$conf[0]]['source'] == "comon")
+ $this->comon_live_data.=",".$this->all_headers[$conf[0]]['tagname'];
+
+ if ($this->all_headers[$conf[0]]['source'] == "tophat")
+ {
+ $this->reference_node = $conf[1];
+ print ("ref node in configuration = ".$conf[1]);
+ $this->reference_node = "planetlab-europe-07.ipv6.lip6.fr";
+ $this->all_headers[$conf[0]]['refnode']=$this->reference_node;
+ //$threshold = explode(",",$conf[1]);
+ //$this->all_headers[$conf[0]]['threshold']=$threshold;
+ }
+
//print("<p>-".$conf[0]."-should be visible now - ".$this->all_headers[$conf[0]]['visible']);
//print_r($this->all_headers[$conf[0]]);
$threshold = explode(",",$conf[1]);
$this->all_headers[$conf[0]]['threshold']=$threshold;
}
- else if ($this->inTypeD($conf[0]))
- {
- $this->reference_node = $conf[1];
- $this->reference_node = "planetlab-europe-07.ipv6.lip6.fr";
- $this->all_headers[$conf[0]]['refnode']=$this->reference_node;
- $threshold = explode(",",$conf[1]);
- $this->all_headers[$conf[0]]['threshold']=$threshold;
- }
else if ($this->inTypeA($conf[0]))
{
$exclude_list = explode(",",$conf[1]);
}
*/
}
+
}
*/
-function getHopCount($ref_node, $planetlab_nodes)
-{
+function convert_data($value, $data_type) {
+
+ if ($value == "" || $value == null || $value == "n/a" || $value == "None")
+ return "n/a";
+
+ if ($data_type == "string")
+ return $value;
+
+ if ($data_type == "date")
+ return date("Y-m-d", $value);
+
+ if ($data_type == "uptime")
+ return (int)((int) $value / 86400);
+
+ return ((int) ($value * 10))/10;
+
+}
+
+function getHopCount($ref_node, $planetlab_nodes) {
+
+ $tophat_auth = array( 'AuthMethod' => 'password', 'Username' => 'guest', 'AuthString' => 'guest');
+ $tophat_api = new TopHatAPI($tophat_auth);
+
+ $traceroute = $tophat_api->Get('traceroute', 'latest', array('src_hostname' => $ref_node, 'dst_hostname' => $planetlab_nodes), array('dst_hostname', 'hop_count') );
+
+ $hopcount = array();
+
+ if ($traceroute) foreach ($traceroute as $t)
+ $hopcount[$t['dst_hostname']]=$t['hop_count'];
+
+ return $hopcount;
+}
+
+function comon_query_nodes($requested_data) {
+ //$base_url = 'http://comon.cs.princeton.edu/status/tabulator.cgi?forma=nameonly&';
+ $base_url = "http://comon.cs.princeton.edu/status/tabulator.cgi?table=table_nodeviewshort&format=formatcsv&dumpcols='name";
+
+ $url = $base_url.$requested_data."'";
+
+ //print ("retriecing comon data for url ".$url);
+
+ $sPattern = '\', \'';
+ $sReplace = '|';
-$tophat_auth = array( 'AuthMethod' => 'password', 'Username' => 'guest', 'AuthString' => 'guest');
-$tophat_api = new TopHatAPI($tophat_auth);
+ if( false == ($str=file_get_contents($url)))
+ return '';
-$traceroute = $tophat_api->Get('traceroute', 'latest', array('src_hostname' => $ref_node, 'dst_hostname' => $planetlab_nodes), array('dst_hostname', 'hop_count') );
+ $result=preg_replace( $sPattern, $sReplace, $str );
+ $sPattern = '/\s+/';
+ $sReplace = ';';
+ $result=preg_replace( $sPattern, $sReplace, $result );
-$hopcount = array();
+ $comon_data = explode(";", $result);
+ $cl = array();
+ $comon_values = array();
+
+ foreach ($comon_data as $cd) {
+ $cc = explode("|", $cd);
+ if ($cc[0] == "name") {
+ $cl = $cc;
+ }
+ $comon_values[$cc[0]] = array();
+ $cindex=1;
+ foreach ($cl as $cltag) {
+ if ($cltag != "name")
+ $comon_values[$cc[0]][$cltag] = $cc[$cindex++];
+ }
+ }
-if ($traceroute) foreach ($traceroute as $t)
-$hopcount[$t['dst_hostname']]=$t['hop_count'];
-return $hopcount;
+ return $comon_values;
}
//Depending on the columns selected more data might need to be fetched from
//external sources
-function fetch_data($nodes) {
+function fetch_live_data($all_nodes) {
+
+ //print("<p>fetching live data<p>");
+
+//comon data
+ if ($this->comon_live_data != "") {
+
+ //print ("live data to be fetched =".$this->comon_live_data);
+ $this->live_data = $this->comon_query_nodes($this->comon_live_data);
+ //print_r($this->live_data);
+ }
-//TopHat pairwise data
+//TopHat pairwise data
+ //if ($this->tophat_live_data != "")
if ($this->reference_node != "")
{
$dd = array();
- if ($nodes) foreach ($nodes as $n)
- $dd[] = $n['hostname'];
-
- if ($potential_nodes) foreach ($potential_nodes as $n)
+ if ($all_nodes) foreach ($all_nodes as $n)
$dd[] = $n['hostname'];
print("Calling tophat api for reference node = ".$this->reference_node);
$st = time() + microtime();
$HopCount = $this->getHopCount($this->reference_node, $dd);
printf(" (%.2f ms)<br/>", (time() + microtime()-$st)*100);
- //print_r($HopCount);
+ print_r($HopCount);
}
-
}
function cells($table, $node) {
-$this->fetch_data($node);
-
foreach ($this->all_headers as $h)
{
if (!$h['fixed']) {
if ($h['visible'] != "")
{
+
+/*
if ($this->inTypeC($h['header']))
{
$tagname = $h['tagname'];
$v = $this->excludeItems($value, $h['exclude_list'], $h['header']);
$table->cell($v[0],$v[1]);
}
+*/
+if ($h['type'] == "date")
+{
+ $value = $this->convert_data($node[$h['tagname']], $h['type']);
+ $table->cell($value,array('name'=>$h['header'], 'display'=>'table-cell'));
+}
+else if ($h['source'] == "comon")
+{
+ //print("<br>Searching for ".$h['tagname']."at ".$node);
+ $value = $this->convert_data($this->live_data[$node['hostname']][$h['tagname']], $h['tagname']);
+
+ $table->cell($value,array('name'=>$h['header'], 'display'=>'table-cell'));
+}
else
{
- $value = $node[$h['tagname']];
+ //$value = $node[$h['tagname']];
+ $value = $this->convert_data($node[$h['tagname']], $h['type']);
$table->cell($value,array('name'=>$h['header'], 'display'=>'table-cell'));
}
}
else
if ($node[$h['tagname']])
- $table->cell($node[$h['tagname']], array('name'=>$h['header'], 'display'=>'none'));
+ {
+ $value = $this->convert_data($node[$h['tagname']], $h['type']);
+ $table->cell($value, array('name'=>$h['header'], 'display'=>'none'));
+ }
else
- $table->cell("??", array('name'=>$h['header'], 'display'=>'none'));
+ if ($node[$h['fetched']])
+ $table->cell("n/a", array('name'=>$h['header'], 'display'=>'none'));
+ else
+ $table->cell("??", array('name'=>$h['header'], 'display'=>'none'));
}
}
function javascript_init() {
-print("<input type='hidden' id='reference_node' value='".$this->reference_node."' />");
+print("<input type='hidden' id='selected_reference_node' value='".$this->reference_node."' />");
print("<script type='text/javascript'>");
print("highlightOption('AU');");
}
-
-
function quickselect_html() {
//return '<p>This link uses the onclick event handler.<br><a href="#" onclick="setVisible(\'quicklist\');return false" target="_self">Open popup</a></p>';
print ("<tr><td>
<input type='hidden' id='fetched".$h['label']."' value=',".$period.",".$fetch."'></input>
<input type='hidden' id='period".$h['label']."' value='".$period."'></input>
+<input type='hidden' id='type".$h['label']."' value='".$h['type']."'></input>
+<input type='hidden' id='source".$h['label']."' value='".$h['source']."'></input>
<div id='".$h['label']."' name='columnlist' class='".$optionclass."' onclick='highlightOption(this.id)'>
<table width=280 id='table".$h['label']."'><tr>
<td bgcolor=#CAE8EA align=center width=30><b><span style='color:#3399CC'>".$h['label']."</span></b></td>
// Common functions
require_once 'plc_functions.php';
+require_once 'columns.php';
+
+
$slice_id=$_GET["slice_id"];
$tagN=$_GET["tagName"];
+$data_source=$_GET["data_source"];
+$data_type=$_GET["data_type"];
$nodetags = array('node_id');
if ($slice_id == "nodes") {
+if ($data_source == "comon") {
+
+$comontags = $extratags;
+$extratags = array ('hostname');
+$nodes=$api->GetNodes(NULL, array_merge($nodetags, $extratags));
+$ColumnsConfigure = new PlekitColumns(NULL, NULL, NULL);
+$comon_data = $ColumnsConfigure->comon_query_nodes(",".$tagN);
+
+//print ("comon tags = ".$comontags);
+
+echo "---attached---";
+if ($nodes) foreach ($nodes as $node) {
+ echo "|".$node['node_id'];
+ foreach ($comontags as $t)
+ echo ":".$ColumnsConfigure->convert_data($comon_data[$node['hostname']][$t], $data_type);
+}
+}
+else if ($data_source == "tophat") {
+$extratags = array ('hostname');
+$nodes=$api->GetNodes(NULL, array_merge($nodetags, $extratags));
+echo "---attached---";
+if ($nodes) foreach ($nodes as $node) {
+ echo "|".$node['node_id'];
+ echo ":n/a";
+}
+}
+else
+{
+
echo "---attached---";
$nodes=$api->GetNodes(NULL, array_merge($nodetags, $extratags));
//echo $nodes;
foreach ($extratags as $t)
echo ":".$node[$t];
}
+}
- }
+
+}
else
{
$slice=$slices[0];
+if ($data_source == "comon") {
+
+$comontags = $extratags;
+$extratags = array ('hostname');
+
+$nodes=$api->GetNodes(array('node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
+$potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
+
+$ColumnsConfigure = new PlekitColumns(NULL, NULL, NULL);
+$comon_data = $ColumnsConfigure->comon_query_nodes(",".$tagN);
+
+//print ("comon tags = ".$comontags);
+
+echo "---attached---";
+if ($nodes) foreach ($nodes as $node) {
+ echo "|".$node['node_id'];
+ foreach ($comontags as $t)
+ echo ":".$ColumnsConfigure->convert_data($comon_data[$node['hostname']][$t], $data_type);
+}
+echo "|---potential---";
+if ($potential_nodes) foreach ($potential_nodes as $potential_node) {
+ echo "|".$potential_node['node_id'];
+ foreach ($comontags as $t)
+ echo ":".$ColumnsConfigure->convert_data($comon_data[$potential_node['hostname']][$t], $data_type);
+}
+}
+else if ($data_source == "tophat") {
+$extratags = array ('hostname');
+$nodes=$api->GetNodes(array('node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
+$potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
+echo "---attached---";
+if ($nodes) foreach ($nodes as $node) {
+ echo "|".$node['node_id'];
+ echo ":n/a";
+}
+echo "|---potential---";
+if ($potential_nodes) foreach ($potential_nodes as $potential_node) {
+ echo "|".$potential_node['node_id'];
+ echo ":n/a";
+}
+}
+else
+{
+
$nodes=$api->GetNodes(array('node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
$potential_nodes=$api->GetNodes(array('~node_id'=>$slice['node_ids']),array_merge($nodetags, $extratags));
echo ":".$potential_node[$t];
}
}
+}
?>
require_once 'plc_functions.php';
$value=$_GET["value"];
-$person_id=$_GET["person_id"];
+$person_id=intval($_GET["person_id"]);
$slice_id=$_GET["slice_id"];
$tag_id=intval($_GET["tag_id"]);
+$tag_name=$_GET["tag_name"];
-$api->UpdatePersonTag( $tag_id, $value );
+#$res = $api->UpdatePersonTag( $tag_id, $value );
+if ($tag_name == "columnconf")
+$res = $api->SetPersonColumnconf( $person_id, $value );
+else if ($tag_name == "showconf")
+$res = $api->SetPersonShowconf( $person_id, $value );
$myFile = "/var/log/myslice.log";
-$fh = fopen($myFile, 'a') or die("can't open file");
+if (file_exists($myFile))
+ $fh = fopen($myFile, 'a') or die("can't open file");
+
$stringData = "\n".date('Ymd-H:i')."|".$person_id.":".$slice_id.":".$value;
fwrite($fh, $stringData);
fclose($fh);
var sourceManiacs = '<b><a target="source_window" href="http://www.ece.gatech.edu/research/labs/MANIACS/as_taxonomy/">MANIACS</a></b>';
var sourceMaxmind = '<b><a target="source_window" href="http://www.maxmind.com/app/geolitecity">MaxMind</a></b>';
var sourceMonitor = '<b><a target="source_window" href="http://monitor.planet-lab.org/">Monitor</a></b>';
-var selectReferenceNode ='Select reference node: <select id="reference_node" onChange="updateDefaultConf(this.value)"><option value=planetlab-europe-07.ipv6.lip6.fr>planetlab-europe-07.ipv6.lip6.fr</option></select>';
-var addButton = '<input id="addButton" type="button" value="Add" onclick=addColumnAjax(document.getElementById("list1").value)></input>';
-var deleteButton = '<input id="deleteButton" type="button" value="Delete" onclick=deleteColumn(window.document.getElementById("list1").value)></input>';
+var hardwareReqs = 'current <b><a target="source_window" href="http://www.planet-lab.org/hardware">PlanetLab hardware requirement</a></b>';
+var selectReferenceNode ='Select reference node: <select id="reference_node" onChange="updateReferenceNode(this.value)"><option value=planetlab-europe-07.ipv6.lip6.fr>planetlab-europe-07.ipv6.lip6.fr</option><option value=planetlab2.ipv6.lip6.fr>planetlab2.ipv6.lip6.fr</option></select>';
+//var addButton = '<input id="addButton" type="button" value="Add" onclick=addColumnAjax(document.getElementById("list1").value)></input>';
+//var deleteButton = '<input id="deleteButton" type="button" value="Delete" onclick=deleteColumn(window.document.getElementById("list1").value)></input>';
var descHOSTNAME = "test";
-var titleA = 'Architecture name';
-var detailA = '<i>The node architecture.</i>';
-var sourceA = '<b>Source:</b> '+sourceMyPLC;
-var valuesA = 'Values: <b>x86_64</b>, <b>i386</b>';
-var descA = '<span class="myslice title">'+titleA+'</span><p>'+detailA+'<p>'+valuesA+'<p>'+sourceA;
-
-var titlef = 'Operating system';
-var detailf = '<i>Fedora or CentOS distribution to use for node or slivers.</i>';
-var sourcef = '<b>Source:</b> '+sourceMyPLC;
-var descf = '<span class="myslice title">'+titlef+'</span><p>'+detailf+'<p>'+sourcef;
var titleAU = 'Authority';
var detailAU = '<i>The authority of the global PlanetLab federation that the site of the node belongs to.</i>';
var valuesAU = 'Values: <b>PLC</b> (PlanetLab Central), <b>PLE</b> (PlanetLab Europe)';
-var sourceAU = '<b>Source:</b> '+sourceMyPLC;
+var sourceAU = 'Source: '+sourceMyPLC;
var descAU = '<span class="myslice title">'+titleAU+'</span><p>'+detailAU+'<p>'+valuesAU+'<p>'+sourceAU;
+var titleST = 'Status';
+var sourceST = 'Source: '+sourceMonitor;
+var valuesST = 'Values: <b>online</b> (up and running), <b>good</b> (up and running recently), <b>offline</b> (unreachable today), <b>down</b> (node unreachable for more than one day), <b>failboot</b> (reachable, but only by administrators for debugging purposes).';
+var descST = '<span class="myslice title">'+titleST+'</span><p>'+valuesST+'<p>'+sourceST;
+
+var titleA = 'Architecture name';
+var detailA = '<i>The node architecture.</i>';
+var sourceA = 'Source: '+sourceMyPLC;
+var valuesA = 'Values: <b>x86_64</b>, <b>i386</b>, <b>n/a</b>';
+var descA = '<span class="myslice title">'+titleA+'</span><p>'+detailA+'<p>'+valuesA+'<p>'+sourceA;
+
var titleAS = 'Autonomous system ID';
var sourceAS = 'Source: '+sourceCymru+' (via '+sourceTophat+')';
-var valuesAS = 'Unit: <b>Integer between 0 and 65535</b>';
+var valuesAS = 'Values: <b>Integer between 0 and 65535</b>, <b>n/a</b>';
var descAS = '<span class="myslice title">'+titleAS+'</span><p>'+valuesAS+'<p>' + sourceAS;
var titleAST = 'Autonomous system type';
var titleCC = 'Number of CPU cores';
var sourceCC = 'Source: '+sourceComon;
-var valuesCC = 'Current PlanetLab hardware requirements: 4 cores min. <br><i>(Older nodes may have fewer cores)</i>.';
+var valuesCC = '<i>The number of CPU cores on the node. For reference, the '+hardwareReqs+' is <b>4 cores min.</b> <br> (Older nodes may have fewer cores)</i>.';
var descCC = '<span class="myslice title">'+titleCC+'</span><p>'+valuesCC+'<p>'+sourceCC;
var titleCN = 'Number of CPUs';
var sourceCN = 'Source: '+sourceComon;
-var valuesCN = 'Current PlanetLab hardware requirements: <b>1 (if quad core) or 2 (if dual core)</b>';
+var valuesCN = '<i>The number of CPUs on the node. For reference, the '+hardwareReqs+' is <b>1 (if quad core) or 2 (if dual core)</b>.</i>';
var descCN = '<span class="myslice title">'+titleCN+'</span><p>'+valuesCN+'<p>'+sourceCN;
var titleCR = 'CPU clock rate';
+var detailCR = '<i>The clock rate for the CPUs on the node. For reference, the '+hardwareReqs+' is <b>2.4 GHz</b></i>.';
var sourceCR = 'Source: '+sourceComon;
-var valuesCR = 'Unit: <b>GHz</b><p>Current PlanetLab hardware requirements: <b>2.4 GHz</b>';
-var descCR = '<span class="myslice title">'+titleCR+'</span><p>'+valuesCR+'<p>'+sourceCR;
+var valuesCR = 'Unit: <b>GHz</b>';
+var descCR = '<span class="myslice title">'+titleCR+'</span><p>'+detailCR+'<p>'+valuesCR+'<p>'+sourceCR;
var selectPeriodCF = 'Select period: <select id="selectperiodCF" onChange=updatePeriod("CF",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
var titleCF = 'Free CPU';
var sourceDN = 'Source: '+sourceMyPLC;
var descDN = '<span class="myslice title">'+titleDN+'</span><p>'+sourceDN;
+var titleDA = 'Date added';
+var sourceDA = 'Source: '+sourceMyPLC;
+var detailDA = '<i> The date that the noded was added to PlanetLab.</i>';
+var descDA = '<span class="myslice title">'+titleDA+'</span><p>'+detailDA+'<p>'+sourceDA;
+
var titleDS = 'Disk size';
+var detailDS = '<i>The size of the hard disk available on the node. For reference, the '+hardwareReqs+' is <b>500 GB</b></i>.';
var sourceDS = 'Source: '+sourceComon;
-var valuesDS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>500 GB</b>';
-var descDS = '<span class="myslice title">'+titleDS+'</span><p>'+valuesDS+'<p>'+sourceDS;
+var valuesDS = 'Unit: <b>GB</b>';
+var descDS = '<span class="myslice title">'+titleDS+'</span><p>'+detailDS+'<p>'+valuesDS+'<p>'+sourceDS;
var titleDU = 'Current disk utilization';
var sourceDU = 'Source: '+sourceComon+' (via '+sourceMySlice+')';
var titleLPR= 'Location precision radius';
var sourceLPR = 'Source: '+sourceTophat;
-var valuesLPR = 'Unit: <b>float</b>';
+var valuesLPR = 'Unit: <b>float</b>.';
var detailLPR = '<i>The radius of the circle corresponding to the error in precision of the geolocalization estimate.</i>';
var descLPR = '<span class="myslice title">'+titleLPR+'</span><p>'+detailLPR+'<p>'+valuesLPR+'<p>'+sourceLPR;
var descLRN = '<span class="myslice title">'+titleLRN+'</span><p>'+detailLRN+'<p>'+sourceLRN;
var titleMS= 'Memory size';
+var detailMS = '<i>The memory size (RAM) available on the node. For reference, the '+hardwareReqs+' is <b>4 GB</b></i>.';
var sourceMS = 'Source: '+sourceComon;
-var valuesMS = 'Unit: <b>GB</b><p>Current PlanetLab hardware requirements: <b>4 GB</b>.';
+var valuesMS = 'Unit: <b>GB</b>.';
var descMS = '<span class="myslice title">'+titleMS+'</span><p>'+valuesMS+'<p>'+sourceMS;
var selectPeriodMU = 'Select period: <select id="selectperiodMU" onChange=updatePeriod("MU",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
var descNRR = '<span class="myslice title">'+titleNRR+'</span><p>'+detailNRR+'<p>'+valuesNRR+'<p>'+sourceNRR;
var titleOS = 'Operating system';
+var detailOS = '<i>Fedora or CentOS distribution to use for node or slivers.</i>';
var sourceOS = 'Source: '+sourceMyPLC;
-var valuesOS = 'Values: <b>Fedora, Cent/OS, other, n/a</b>';
+var valuesOS = 'Values: <b>f8, f12, Cent/OS, other, n/a</b>';
var descOS = '<span class="myslice title">'+titleOS+'</span><p>'+valuesOS+'<p>'+sourceOS;
var selectPeriodR = 'Select period: <select id="selectperiodR" onChange=updatePeriod("R",this.value)><option value="">Latest</option><option value=w>Week</option><option value=m>Month</option><option value=y>Year</option></select>';
var sourceSSH ='Source: '+sourceComon+' (via '+sourceMySlice+')';
var descSSH = '<span class="myslice title">'+titleSSH+'</span><p>'+detailSSH+'<p>'+selectPeriodSSH+'<p>'+valuesSSH+'<p>'+sourceSSH;
-var titleST = 'Status';
-var sourceST = 'Source: '+sourceMonitor;
-var valuesST = 'Values: <b>online</b> (up and running), <b>good</b> (up and running recently), <b>offline</b> (unreachable today), <b>down</b> (node unreachable for more than one day), <b>failboot</b> (reachable, but only by administrators for debugging purposes).';
-var descST = '<span class="myslice title">'+titleST+'</span><p>'+valuesST+'<p>'+sourceST;
+
+var titleUT = 'Uptime';
+var sourceUT = 'Source: '+sourceComon;
+var valuesUT = 'Unit: <b>days</b>';
+var detailUT = 'The continuous uptime until the moment that the page is loaded, as reported by the CoMon html query API.';
+var descUT = '<span class="myslice title">'+titleUT+'</span><p>'+detailUT+'<p>'+valuesUT+'<p>'+sourceUT;
//Categorization of columns in different types, useful for filtering
//When the checkbox is clicked. Adds/removes column respectively
function changeCheckStatus(column) {
+ var h = document.getElementById(column).value;
+
if (document.getElementById('selectdescr'))
- showDescription(document.getElementById(column).value);
+ showDescription(h);
+
+ //debugfilter("HERE: "+column+" - "+document.getElementById('type '+column).value);
+ //debugfilter("HERE: "+column);
+
if (document.getElementById(column).checked)
- addColumn(document.getElementById(column).value, true);
+ addColumn(h, true, document.getElementById('type'+h).value);
else
- deleteColumn(document.getElementById(column).value);
+ deleteColumn(h);
}
-function removeSelectHandler(object)
-{
- debugfilter(object);
- object.onclick = null;
-}
//This function is used when the alternative "quick" selection list is used
}
}
+function updateReferenceNode(new_ref_node) {
+
+ var old_ref_node = document.getElementById('selected_reference_node').value;
+ document.getElementById('selected_reference_node').value=new_ref_node;
+
+ //debugfilter("changed "+old_ref_node+" with "+new_ref_node);
+
+ if (document.getElementById('checkHC').checked)
+ {
+ addColumnAjax('HC', 'HC');
+ //debugfilter("replacing "+old_ref_node+" with "+new_ref_node);
+ replaceColumnConfiguration('HC:'+old_ref_node,'HC:'+new_ref_node);
+ }
+
+}
+
+
//When the period of an already selected column is changed
function updatePeriod(h, new_period) {
var person_id = document.getElementById('person_id').value;
var tag_id = document.getElementById('show_tag_id').value;
- var url = "/plekit/php/updateConfiguration.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id;
+ var url = "/plekit/php/updateConfiguration.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_name=showconf&tag_id="+tag_id;
//debugfilter("updating conf with "+url);
document.getElementById('show_configuration').value = value;
}
}
- xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id,true);
+ xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_name=columnconf&tag_id="+tag_id,true);
//xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tagName=Columnconf",true);
xmlhttp.send();
for(var i = 0, th; th = ths[i]; i++) {
if (th.className.indexOf("Sort") != -1)
{
+ //debugfilter("sorted"+th.getAttribute("name"));
+
+ var column_name = th.getAttribute("name");
var hclass = th.className;
var column = hclass.substr(hclass.indexOf("column"),hclass.indexOf("column")+1);
- var sortdirection = hclass.substr(hclass.indexOf("Sort")-8,hclass.indexOf("Sort"));
+ var sortdirection = "forward";
+ if (hclass.indexOf("reverse")!=-1)
+ sortdirection = "reverse";
+
if (column.indexOf("column-1")==-1 && column.indexOf("column-0")==-1)
- logSortingAction(person_id, slice_id, tableid+"|"+column+"|"+sortdirection);
+ logSortingAction(person_id, slice_id, tableid+"|"+column_name+"|"+sortdirection);
}
}
}
var old_columns = old_configuration.split("|");
var new_columns = new Array();
+ var olds = column_old.split(':');
+
for (var column_index = 0; column_index < old_columns.length ; column_index++) {
var conf = old_columns[column_index].split(':');
- if (conf[0] != column_old)
+ if (conf[0] != olds[0])
new_columns.push(old_columns[column_index]);
else
new_columns.push(column_new);
*/
+function convert_data(value, data_source, data_type, tagname) {
+ //debugfilter("v["+tagname+"]="+value+"-");
+
+ if (value == "" || value == "n/a" || value == null || value == "NaN" || value == "None")
+ return "n/a";
+
+ if (tagname == "uptime") {
+ return parseInt((parseFloat(value) / 86400));
+ }
+
+ if (data_type == "date") {
-function load_data(column, header, url) {
+ var date = new Date(value*1000);
+
+ var year = date.getFullYear();
+ var month = date.getMonth()+1;
+ if (month < 10)
+ month = "0"+month;
+ var day = date.getDate();
+ if (day < 10)
+ day = "0"+day;
+
+ return year + '-' + month + '-' + day;
+ }
+
+ return value;
+}
+
+
+function load_data(column, header, url, data_source, data_type, tagname) {
//debugfilter("<br>loading "+url);
var req = getHTTPObject();
req.onreadystatechange =
function() {
if (req.readyState == 4)
- { updateColumnData(column, header, req.responseText); }
+ { updateColumnData(column, header, req.responseText, data_source, data_type, tagname); }
}
req.send(null);
}
-function updateColumnData(column, header, data) {
+function updateColumnData(column, header, data, data_source, data_type, tagname) {
var headers = header.split("|");
var data_table = data.split("|");
//debugfilter("<p>headers[0] = "+headers[0]);
//debugfilter("<p>data[2] = "+data_table[2]);
-//debugfilter("data = "+data);
+//debugfilter("data = "+data + " with type "+data_type + " and source "+data_source);
if (data != "")
{
+
+//debugfilter("GOT SOME DATA");
var node_data;
for (var h_index=0; h_index < headers.length; h_index++) {
- if (node_data[h_index+1] == "")
+ if (node_data[h_index+1] == "" || node_data[h_index+1] == "None")
data_array1[node_data[0]][h_index] = "n/a";
else
- data_array1[node_data[0]][h_index] = node_data[h_index+1];
+ data_array1[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname);
}
}
}
}
+ //tablePaginater.init(table_id1);
fdTableSort.init(table_id1);
- tablePaginater.init(table_id1);
//potential nodes
if (data_table[node_index] == '---potential---')
if (node_data[h_index+1] == "")
data_array2[node_data[0]][h_index] = "n/a";
else
- data_array2[node_data[0]][h_index] = node_data[h_index+1];
+ data_array2[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname);
}
}
}
}
}
-
- //fdTableSort.removeTableCache(table_id2);
fdTableSort.init(table_id2);
- tablePaginater.init(table_id2);
+ //tablePaginater.init(table_id2);
+
}
+ //fdTableSort.removeTableCache(table_id2);
+ //document.getElementById('loading'+column).innerHTML = "";
+ //debugfilter("Reset sorting .....");
+
}
document.getElementById('loading'+column).innerHTML = "";
var selectedperiod = document.getElementById('period'+column).value;
var fetched = document.getElementById('fetched'+column).value;
+ var data_source = document.getElementById('source'+column).value;
+ var data_type = document.getElementById('type'+column).value;
var to_load = false;
//debugfilter("<br>adding "+column+","+header+','+fetched+','+t);
if (to_load)
{
document.getElementById('loading'+column).innerHTML = "<img width=10 src=/plekit/icons/ajax-loader.gif>";
- var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t;
- load_data(column, header, url);
+ var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t+"&data_type="+data_type+"&data_source="+data_source;
+ load_data(column, header, url, data_source, data_type, t);
}
}
var selectedperiod="";
var header=column;
+ var conf="";
if (inTypeC(column)!=-1)
selectedperiod = document.getElementById('period'+column).value;
header = column+""+selectedperiod;
- //debugfilter("adding column "+column+" and header "+header);
+ if (inTypeD(column)!=-1)
+ {
+ conf = header+":"+document.getElementById('reference_node').value;
+ document.getElementById('selected_reference_node').value=document.getElementById('reference_node').value;
+ }
+ else
+ conf = header;
+
+ //debugfilter("adding column "+column+" and header "+header+" and conf = "+conf);
addColumnCells(header);
if (fetch)
addColumnAjax(column, header);
- addColumnToConfiguration(header);
+ addColumnToConfiguration(conf);
}
EXTRA
+
+function removeSelectHandler(object)
+{
+ debugfilter(object);
+ object.onclick = null;
+}
+
//to be used for scrolling the column list with down/up arrows
function scrollList() {