EOS1; # # # # # # # # # # # # # # # # # # # # # # # # } function displayBody() { echo <<
xCAT
LOADING
0%

 
 
 
EOS5; } function displayFooter() { echo "
 
"; // # use system() to get the xCAT Web version; echo ""; # comment out if statement to fix refresh but of logout. if(!isAuthenticated()){ insertLogin(); } echo << EOS3; } // Create the bread crumb links. The mapper arg is a hash of label/url pairs, where // the final url is usually ''. function displayMapper($mapper) { echo "
"; $first = 1; foreach ($mapper as $key => $value) { if (!$first) { echo " / "; } $first = 0; if (!strlen($value)) { echo $key; } else { if ($value == 'main.php') { $href = '#'; } else { $href = "#$value"; } echo "$key"; } } echo "
"; } function displayTabMain(){ displayMapper(array('home'=>'main.php', 'config' =>'')); /* echo << home / config
MAPPER; */ echo <<

Configuration Menu

xCAT is configured by several tables. Each of the tables below tweeks a setting in xCAT. Click on a table below to configure xCAT EOS; $xml = docmd('tabdump', '', array('-d')); foreach($xml->children() as $response) foreach($response->children() as $line){ list($tabName, $descr) = split(":", $line, 2); echo "

$tabName$descr

\n"; } echo << EOS; } function displayTab($tab){ displayMapper(array('home'=>'main.php', 'config' =>'config.php', "$tab"=>'')); /* echo << home / config / $tab MAPPER; */ echo "
"; echo "

$tab

\n"; insertButtons(array('label' => 'Save','id' => 'saveit'), array('label' => 'Cancel', 'id' => 'reset') ); $xml = docmd('tabdump', '', array($tab)); $headers = getTabHeaders($xml); if(!is_array($headers)){ die("

Can't find header line in $tab

"); } echo "\n"; #echo "
\n"; echo ""; echo "\n"; # extra cell for the red x #echo "\n"; # extra cell for the red x foreach($headers as $colHead) {echo ""; } echo "\n"; # close header row echo ""; $tableWidth = count($headers); $ooe = 0; $item = 0; $line = 0; $editable = array(); foreach($xml->children() as $response) foreach($response->children() as $arr){ $arr = (string) $arr; if(ereg("^#", $arr)){ $editable[$line++][$item] = $arr; continue; } $cl = "ListLine$ooe"; $values = splitTableFields($arr); # X row echo ""; foreach($values as $v){ echo ""; $editable[$line][$item++] = $v; } echo "\n"; $line++; $item = 0; $ooe = 1 - $ooe; } echo "
$colHead
$v
\n"; $_SESSION["editable-$tab"] = & $editable; # save the array so we can access it in the next call of this file or change.php echo "

"; insertButtons(array('label' => 'Add Row', 'id' => 'newrow')); echo "

\n"; ?> 1) echo ""; foreach (func_get_args() as $button) { $otherattrs = @$button['otherattrs']; $id = @$button['id']; if (!empty($id)) { $id = "id=$id"; } $onclick = @$button['onclick']; if (!empty($onclick)) { $onclick = "onclick='$onclick'"; } # if ($num > 1) echo ""; } #if ($num > 1) echo "
"; echo "{$button['label']}"; # if ($num > 1) echo "
\n"; I hate tables!!! } // $errors should be an array with errors function displayErrors($errors){ echo "

Changes to table failed! ", implode(' ',$errors), ",

\n"; } function displaySuccess($tab){ echo "

Changes to $tab have been saved.

\n"; } function displayAlert($a){ echo << alert('hi!' + '$a'); EOS7; } // Functions to control display of trees and control functions function displayCtrlPage($cmd){ displayMapper(array('home'=>'main.php', 'control' =>'')); echo "
"; echo "
Noderange:
"; echo "
Action: $cmd
"; echo "
\n"; echo "
\n"; //displayControlTables($cmd); } function displayNrTree(){ echo <<

Please select a node or noderange on the left.

You can use ctrl-click to select more than one node grouping,

or expand the noderanges to select individual nodes.

EOS; } function displayControlTables($cmd){ echo <<
  • Power
  • Inventory
  • Environmentals
  • Event Logs
  • Beacon Light
  • EOSS; } function displayRangeList($nr, $cmd){ if($cmd == ""){ displayCommands($nr); return; } if(substr($cmd,0,6) == 'rpower'){ $array = explode('rpower', $cmd); controlRunCmd($nr, 'rpower', $array[1]); }elseif(substr($cmd,0,4) == 'rinv'){ $array = explode('rinv', $cmd); controlRunCmd($nr, 'rinv', $array[1]); }elseif(substr($cmd,0,7) == 'rvitals'){ $array = explode('rvitals', $cmd); controlRunCmd($nr, 'rvitals', $array[1]); }elseif(substr($cmd,0,7) == 'rbeacon'){ $array = explode('rbeacon', $cmd); controlRunCmd($nr, 'rbeacon', $array[1]); }else{ echo "I don't recognize the command: $cmd"; } } function displayCommands($nr){ echo <<Please select an action to perform on noderange $nr

    Power

    Inventory

    Vitals

    Beacon

    Remote Commands

    • Run a command on all nodes

    Event Log

    • View Event Log
    • Clear Event Log

    Set Boot Order

    • Set Boot Order
    EOF; } function controlRunCmd($nr, $cmd, $subcmd){ $rvals = docmd($cmd, $nr, array($subcmd)); #print_r($rvals); $headers = attributesOfNodes($rvals,$cmd); #echo "

    Headers:
    "; #print_r($headers); $nh = mkNodeHash($rvals,$cmd); #echo "


    "; #print_r($nh); echo ""; echo "\n"; echo ""; echo ""; foreach ($headers as $head){ echo ""; } echo ""; echo ""; $ooe = 0; foreach($nh as $n => $vals){ $cl = "ListLine$ooe"; echo "\n"; #echo ""; echo ""; foreach($headers as $h){ if($vals[$h] == ''){ echo " "; }else{ #echo ""; echo ""; } } echo "\n"; $ooe = 1 - $ooe; } echo ""; echo "
    Node$head
    $n$n" . $vals[$h] . "" . $vals[$h] . "
    \n"; echo << $("table").tablesorter({ sortList: [[0,0]] }); JS; } // Main page display function displayMainPage() { echo <<

    Control

    • Power nodes off/on
    • Collect hardware information
    • Run Command on All Nodes

    Configure

    • Edit xCAT Tables
    EOS; # echo "
      "; # $tables = getTabNames(); # foreach($tables as $t){ # echo "
    • $t
    • "; # } # echo "
    "; echo <<Provision
    • Provision node

    Syslog

    • Show syslog Entries

    Monitor

    • Set up xCAT Monitoring Plug-in
    • This is still UNDER DEVELOPMENT.
    EOS; } // Monitoring page stuff. Right now its just the syslog monitor function displayLogTable(){ if(($line = getLastLine('')) === 0){ return; }; displayMapper(array('home'=>'main.php', 'syslog' =>'')); echo <<

    Syslog Entries

    Stop Updates | Start Updates

    EOS; $time = logToTable($line); echo <<
    Date Time Host SubSystem Message
    EOS; } // Given a Line from Syslog formats into a table. function logToTable($line){ list($month,$date,$time,$host,$subsys,$message) = preg_split('/\s+/', $line, 6); if($message == ''){ echo "no entry"; return; } echo << $month $date $time $host EOS; if($subsys == 'last'){ $message = $subsys . " " . $message; $subsys = " "; } echo <<$subsys $message FOO; return; } // provision page stuff ## here is where we provision nodes. # m - method (install or netboot) # o - OS (centos5.3, etc) # a - arch (x86, x86_64) # p - profile (compute, or user defined) function displayProvisionPage($m,$o,$a,$p){ displayMapper(array('home'=>'main.php', 'provision' =>'')); echo "
    "; echo "
    Noderange:
    "; echo "
    Operating System: $o
    "; echo "
    Architecture: $a
    "; echo "
    Install Method: $m
    "; echo "
    Profile: $p
    "; echo "
    \n"; echo "\n"; } function displayInstallList($nr, $m,$o,$a,$p){ if($m == ""){ displayProvisionOps($nr); return; } echo "installing $m $o $a $p
    "; } function displayProvisionOps($nr){ echo <<

    Please select an OS to install on the noderange $nr

    EOF; } ?>