-The cluster summary page is created.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4944 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -332,8 +332,7 @@ padding:10px 2px;
 | 
			
		||||
 | 
			
		||||
#rmc_tree {
 | 
			
		||||
    float: left;
 | 
			
		||||
    width: auto;
 | 
			
		||||
    min-height: 255px;
 | 
			
		||||
    width: 21%;
 | 
			
		||||
    border-right: 1px dotted #555;
 | 
			
		||||
    min-width: 130px;
 | 
			
		||||
    /*display: none;*/
 | 
			
		||||
@@ -341,9 +340,9 @@ padding:10px 2px;
 | 
			
		||||
 | 
			
		||||
#rmc_monshow {
 | 
			
		||||
    float: left;
 | 
			
		||||
    width: 701px;  /*need update*/
 | 
			
		||||
    margin: 10px;
 | 
			
		||||
    padding: 10px;
 | 
			
		||||
    width: 78%;  /*need update*/
 | 
			
		||||
    margin: 0px;
 | 
			
		||||
    padding: 0px;
 | 
			
		||||
    display: block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -406,3 +405,116 @@ padding:10px 2px;
 | 
			
		||||
    float: right;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * @the following definitions are used for cluster summary page
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 h5 {
 | 
			
		||||
	font-family: "Trebuchet MS", Verdana, Helvetica, Arial,sans-serif !important;
 | 
			
		||||
	margin: 0;
 | 
			
		||||
	padding: 0;
 | 
			
		||||
	letter-spacing: 0;
 | 
			
		||||
	border-bottom: 0 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
a {
 | 
			
		||||
    text-decoration:none;
 | 
			
		||||
	color: #5DB0E6;
 | 
			
		||||
}
 | 
			
		||||
a:focus {
 | 
			
		||||
	outline: 1px dotted #eee;
 | 
			
		||||
}
 | 
			
		||||
a:active {
 | 
			
		||||
	outline: 0px;
 | 
			
		||||
}
 | 
			
		||||
a:hover {
 | 
			
		||||
	color: #7bc4f4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#clusternav {
 | 
			
		||||
     float: right;
 | 
			
		||||
     display: inline;
 | 
			
		||||
     width: 164px;
 | 
			
		||||
     background: #fafafa;
 | 
			
		||||
     border: 1px solid #ccc;
 | 
			
		||||
     padding: 5px 15px 15px;
 | 
			
		||||
     min-height: 500px;
 | 
			
		||||
     -moz-border-radius: .5em; /* gecko */
 | 
			
		||||
     -webkit-border-radius: .5em; /*webkit*/
 | 
			
		||||
     border-radius: .5em; /* w3 */
 | 
			
		||||
     color: #000;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#clusternav h5 {
 | 
			
		||||
    background: #ddd;
 | 
			
		||||
    margin: 4px 0px 0px 24px;
 | 
			
		||||
    outline-color: #192839;
 | 
			
		||||
    padding: 3px 10px;
 | 
			
		||||
    font-size: 12px;
 | 
			
		||||
    text-align: left;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#clusternav ul li {
 | 
			
		||||
    list-style-type: none;
 | 
			
		||||
    text-align: left;
 | 
			
		||||
    border-bottom: 1px solid #999999;
 | 
			
		||||
    margin-bottom: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#clusterprimary {
 | 
			
		||||
    position: relative;
 | 
			
		||||
    float: left;
 | 
			
		||||
    display: inline;
 | 
			
		||||
    width: 732px;
 | 
			
		||||
    background: #fafafa;
 | 
			
		||||
    border: 1px solid #aaa;
 | 
			
		||||
    padding: 5px 15px 15px;
 | 
			
		||||
    color: #222;
 | 
			
		||||
    min-height: 500px;
 | 
			
		||||
    -moz-border-radius: .5em; /* gecko */
 | 
			
		||||
    -webkit-border-radius: .5em; /* webkit */
 | 
			
		||||
    border-radius: .5em; /* w3 */
 | 
			
		||||
    overflow: visible;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.cluster_subinfo {
 | 
			
		||||
    border-bottom: 1px solid #fafafa;
 | 
			
		||||
    text-align: left;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.cluster_subinfo h5 {
 | 
			
		||||
    background: #ddd;
 | 
			
		||||
    margin: 4px 0px 0px 24px;
 | 
			
		||||
    outline-color: #192839;
 | 
			
		||||
    padding: 3px 10px;
 | 
			
		||||
    font-size: 12px;
 | 
			
		||||
    text-align: left;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.stat_table {
 | 
			
		||||
    border-bottom: 1px solid #fafafa;
 | 
			
		||||
    font-size: .8em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.spacer {
 | 
			
		||||
    clear: both;
 | 
			
		||||
    height: 20px;
 | 
			
		||||
    display: block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#mgmt_network, #rpowerstat_num, #monplugin_list, #rpmtable {
 | 
			
		||||
    border: 1px solid #AAA;
 | 
			
		||||
    background-color: #f9f9f9;
 | 
			
		||||
    clear: right;
 | 
			
		||||
    color: black;
 | 
			
		||||
    margin: 0.5em 0em 0.5em 1em;
 | 
			
		||||
    padding: 0.2em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#rpmtable tr:odd {
 | 
			
		||||
    background-color: #CCCCCC;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#general table {
 | 
			
		||||
    margin-left: 30px;
 | 
			
		||||
}
 | 
			
		||||
@@ -142,7 +142,7 @@ fieldset {
 | 
			
		||||
    padding: 5px;
 | 
			
		||||
    float:left;
 | 
			
		||||
    display: block;
 | 
			
		||||
    width: 94%;
 | 
			
		||||
    width: 95%;
 | 
			
		||||
    border: 1px solid gray;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -334,8 +334,8 @@ function init_ositree(){
 | 
			
		||||
    //display all the nodes with OSI type
 | 
			
		||||
    nrtree = new tree_component();  //-tree begin
 | 
			
		||||
    nrtree.init($("#ositree"),{
 | 
			
		||||
        rules: { multiple: "Ctrl" },
 | 
			
		||||
        ui: { animation: 250 },
 | 
			
		||||
        rules: {multiple: "Ctrl"},
 | 
			
		||||
        ui: {animation: 250},
 | 
			
		||||
        data : {
 | 
			
		||||
            type: "json",
 | 
			
		||||
            async: "true",
 | 
			
		||||
@@ -358,8 +358,8 @@ function init_ositree(){
 | 
			
		||||
function init_rmc_ositree() {
 | 
			
		||||
    nrtree = new tree_component();  //-tree begin
 | 
			
		||||
    nrtree.init($("#rmc_tree"),{
 | 
			
		||||
        rules: { multiple: "Ctrl" },
 | 
			
		||||
        ui: { animation: 250 },
 | 
			
		||||
        rules: {multiple: "Ctrl"},
 | 
			
		||||
        ui: {animation: 250},
 | 
			
		||||
        callback: {
 | 
			
		||||
            onchange: function(n) {
 | 
			
		||||
                $("#monshow_tip_1").hide();
 | 
			
		||||
@@ -482,5 +482,21 @@ function loadLLCfgEditor()
 | 
			
		||||
    window.document.location="../ll/llconfig_editor.pl";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
 * loadNodeStatus()
 | 
			
		||||
 * will show the power status of all nodes in the cluster
 | 
			
		||||
 * with the help of "rpower all stat"
 | 
			
		||||
 * It's used in PHP function showNodeStat().
 | 
			
		||||
 */
 | 
			
		||||
function loadNodeStatus()
 | 
			
		||||
{
 | 
			
		||||
    $.get("rpowerstat.php", {type: "table"}, function(data) {
 | 
			
		||||
        $("#p_stat_table").html("<div id=stat_table></div>");
 | 
			
		||||
        $("#stat_table").html(data);
 | 
			
		||||
        $("#stat_table").dataTable({"bJQueryUI": true, "iDisplayLength": 50});
 | 
			
		||||
        $("#p_stat_table").show();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// load progress bar
 | 
			
		||||
myBar.loaded('xcat.js');
 | 
			
		||||
 
 | 
			
		||||
@@ -74,6 +74,9 @@ echo <<<EOS2
 | 
			
		||||
 | 
			
		||||
 <div id=header>
 | 
			
		||||
  <ul class="sf-menu" id='sf-menu'>
 | 
			
		||||
   <li>
 | 
			
		||||
        <img src="img/logo.gif" height=100% onclick='loadMainPage("index.php")'/>
 | 
			
		||||
   </li>
 | 
			
		||||
   <li>
 | 
			
		||||
    <a href="control.php">control</a>
 | 
			
		||||
	<ul>
 | 
			
		||||
@@ -119,6 +122,13 @@ echo <<<EOS4
 | 
			
		||||
                </li>
 | 
			
		||||
	</ul>
 | 
			
		||||
   </li>
 | 
			
		||||
   <li>
 | 
			
		||||
        <a href="help.php">Help</a>
 | 
			
		||||
        <ul>
 | 
			
		||||
            <li><a href="#">Update</a></li>
 | 
			
		||||
            <li><a href="summary.php">Summary</a></li>
 | 
			
		||||
        </ul>
 | 
			
		||||
   </li>
 | 
			
		||||
  </ul>
 | 
			
		||||
  <!-- <div id="cmdForm">
 | 
			
		||||
    <form action="command.php" method="post" id="runcmd">
 | 
			
		||||
@@ -466,7 +476,8 @@ $(document).ready(function() {
 | 
			
		||||
    $("#tableForCtrl").dataTable({
 | 
			
		||||
        "bLengthChange": true,
 | 
			
		||||
        "bFilter": true,
 | 
			
		||||
        "bSort": true
 | 
			
		||||
        "bSort": true,
 | 
			
		||||
        "iDisplayLength": 50
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
</script>
 | 
			
		||||
@@ -695,4 +706,282 @@ function displayProvisionOps($nr){
 | 
			
		||||
EOF;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function getHostName() {
 | 
			
		||||
    if($_SERVER['SERVER_SOFTWARE'] == 'IBM_HTTP_Server') {
 | 
			
		||||
        return exec("hostname");
 | 
			
		||||
    }else {
 | 
			
		||||
        return exec("hostname --long");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getCPUInfo() {
 | 
			
		||||
    #check the var $_SERVER['SERVER_SOFTWARE'] to determine the server's os type
 | 
			
		||||
    #if its value is "IBM_HTTP_Server", the server will be treated as AIX
 | 
			
		||||
    if($_SERVER['SERVER_SOFTWARE'] == 'IBM_HTTP_Server') {
 | 
			
		||||
        return exec("lscfg -vp |wc -l");#on AIX, the command can show processor count
 | 
			
		||||
    }else {
 | 
			
		||||
        return exec("cat /proc/cpuinfo |grep -i processor |wc -l");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getMemInfo() {
 | 
			
		||||
    if($_SERVER['SERVER_SOFTWARE'] == 'IBM_HTTP_Server') {#AIX
 | 
			
		||||
        $str = exec("lsattr -El sys0 |grep realmem");
 | 
			
		||||
        $arr = preg_split('/\s+/', $str);
 | 
			
		||||
        return $arr[1];
 | 
			
		||||
    }else {
 | 
			
		||||
        $str = exec("cat /proc/meminfo |grep MemTotal");
 | 
			
		||||
        $arr = preg_split('/[:\s]+/', $str);
 | 
			
		||||
        return $arr[1];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getNetworksInfo() {
 | 
			
		||||
    #the command is "lsdef -t network -i net,mask,mgtifname" in the sever end;
 | 
			
		||||
    #display the net, mask and mgtifname in one small table
 | 
			
		||||
    echo "<table id=mgmt_network cellspacing=5 >";
 | 
			
		||||
    echo "<thead>";
 | 
			
		||||
    echo "<tr><th>Network</th><th>Netmask</th><th>MgtIfName</th></tr>";
 | 
			
		||||
    echo "</thead>";
 | 
			
		||||
    echo "<tbody>";
 | 
			
		||||
    $xml = docmd("tabdump", "", array("networks"));
 | 
			
		||||
    foreach($xml->children() as $response) foreach($response->children() as $data) {
 | 
			
		||||
        if(strstr($data[0], '#') != FALSE) { continue; }
 | 
			
		||||
        else {
 | 
			
		||||
            #print_r($data);
 | 
			
		||||
            $arr = split(",", $data);
 | 
			
		||||
            echo "<tr>";
 | 
			
		||||
            echo "<td>".$arr[1]."</td>";
 | 
			
		||||
            echo "<td>".$arr[2]."</td>";
 | 
			
		||||
            echo "<td>".$arr[3]."</td>";
 | 
			
		||||
            echo "</tr>";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    echo "</tbody>";
 | 
			
		||||
    echo "</table>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function summary_general() {
 | 
			
		||||
    $hostname = getHostName();
 | 
			
		||||
    $cpus = getCPUInfo();
 | 
			
		||||
    $mem = getMemInfo();
 | 
			
		||||
    #TODO
 | 
			
		||||
echo <<<INFO0
 | 
			
		||||
       <table>
 | 
			
		||||
        <tbody>
 | 
			
		||||
        <tr>
 | 
			
		||||
        <td bgcolor="#cccccc">Hostname</td>
 | 
			
		||||
        <td>$hostname</td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
        <td bgcolor="#cccccc">Processors</td>
 | 
			
		||||
        <td>$cpus</td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
        <td bgcolor="#cccccc">Memory</td>
 | 
			
		||||
        <td>$mem KB</td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
        <td bgcolor="#cccccc">Networks</td>
 | 
			
		||||
        <td>
 | 
			
		||||
INFO0;
 | 
			
		||||
    getNetworksInfo();
 | 
			
		||||
echo <<<INFO1
 | 
			
		||||
        </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        </tbody>
 | 
			
		||||
        </table>
 | 
			
		||||
INFO1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * showNodeStat()
 | 
			
		||||
 * will show the number of nodes in the cluster
 | 
			
		||||
 * and also show their status
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
function showNodeStat() {
 | 
			
		||||
    $xml=docmd("rpower", "all", array("stat"));
 | 
			
		||||
    $stat_arr = array();
 | 
			
		||||
    foreach($xml->children() as $response){
 | 
			
		||||
        #parse the xml tree
 | 
			
		||||
        #print_r($response);
 | 
			
		||||
        if($response->errorcode == 0) {
 | 
			
		||||
            #echo $response->node->name, $response->node->data->contents;
 | 
			
		||||
            $key = $response->node->name;
 | 
			
		||||
            $stat_arr["$key"] = $response->node->data->contents;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    echo "<div>";
 | 
			
		||||
    echo "<div style='width:40%; margin-left:64px'>";
 | 
			
		||||
    echo "<table id=rpowerstat_num>";
 | 
			
		||||
    $stat_num = array("Operating" => 0, "Running" => 0, "Not Activated" => 0, "Open Firmware" => 0);
 | 
			
		||||
    foreach ($stat_arr as $k => $v) {
 | 
			
		||||
        $stat_num["$v"] ++;
 | 
			
		||||
    }
 | 
			
		||||
    echo "<tr><td>Operating</td><td>", $stat_num["Operating"], "</td></tr>";
 | 
			
		||||
    echo "<tr><td>Running</td><td>",$stat_num["Running"],"</td></tr>";
 | 
			
		||||
    echo "<tr><td>Not Activated</td><td>",$stat_num["Not Activated"],"</td></tr>";
 | 
			
		||||
    echo "<tr><td>Open Firmware</td><td>",$stat_num["Open Firmware"],"</td></tr>";
 | 
			
		||||
    echo "</table>";
 | 
			
		||||
    #add two buttons here: show/hide the detailed status in stat_table <table>
 | 
			
		||||
    #TODO: move them to the proper positions 
 | 
			
		||||
    echo "<div class='fg-buttonset fg-buttonset-single' style='margin-left:30px'>";
 | 
			
		||||
    echo "<button id='show' class='fg-button ui-state-default ui-state-active ui-priority-primary ui-corner-left'>Show</button>";
 | 
			
		||||
    echo "<button id='hide' class='fg-button ui-state-default ui-corner-right'>Hide</button>";
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
echo <<<GRAPH0
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
    $(function() {
 | 
			
		||||
        $("#show").click(function() {
 | 
			
		||||
            if($(this).is(".ui-state-active")) {
 | 
			
		||||
                loadNodeStatus();
 | 
			
		||||
                $(this).removeClass("ui-state-active");
 | 
			
		||||
                $("#hide").addClass("ui-state-active");
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        $("#hide").click(function() {
 | 
			
		||||
            if($(this).is(".ui-state-active")) {
 | 
			
		||||
                $("#p_stat_table").hide();
 | 
			
		||||
                $(this).removeClass("ui-state-active");
 | 
			
		||||
                $("#show").addClass("ui-state-active");
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    /*
 | 
			
		||||
    var data=[
 | 
			
		||||
        {label: "Operating", data: 3 },
 | 
			
		||||
        {label: "Running", data: 4 },
 | 
			
		||||
        {label: "Not Activated", data: 12 },
 | 
			
		||||
        {label: "Open Firmware", data: 1 }
 | 
			
		||||
    ];
 | 
			
		||||
    */
 | 
			
		||||
    var options = {
 | 
			
		||||
        series: {
 | 
			
		||||
            pie: {
 | 
			
		||||
                show: true
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    $.ajax({
 | 
			
		||||
        url: "rpowerstat.php",
 | 
			
		||||
        type: 'POST',
 | 
			
		||||
        data: "type=json",
 | 
			
		||||
        dataType: 'json',
 | 
			
		||||
        success: function(data) {
 | 
			
		||||
            $.plot($("#chart0"), data, options);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    /*
 | 
			
		||||
    "rpowerstat.php", {type:"json"}, function(data) {
 | 
			
		||||
        $.plot($("#chart0"), data, options);
 | 
			
		||||
    });
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
<div id='chart0' style="width:65%;height:256px;float: right">
 | 
			
		||||
</div>
 | 
			
		||||
GRAPH0;
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
    echo "<div id='p_stat_table' style='border: 1px solid #AAA; width: 95%; float: right'>";
 | 
			
		||||
    echo "<div id='stat_table'></div>";
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
    echo "<div class='spacer'></div>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* showMonSum()
 | 
			
		||||
 * will show the summary information of monitor plugins.
 | 
			
		||||
 * 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
function showMonSum() {
 | 
			
		||||
    $xml = docmd("monls", "", array("-a"));
 | 
			
		||||
 | 
			
		||||
    echo "<div> ";
 | 
			
		||||
    #print_r($xml);
 | 
			
		||||
    echo "<table id='monplugin_list' style='margin-left: 30px'>";
 | 
			
		||||
    echo "<thead><tr><th>Plugins</th><th>Status</th><th>NodeStatSupport</th><th></th></tr></thead>";
 | 
			
		||||
    echo "<tbody>";
 | 
			
		||||
 | 
			
		||||
    foreach($xml->children() as $response)  foreach($response->children() as $data){
 | 
			
		||||
            list($name, $stat, $nodemon) = preg_split("/\s+/", $data);
 | 
			
		||||
            echo "<tr>";
 | 
			
		||||
            echo "<td>$name</td><td>$stat</td>";
 | 
			
		||||
            if($nodemon) {
 | 
			
		||||
                echo "<td>Enabled</td>";
 | 
			
		||||
            }else {
 | 
			
		||||
                echo "<td>Disabled</td>";
 | 
			
		||||
            }
 | 
			
		||||
            echo "<td><button class='fg-button ui-state-active'>MonShow</button></td>";
 | 
			
		||||
            echo "</tr>";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    echo "</tbody>";
 | 
			
		||||
    echo "</table>";
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function showxCATInfo() {
 | 
			
		||||
    echo "<div>";
 | 
			
		||||
    #$ret = shell_exec("rpm -qa |grep xCAT");/* there's no newline character in the string */
 | 
			
		||||
    /*
 | 
			
		||||
     *  xCAT-UI-2.4-snap200912080702
 | 
			
		||||
        xCAT-client-2.4-snap200912180657
 | 
			
		||||
        perl-xCAT-2.4-snap200912240801
 | 
			
		||||
        xCAT-rmc-2.4-snap200912051911
 | 
			
		||||
        xCAT-2.4-snap200912240802
 | 
			
		||||
        xCAT-server-2.4-snap200912190921
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    #$rpms = preg_split("/\n/", $ret);
 | 
			
		||||
    echo "<table id=rpmtable style='margin-left: 30px'>";
 | 
			
		||||
    $ret = shell_exec("rpm -q xCAT");
 | 
			
		||||
    if($ret) {
 | 
			
		||||
        $verstr = substr($ret, 5);
 | 
			
		||||
        echo "<tr>";
 | 
			
		||||
        echo "<td>xCAT</td><td>$verstr</td><td></td>";
 | 
			
		||||
        echo "</tr>";
 | 
			
		||||
    }
 | 
			
		||||
    $ret = shell_exec("rpm -q xCAT-server");
 | 
			
		||||
    if($ret) {
 | 
			
		||||
        $verstr = substr($ret, 12);
 | 
			
		||||
        echo "<tr>";
 | 
			
		||||
        echo "<td>xCAT-server</td><td>$verstr</td><td></td>";
 | 
			
		||||
        echo "</tr>";
 | 
			
		||||
    }
 | 
			
		||||
    $ret = shell_exec("rpm -q xCAT-client");
 | 
			
		||||
    if($ret) {
 | 
			
		||||
        $verstr = substr($ret, 12);
 | 
			
		||||
        echo "<tr>";
 | 
			
		||||
        echo "<td>xCAT-client</td><td>$verstr</td><td></td>";
 | 
			
		||||
        echo "</tr>";
 | 
			
		||||
    }
 | 
			
		||||
    $ret = shell_exec("rpm -q perl-xCAT");
 | 
			
		||||
    if($ret) {
 | 
			
		||||
        $verstr = substr($ret, 10);
 | 
			
		||||
        echo "<tr>";
 | 
			
		||||
        echo "<td>perl-xCAT</td><td>$verstr</td><td></td>";
 | 
			
		||||
        echo "</tr>";
 | 
			
		||||
    }
 | 
			
		||||
    $ret = shell_exec("rpm -q xCAT-rmc");
 | 
			
		||||
    if($ret) {
 | 
			
		||||
        $verstr = substr($ret,9);
 | 
			
		||||
        echo "<tr>";
 | 
			
		||||
        echo "<td>xCAT-rmc</td><td>$verstr</td><td></td>";
 | 
			
		||||
        echo "</tr>";
 | 
			
		||||
    }
 | 
			
		||||
    $ret = shell_exec("rpm -q xCAT-UI");
 | 
			
		||||
    if($ret) {
 | 
			
		||||
        $verstr = substr($ret,8);
 | 
			
		||||
        echo "<tr>";
 | 
			
		||||
        echo "<td>xCAT-UI</td><td>$verstr</td><td></td>";
 | 
			
		||||
        echo "</tr>";
 | 
			
		||||
    }
 | 
			
		||||
    echo '</table>';
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,8 @@ echo <<<TOS5
 | 
			
		||||
        $("#association").dataTable({
 | 
			
		||||
            "bLengthChange": false,
 | 
			
		||||
            "bFilter": true,
 | 
			
		||||
            "bSort": true
 | 
			
		||||
            "bSort": true,
 | 
			
		||||
            "iDisplayLength": 50
 | 
			
		||||
        });
 | 
			
		||||
    </script>
 | 
			
		||||
<table>
 | 
			
		||||
@@ -331,9 +332,10 @@ echo '<div id=lseventLog>';
 | 
			
		||||
echo <<<TOS8
 | 
			
		||||
<script type="text/javascript" type"utf-8">
 | 
			
		||||
$("#lseventLog table").dataTable({
 | 
			
		||||
    "bLengthChange": true,
 | 
			
		||||
    "bFilter": true,
 | 
			
		||||
    "bSort": true
 | 
			
		||||
    "bLengthChange": false,
 | 
			
		||||
    "bFilter": false,
 | 
			
		||||
    "bSort": true,
 | 
			
		||||
    "iDisplayLength": 50
 | 
			
		||||
});
 | 
			
		||||
</script>
 | 
			
		||||
TOS8;
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ require_once "$TOPDIR/lib/functions.php";
 | 
			
		||||
require_once "$TOPDIR/lib/display.php";
 | 
			
		||||
require_once "$TOPDIR/lib/monitor_display.php";
 | 
			
		||||
 | 
			
		||||
displayMapper(array('home'=>'main.php', 'new_monitor' =>''));
 | 
			
		||||
displayMapper(array('home'=>'main.php', 'monitor plugins' =>''));
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -146,18 +146,73 @@ JS11;
 | 
			
		||||
    echo <<<ACD01
 | 
			
		||||
    <h3><a href="#">RMC Event Log</a></h3>
 | 
			
		||||
    <div>
 | 
			
		||||
    <p>TODO</p>
 | 
			
		||||
    </div>
 | 
			
		||||
ACD01;
 | 
			
		||||
    showEventInThreeHours();
 | 
			
		||||
    echo <<<ACD011
 | 
			
		||||
    <div>
 | 
			
		||||
        <div class='ui-state-highlight'>The above table shows the RMC events happened in 3 hours.<br />If you want to see more, please click the Redirect button.</div>
 | 
			
		||||
        <button class='fg-button ui-state-active ui-corner-all' onclick='loadMainPage("monitor/rmc_lsevent.php")'>Redirect</button>
 | 
			
		||||
    </div>
 | 
			
		||||
ACD011;
 | 
			
		||||
    echo <<<ACD02
 | 
			
		||||
    </div>
 | 
			
		||||
    <h3><a href="#">RMC Performance Monitoring</a></h3>
 | 
			
		||||
    <div>
 | 
			
		||||
    <p>TODO</p>
 | 
			
		||||
        <div class='ui-state-highlight'>
 | 
			
		||||
        <p>Please click the Redirect button to see the monitoring details.</p>
 | 
			
		||||
        <button class='fg-button ui-state-active' onclick='loadMainPage("monitor/rmc_monshow.php")'>Redirect</button>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
ACD02;
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function showEventInThreeHours()
 | 
			
		||||
{
 | 
			
		||||
    # display the RMC Events in three hours
 | 
			
		||||
    $datem = date("m"); //month: 01-12
 | 
			
		||||
    $dated = date("d"); //day:   01-31
 | 
			
		||||
    $dateY = date("Y"); //Year:  2009
 | 
			
		||||
    $dateh = date("h"); //hour:  01-12
 | 
			
		||||
    $datei = date("i") - 3; //minute: 01-59
 | 
			
		||||
    
 | 
			
		||||
    $Bdate = date("mdhiY", mktime($dateh, $datei, 0, $datem, $dated, $dateY));
 | 
			
		||||
    
 | 
			
		||||
    $xml = docmd("webrun", "", array("lsevent -B $Bdate"));
 | 
			
		||||
    
 | 
			
		||||
    if(getXmlErrors($xml, $error)) {
 | 
			
		||||
        echo "<p class=Error>",implode(' ', $errors), "</p>";
 | 
			
		||||
        exit;
 | 
			
		||||
    }
 | 
			
		||||
    echo "<div id='eventinthreehour'>";
 | 
			
		||||
echo <<<JS31
 | 
			
		||||
       <script type="text/javascript">
 | 
			
		||||
        $("#eventinthreehour").dataTable({
 | 
			
		||||
            "bLengthChange": false,
 | 
			
		||||
            "bFilter": true,
 | 
			
		||||
            "bSort": true,
 | 
			
		||||
            "iDisplayLength":50
 | 
			
		||||
        });
 | 
			
		||||
    </script>
 | 
			
		||||
JS31;
 | 
			
		||||
    echo "<table>";
 | 
			
		||||
    echo "<thead><tr><th width=20%>Category</th><th width=60%>Description</th><th width=20%>Time</th></tr></thead>";
 | 
			
		||||
    # parse the output
 | 
			
		||||
    foreach($xml->children() as $response) foreach($response->children() as $records) {
 | 
			
		||||
        echo "<tr>";
 | 
			
		||||
        if($records->children()) {
 | 
			
		||||
            foreach($records->children() as $data) {
 | 
			
		||||
                echo "<td>$data</td>";
 | 
			
		||||
            }
 | 
			
		||||
        }else {
 | 
			
		||||
            echo "<td>Category</td><td>Description</td><td>Time</td>";
 | 
			
		||||
        }
 | 
			
		||||
        echo "</tr>";
 | 
			
		||||
    }
 | 
			
		||||
    echo "</table>";
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function updatePluginStat($name)
 | 
			
		||||
{
 | 
			
		||||
    $xml = docmd("monls", "", array("$name"));
 | 
			
		||||
@@ -183,8 +238,13 @@ function showPluginDesc($name)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    $information = "";
 | 
			
		||||
    $order = array("\r\n","\n", "\r");
 | 
			
		||||
    $replace = '<br />';
 | 
			
		||||
    print_r($xml);
 | 
			
		||||
    echo "<br />#############<br />";
 | 
			
		||||
    foreach ($xml->children() as $response) foreach ($response->children() as $data) {
 | 
			
		||||
        $information .="<p>$data</p>";
 | 
			
		||||
        $newstr = str_replace($order, $replace, $data);
 | 
			
		||||
        $information .="<p>$newstr</p>";
 | 
			
		||||
    }
 | 
			
		||||
    echo $information;
 | 
			
		||||
}
 | 
			
		||||
@@ -274,7 +334,7 @@ function insertButtonSet($state1, $state2, $default)
 | 
			
		||||
 | 
			
		||||
function showNRTreeInput()
 | 
			
		||||
{
 | 
			
		||||
    echo "<div id=nrtree-input class='ui-state-default ui-corner-all'>";
 | 
			
		||||
    echo "<div id=nrtree-input class='ui-corner-all'>";
 | 
			
		||||
echo <<<TOS3
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
    $(function() {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										70
									
								
								xCAT-UI/rpowerstat.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								xCAT-UI/rpowerstat.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,70 @@
 | 
			
		||||
<?php
 | 
			
		||||
/* 
 | 
			
		||||
 * rpowerstat.php
 | 
			
		||||
 * display the rpower status of all nodes in the whole cluster
 | 
			
		||||
 * one graph and one table will be used to display them
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
if(!isset($TOPDIR)) { $TOPDIR=".";}
 | 
			
		||||
 | 
			
		||||
require_once "$TOPDIR/lib/security.php";
 | 
			
		||||
require_once "$TOPDIR/lib/functions.php";
 | 
			
		||||
require_once "$TOPDIR/lib/display.php";
 | 
			
		||||
require_once "$TOPDIR/lib/monitor_display.php";
 | 
			
		||||
 | 
			
		||||
$type = $_REQUEST['type'];
 | 
			
		||||
 | 
			
		||||
#if $type == "json", it will return data in json-format
 | 
			
		||||
#if $type == "table", it will return the data in one table.
 | 
			
		||||
 | 
			
		||||
#this hashed table records all the nodes with their status
 | 
			
		||||
 | 
			
		||||
$xml = docmd("rpower","all",array("stat"));
 | 
			
		||||
$nodestat_arr = array();
 | 
			
		||||
foreach($xml->children() as $response){
 | 
			
		||||
    if($response->errorcode == 0) {
 | 
			
		||||
        $key = $response->node->name;
 | 
			
		||||
        $nodestat_arr["$key"] = $response->node->data->contents;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#print_r($nodestat_arr);
 | 
			
		||||
if($type == "table") {
 | 
			
		||||
    #output the data into One table
 | 
			
		||||
    echo "<table width=100%>";
 | 
			
		||||
echo <<<TH00
 | 
			
		||||
    <thead>
 | 
			
		||||
        <tr><th width=67%>Node Name</th><th width=32%>Status</th></tr>
 | 
			
		||||
    </thead>
 | 
			
		||||
TH00;
 | 
			
		||||
    echo "<tbody>";
 | 
			
		||||
    foreach($nodestat_arr as $k => $v) {
 | 
			
		||||
        echo "<tr><td>$k</td><td>$v</td></tr>";
 | 
			
		||||
    }
 | 
			
		||||
    echo "</tbody></table>";
 | 
			
		||||
}else if($type == "json") {
 | 
			
		||||
    #Currently, we only return the numbers of nodes in different status
 | 
			
		||||
    $num_arr = array( array(label => "Operating", data => 0), array( label => "Running", data => 0), array(label => "Not Activated", data => 0), array(label => "Open Firmware", data => 0));
 | 
			
		||||
    foreach ($nodestat_arr as $k => $v) {
 | 
			
		||||
        switch ($v) {
 | 
			
		||||
        case "Operating":
 | 
			
		||||
            $num_arr[0][data]++;
 | 
			
		||||
            break;
 | 
			
		||||
        case "Running":
 | 
			
		||||
            $num_arr[1][data]++;
 | 
			
		||||
            break;
 | 
			
		||||
        case "Not Activated":
 | 
			
		||||
            $num_arr[2][data]++;
 | 
			
		||||
            break;
 | 
			
		||||
        case "Open Firmware":
 | 
			
		||||
            $num_arr[3][data]++;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    #convert the array to JSON-type
 | 
			
		||||
    #print_r($num_arr);
 | 
			
		||||
    echo json_encode($num_arr);
 | 
			
		||||
    return json_encode($num_arr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										46
									
								
								xCAT-UI/summary.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								xCAT-UI/summary.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
<?php
 | 
			
		||||
/* 
 | 
			
		||||
 * show the summary information for the cluster
 | 
			
		||||
 */
 | 
			
		||||
if(!isset($TOPDIR)) { $TOPDIR=".";}
 | 
			
		||||
 | 
			
		||||
require_once "$TOPDIR/lib/security.php";
 | 
			
		||||
require_once "$TOPDIR/lib/functions.php";
 | 
			
		||||
require_once "$TOPDIR/lib/display.php";
 | 
			
		||||
require_once "$TOPDIR/lib/monitor_display.php";
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<div id="clusterprimary">
 | 
			
		||||
    <div id="general" class="cluster_subinfo">
 | 
			
		||||
        <h5>General Information for the Management Server</h5>
 | 
			
		||||
        <?php summary_general(); ?>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div id="nodestat" class="cluster_subinfo">
 | 
			
		||||
        <h5>Power Status of nodes in the cluster</h5>
 | 
			
		||||
        <?php showNodeStat(); ?>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div id="monitor" class="cluster_subinfo">
 | 
			
		||||
        <h5>Monitor Information</h5>
 | 
			
		||||
        <?php showMonSum(); ?>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div id="update" class="cluster_subinfo">
 | 
			
		||||
        <h5>xCAT Info</h5>
 | 
			
		||||
        <?php showxCATInfo(); ?>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div id="clusternav">
 | 
			
		||||
    <h5>Options</h5>
 | 
			
		||||
    <ul style="list-style-type:none">
 | 
			
		||||
        <li><a href="#">Power control</a></li>
 | 
			
		||||
        <li<a href="#">Vitals information</a></li>
 | 
			
		||||
        <li><a href="#">OS Provision</a></li>
 | 
			
		||||
        <li><a href="#">Configure xCAT Tables</a></li>
 | 
			
		||||
        <li><a href="#">All Inverntories</a></li>
 | 
			
		||||
        <li><a href="#">Remote Commands</a></li>
 | 
			
		||||
        <li><a href="#">Monitor</a></li>
 | 
			
		||||
        <li><a href="#">Syslog</a></li>
 | 
			
		||||
        
 | 
			
		||||
    </ul>
 | 
			
		||||
</div>
 | 
			
		||||
		Reference in New Issue
	
	Block a user