the code for "lsevent" and "monshow" are committed;
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4088 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -328,6 +328,41 @@ padding:10px 2px;
 | 
			
		||||
    /*display: none;*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#rmc_tree {
 | 
			
		||||
    float: left;
 | 
			
		||||
    width: auto;
 | 
			
		||||
    min-height: 255px;
 | 
			
		||||
    border-right: 1px dotted #555;
 | 
			
		||||
    min-width: 130px;
 | 
			
		||||
    /*display: none;*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#rmc_monshow {
 | 
			
		||||
    float: left;
 | 
			
		||||
    width: 701px;  /*need update*/
 | 
			
		||||
    margin: 10px;
 | 
			
		||||
    padding: 10px;
 | 
			
		||||
    display: block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#mon_keys {
 | 
			
		||||
    float: left;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    display: block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#monshow_opt {
 | 
			
		||||
    float: left;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    display: block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#monshow_data {
 | 
			
		||||
    float: left;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    display: block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#tips  {
 | 
			
		||||
    margin-right: 10px;
 | 
			
		||||
    margin-left: 10px;
 | 
			
		||||
@@ -422,11 +457,20 @@ padding:10px 2px;
 | 
			
		||||
 | 
			
		||||
#options {
 | 
			
		||||
    width: 880px;
 | 
			
		||||
    margin: 5px;
 | 
			
		||||
    padding: 5px;
 | 
			
		||||
    margin: 10px;
 | 
			
		||||
    padding: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#monconfig {
 | 
			
		||||
    width: 48%;
 | 
			
		||||
    float: left;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#monview {
 | 
			
		||||
    width: 48%;
 | 
			
		||||
    float: right;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#plugin_desc {
 | 
			
		||||
    width: 880px;
 | 
			
		||||
    margin: 5px;
 | 
			
		||||
 
 | 
			
		||||
@@ -328,7 +328,8 @@ function changeProf(){
 | 
			
		||||
		// debug this.  If you do, please make this code easier to read.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//added for display the tree for
 | 
			
		||||
//added for display the tree
 | 
			
		||||
// TODO: there're still issues here.
 | 
			
		||||
function init_ositree(){
 | 
			
		||||
    //display all the nodes with OSI type
 | 
			
		||||
    nrtree = new tree_component();  //-tree begin
 | 
			
		||||
@@ -343,6 +344,45 @@ function init_ositree(){
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//function updatermcnr()
 | 
			
		||||
//{
 | 
			
		||||
//    myselection = nrtree.selected_arr;
 | 
			
		||||
//
 | 
			
		||||
//    for (node in myselection) {
 | 
			
		||||
//        $("#rmc_monshow").html($("#rmc_monshow").html()+node);
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//}
 | 
			
		||||
 | 
			
		||||
//update the osi tree used in
 | 
			
		||||
function init_rmc_ositree() {
 | 
			
		||||
    nrtree = new tree_component();  //-tree begin
 | 
			
		||||
    nrtree.init($("#rmc_tree"),{
 | 
			
		||||
        rules: { multiple: "Ctrl" },
 | 
			
		||||
        ui: { animation: 250 },
 | 
			
		||||
        callback: {
 | 
			
		||||
            onchange: function(n) {
 | 
			
		||||
                if(n.id) {
 | 
			
		||||
                    if($(n).parent().parent().attr("id") == ",lpar") {
 | 
			
		||||
                        //parse the id, then display the "monshow" data for selected noderange
 | 
			
		||||
                        $.get("monitor/rmc_monshow_attr_source.php", {id: n.id}, function(data) {
 | 
			
		||||
                            //display the "monshow" result
 | 
			
		||||
                            $("#monshow_opt").html(data);
 | 
			
		||||
                        });
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        //http://jstree.com/reference/_examples/3_callbacks.html
 | 
			
		||||
        //onchange is used to
 | 
			
		||||
        data : {
 | 
			
		||||
            type: "json",
 | 
			
		||||
            async: "true",
 | 
			
		||||
            url: "monitor/rmc_source.php"
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//node_stat_control() can enable/disable nodestatmon for the selected plugin
 | 
			
		||||
function node_stat_control(plugin)
 | 
			
		||||
{
 | 
			
		||||
@@ -467,7 +507,22 @@ function monsetupAction(plugin, action_val)
 | 
			
		||||
       
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
function show_monshow_data() {
 | 
			
		||||
    //used for the OK button in the web page "rmc_monshow.php";
 | 
			
		||||
    $("#monshow_opt").hide("slow");
 | 
			
		||||
    $(":input[@checked]").each(function(i) {
 | 
			
		||||
        $.get("monitor/rmc_monshow_data_source.php", {value: $(this).attr("value")}, function(data) {
 | 
			
		||||
            $("#monshow_data").append(data);
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function rmc_monshow_back_to_opts() {
 | 
			
		||||
    //clear the <div id='monshow_data'>
 | 
			
		||||
    //and, display <div id='monshow_opts'>
 | 
			
		||||
    $("#monshow_data").empty();
 | 
			
		||||
    $("#monshow_opt").show("slow");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// load progress bar
 | 
			
		||||
myBar.loaded('xcat.js');
 | 
			
		||||
 
 | 
			
		||||
@@ -134,7 +134,7 @@ TOS2;
 | 
			
		||||
    echo '<tr class="ListLine1">';
 | 
			
		||||
    echo '<td>Application Status Monitoring</td>';
 | 
			
		||||
    echo '<td>';
 | 
			
		||||
    insertbuttons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>''));
 | 
			
		||||
    insertButtons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>'show_monshow_data()'));
 | 
			
		||||
    echo '</td>';
 | 
			
		||||
    echo '</tr>';
 | 
			
		||||
    echo '</tbody> </table> </div>';
 | 
			
		||||
@@ -393,4 +393,89 @@ function displayRMCAttr()
 | 
			
		||||
    echo "<p>Select the RMC Resource, you will see all its available attributes here.</p>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function RMCEventLogToTable()
 | 
			
		||||
{
 | 
			
		||||
    $xml = docmd("webrun", "", array("lsevent"));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //var_dump($xml);
 | 
			
		||||
    foreach($xml->children() as $response) foreach($response->children() as $records)
 | 
			
		||||
    {
 | 
			
		||||
        //$data should be one array to store all the RMC event log.
 | 
			
		||||
        echo "<tr>";
 | 
			
		||||
        foreach($records->children() as $data) {
 | 
			
		||||
            echo "<td>$data</td>";
 | 
			
		||||
        }
 | 
			
		||||
        echo "</tr>";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
//displayRMCEventLog() to display the RMC event logs in one table with "tablesorter" class
 | 
			
		||||
function displayRMCEvnetLog()
 | 
			
		||||
{
 | 
			
		||||
echo <<<TOS9
 | 
			
		||||
<table class="tablesorter" cellspacing="1">
 | 
			
		||||
<thead>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <th>Time</th>
 | 
			
		||||
        <th>Category</th>
 | 
			
		||||
        <th>Message</th>
 | 
			
		||||
</thead>
 | 
			
		||||
<tbody>
 | 
			
		||||
TOS9;
 | 
			
		||||
    RMCEventLogToTable();
 | 
			
		||||
    echo "</tbody></table>";
 | 
			
		||||
    //TODO: the following javascript doesn't work well.
 | 
			
		||||
echo <<<TOS8
 | 
			
		||||
<script type="text/javascript" type"utf-8">
 | 
			
		||||
 $("table").tablesorter({ sortList:  [[0,1],[1,1]] });
 | 
			
		||||
</script>
 | 
			
		||||
TOS8;
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function displayRMCMonshowAttr($attr) {
 | 
			
		||||
    //TODO: should add one argument to support the noderange argument
 | 
			
		||||
    echo "<div>";
 | 
			
		||||
    echo "<table class='tablesorter' cellspacing='1'>";
 | 
			
		||||
    echo "<thead>";
 | 
			
		||||
    echo "<tr>";
 | 
			
		||||
    echo "<td>Time</td>";
 | 
			
		||||
    echo "<td>$attr</td>";
 | 
			
		||||
    echo "</tr>";
 | 
			
		||||
    echo "</thead>";
 | 
			
		||||
    echo "<tbody>";
 | 
			
		||||
 | 
			
		||||
    //get all the data by the command "monshow"
 | 
			
		||||
    $xml = docmd("monshow", "", array("rmcmon", "-s", "-t", "10", "-a", "$attr"));
 | 
			
		||||
    //the error handling is skipped
 | 
			
		||||
    $index = 0;
 | 
			
		||||
    foreach($xml->children() as $response) foreach($response->children() as $data) {
 | 
			
		||||
        //handle the data here
 | 
			
		||||
        //skip the first 3 lines
 | 
			
		||||
        if($index++ < 3) {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        echo "<tr>";
 | 
			
		||||
        $elements = explode(" ", $data);
 | 
			
		||||
        echo "<td>";
 | 
			
		||||
        $i = 0;
 | 
			
		||||
        while($i < 7) {
 | 
			
		||||
            echo $elements[$i],"\t";
 | 
			
		||||
            $i++;
 | 
			
		||||
        }
 | 
			
		||||
        echo "</td>";
 | 
			
		||||
        echo "<td>$elements[7]</td>";
 | 
			
		||||
        //var_dump($elements);
 | 
			
		||||
        echo "</tr>";
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    echo "</tbody>";
 | 
			
		||||
    echo "</table>";
 | 
			
		||||
    echo "</div>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,6 @@ if(!isset($TOPDIR)) { $TOPDIR="..";}
 | 
			
		||||
 require_once "$TOPDIR/lib/functions.php";
 | 
			
		||||
 require_once "$TOPDIR/lib/display.php";
 | 
			
		||||
 require_once "$TOPDIR/lib/monitor_display.php";
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
@@ -20,5 +19,4 @@ insertDiv("plugin_desc");
 | 
			
		||||
 | 
			
		||||
insertDiv("options");
 | 
			
		||||
 | 
			
		||||
insetDiv("view");   //display options to the users for viewing event log & performance in text/graphics format
 | 
			
		||||
?>
 | 
			
		||||
@@ -9,6 +9,7 @@ require_once "$TOPDIR/lib/monitor_display.php";
 | 
			
		||||
 | 
			
		||||
$name = $_REQUEST['name'];
 | 
			
		||||
 | 
			
		||||
echo "<div id='monconfig'>";
 | 
			
		||||
echo "<p>Available Configurations for  <b>$name</b></p>";
 | 
			
		||||
 | 
			
		||||
echo '<table id="tabTable" class="tabTable" cellspacing="1">';
 | 
			
		||||
@@ -49,4 +50,41 @@ if($name == "rmcmon") {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
echo "</tbody></table>";
 | 
			
		||||
 | 
			
		||||
echo "</div>";
 | 
			
		||||
 | 
			
		||||
echo "<div id='monview'>";
 | 
			
		||||
echo "<p>View Options for <b>$name</b></p>";
 | 
			
		||||
//there should be many choices for the user to view the clusters' status
 | 
			
		||||
echo <<<TOS1
 | 
			
		||||
<table id="view_tab" class="tabTable" cellspacing="1">
 | 
			
		||||
<thead>
 | 
			
		||||
    <tr class='colHeaders'>
 | 
			
		||||
        <td>Monitor Items</td>
 | 
			
		||||
        <td>Display Formats</td>
 | 
			
		||||
    </tr>
 | 
			
		||||
</thead>
 | 
			
		||||
<tbody>
 | 
			
		||||
TOS1;
 | 
			
		||||
if($name == "rmcmon") {
 | 
			
		||||
    #display two rows, one for RMC event, another for RMC Resource Performance monitoring.
 | 
			
		||||
    echo "<tr class='ListLine0' id='row0'>";
 | 
			
		||||
    echo "<td>RMC Event Logs</td>";
 | 
			
		||||
    echo "<td>";
 | 
			
		||||
    insertButtons(array('label'=>'View in Text', 'id'=>'rmc_event_text', 'onclick'=>'loadMainPage("monitor/rmc_lsevent.php")'));
 | 
			
		||||
    echo "</td>";
 | 
			
		||||
    echo "</tr>";
 | 
			
		||||
    echo "<tr class='ListLine1' id='row1'>";
 | 
			
		||||
    echo "<td>RMC Resource Logs</td>";
 | 
			
		||||
    echo "<td>";
 | 
			
		||||
    insertButtons(array('label'=>'View in Text', 'id'=>'rmc_resrc_text', 'onclick'=>'loadMainPage("monitor/rmc_monshow.php")'));
 | 
			
		||||
    insertButtons(array('label'=>'View in Graphics', 'id'=>'rmc_resrc_graph', 'onclick'=>''));
 | 
			
		||||
    echo "</td>";
 | 
			
		||||
    echo "</tr>";
 | 
			
		||||
}
 | 
			
		||||
else {
 | 
			
		||||
    echo "<p>There's no view functions for $name.</p>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
echo "</tbody></table></div>";
 | 
			
		||||
?>
 | 
			
		||||
 
 | 
			
		||||
@@ -17,9 +17,14 @@ $name = $_REQUEST['name'];
 | 
			
		||||
 | 
			
		||||
displayMapper(array('home'=>'main.php', 'monitor' =>''));
 | 
			
		||||
 | 
			
		||||
displayTips(array(""));
 | 
			
		||||
displayTips(array("View all RMC events here","TODO"));
 | 
			
		||||
 | 
			
		||||
//Following the "Syslog Entries" web page
 | 
			
		||||
echo '<div class="mContent">';
 | 
			
		||||
 | 
			
		||||
displayRMCEvnetLog();
 | 
			
		||||
 | 
			
		||||
echo '</div>';
 | 
			
		||||
displayStatus();
 | 
			
		||||
 | 
			
		||||
insertButtons(array('label' => 'Next', 'id'=> 'next', 'onclick'=>''));
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										31
									
								
								xCAT-UI/monitor/rmc_monshow.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								xCAT-UI/monitor/rmc_monshow.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
<?php
 | 
			
		||||
/* 
 | 
			
		||||
 * use the xCAT command "monshow" to display the current status for RMC Resources being monitored
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
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";
 | 
			
		||||
 | 
			
		||||
displayMapper(array('home'=>'main.php', 'monitor' =>''));
 | 
			
		||||
 | 
			
		||||
displayTips(array("Select the domain: the whole cluser or the compute nodes under \"<b>lpar</b>\",","then select the desired attributes. click the \"OK\" button"));
 | 
			
		||||
 | 
			
		||||
insertDiv("rmc_tree");
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
    $(init_rmc_ositree());
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
echo "<div id='rmc_monshow'>";
 | 
			
		||||
echo "<div id='monshow_opt'></div>";
 | 
			
		||||
echo "<div id='monshow_data'></div>";
 | 
			
		||||
echo "</div>";
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										136
									
								
								xCAT-UI/monitor/rmc_monshow_attr_source.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								xCAT-UI/monitor/rmc_monshow_attr_source.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,136 @@
 | 
			
		||||
<?php
 | 
			
		||||
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";
 | 
			
		||||
 | 
			
		||||
//$id is the sel
 | 
			
		||||
$id = $_REQUEST['id'];
 | 
			
		||||
$id = preg_replace('/^,/', '', $id);
 | 
			
		||||
 | 
			
		||||
//TODO: now it only supports one single node
 | 
			
		||||
 | 
			
		||||
//check whether the node is "osi" type or not
 | 
			
		||||
//using the command = webrun "lsdef -t node $id -i nodetype"
 | 
			
		||||
$xml = docmd("webrun", "", array("lsdef $id -i nodetype"));
 | 
			
		||||
//no error message will be returned
 | 
			
		||||
 | 
			
		||||
foreach($xml->children() as $response) foreach($response->children() as $data) {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
if(false !== strpos($data, "lpar")) {
 | 
			
		||||
    //display the options for the "monshow" command
 | 
			
		||||
 | 
			
		||||
    show_monshow_options();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function show_monshow_options()
 | 
			
		||||
{
 | 
			
		||||
echo <<<TOS0
 | 
			
		||||
<b>Choose the attributes to display</b>
 | 
			
		||||
TOS0;
 | 
			
		||||
show_rmc_monsetting();
 | 
			
		||||
echo "<div>";
 | 
			
		||||
//click the "OK" button, "monshow" data for the selected attributes will display
 | 
			
		||||
insertButtons(array('label'=>'OK', 'id'=>'monshow_ok_btn', 'onclick'=>'show_monshow_data()'));
 | 
			
		||||
echo "</div>";
 | 
			
		||||
echo "</div>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function show_rmc_monsetting()
 | 
			
		||||
{
 | 
			
		||||
    echo "<div id='mon_keys'>";
 | 
			
		||||
    echo "<table class='tabTable' cellspacing='1'>";
 | 
			
		||||
    echo <<<TOS1
 | 
			
		||||
<thead>
 | 
			
		||||
<tr class="colHeaders">
 | 
			
		||||
<td>name</td>
 | 
			
		||||
<td>key</td>
 | 
			
		||||
<td>value</td>
 | 
			
		||||
<td>comments</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
<tbody>
 | 
			
		||||
TOS1;
 | 
			
		||||
    $xml = docmd("tabdump", "", array("monsetting"));
 | 
			
		||||
    $ooe = 0;
 | 
			
		||||
    $line = 0;
 | 
			
		||||
    foreach($xml->children() as $response) foreach($response->children() as $data)
 | 
			
		||||
    {
 | 
			
		||||
        #the var #data is one string like this:
 | 
			
		||||
        #"rmcmon","rmetrics_IBM.Host","PctTotalTimeIdle:1",,
 | 
			
		||||
        #to use "," as the splitter is wrong.
 | 
			
		||||
        #list($name, $key, $value,$comments, $disable) = preg_split('/,/',$data);
 | 
			
		||||
        if($data[0] == '#') {
 | 
			
		||||
            continue;
 | 
			
		||||
        }else {
 | 
			
		||||
            #parse the data
 | 
			
		||||
            $substr = strstr($data, "\","); #remove the $name, it is "rmcmon" now.
 | 
			
		||||
            $substr = substr($substr, 2);
 | 
			
		||||
 | 
			
		||||
            $index = strpos($substr, ',');
 | 
			
		||||
            $key = substr($substr, 1, $index-2);
 | 
			
		||||
 | 
			
		||||
            if(preg_match('/^rmetrics_/', $key) == 0) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $substr = substr($substr, $index+2);
 | 
			
		||||
 | 
			
		||||
            $index = strpos($substr, '"');
 | 
			
		||||
            $value = substr($substr, 0, $index);
 | 
			
		||||
 | 
			
		||||
            $substr = substr($substr, $index+2);
 | 
			
		||||
            #the left string contains {$comments,$disable};
 | 
			
		||||
 | 
			
		||||
            $index = strpos($substr, ',');
 | 
			
		||||
            if($index == 0) {
 | 
			
		||||
                #it means the $comments is empty
 | 
			
		||||
                $comments = '';
 | 
			
		||||
            } else {
 | 
			
		||||
                $comments = substr($substr, 1, $index -2);
 | 
			
		||||
            }
 | 
			
		||||
            $substr = substr($substr, $index+1);
 | 
			
		||||
            #the left string contains {$disable};
 | 
			
		||||
            if(strlen($substr)) {
 | 
			
		||||
                #not empty
 | 
			
		||||
                $index = strpos($substr, '"', 1);
 | 
			
		||||
                $disable = substr($substr, 1, $index-1);
 | 
			
		||||
                #the RMC key is disabled, so it's skipped
 | 
			
		||||
                continue;
 | 
			
		||||
            } else {
 | 
			
		||||
                $disable = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #the left lines are the contents of "monsetting"
 | 
			
		||||
            $ooe %= 2;
 | 
			
		||||
            echo "<tr class='ListLine$ooe' id='row$line'>";
 | 
			
		||||
            echo "<td>rmcmon</td>";
 | 
			
		||||
            echo "<td>",substr($key, 9),"</td>";
 | 
			
		||||
            #parset the var $value, the format looks like this:
 | 
			
		||||
            #           RecByteRate,$ecPacketRate:1
 | 
			
		||||
            #all the attributes are separated by comma,
 | 
			
		||||
            #the integer after ":" is the time interval
 | 
			
		||||
            $arr = explode(":",$value);
 | 
			
		||||
            $attrs = explode(",", $arr[0]);
 | 
			
		||||
//            echo "<td>$arr[0]</td>";
 | 
			
		||||
            echo "<td><form>";
 | 
			
		||||
            foreach ($attrs as $attr) {
 | 
			
		||||
                if($attr) {
 | 
			
		||||
                    echo "<input type='checkbox' name='attr_$key' value='$attr' />$attr<br/>";
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            echo"</form></td>";
 | 
			
		||||
            echo "<td>$comments</td>";
 | 
			
		||||
            echo "</tr>";
 | 
			
		||||
 | 
			
		||||
            $line++;
 | 
			
		||||
            $ooe ++;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    echo "</tbody></table>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										19
									
								
								xCAT-UI/monitor/rmc_monshow_data_source.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								xCAT-UI/monitor/rmc_monshow_data_source.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
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";
 | 
			
		||||
 | 
			
		||||
$value = $_REQUEST['value'];
 | 
			
		||||
 | 
			
		||||
echo "<div>";
 | 
			
		||||
insertButtons(array('label'=>'Back', 'id'=>'back_btn', 'onclick'=>'rmc_monshow_back_to_opts()'));
 | 
			
		||||
echo "</div>";
 | 
			
		||||
displayRMCMonshowAttr($value);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										53
									
								
								xCAT-UI/monitor/rmc_source.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								xCAT-UI/monitor/rmc_source.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
// Gets the nodes and groups for group/node js widget
 | 
			
		||||
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";
 | 
			
		||||
 | 
			
		||||
require_once "$TOPDIR/js/jsonwrapper.php";
 | 
			
		||||
    if (isset($_GET['id'])) {
 | 
			
		||||
        $id = $_GET['id'];
 | 
			
		||||
    }
 | 
			
		||||
    if ($id == "0") {
 | 
			
		||||
        $id = '/.*';
 | 
			
		||||
    } else {
 | 
			
		||||
        $id=preg_replace('/^,/','',$id);
 | 
			
		||||
    }
 | 
			
		||||
    $rvals=docmd('extnoderange',$id,array('subgroups'));
 | 
			
		||||
    $parents=array();
 | 
			
		||||
    $root=1;
 | 
			
		||||
    if ($id == '/.*') {
 | 
			
		||||
        $id=',';
 | 
			
		||||
    } else {
 | 
			
		||||
        $parents=split("@",$id);
 | 
			
		||||
        $id=",$id@";
 | 
			
		||||
        $root=0;
 | 
			
		||||
    }
 | 
			
		||||
    //unset($rvals->xcatresponse->serverdone[0]);
 | 
			
		||||
    $numsubgroups=count($rvals->xcatresponse->intersectinggroups);
 | 
			
		||||
    $numnodes=count($rvals->xcatresponse->node);
 | 
			
		||||
    $jdata=array();
 | 
			
		||||
    if ($numnodes >= $numsubgroups) { #If there are few enough subgroups to be helpful filters, add them in
 | 
			
		||||
        foreach ($rvals->xcatresponse->intersectinggroups as $group) {
 | 
			
		||||
            if (! in_array("$group",$parents)) {
 | 
			
		||||
            $jdata[]= array("data"=>"$group",
 | 
			
		||||
                            "attributes"=>array("id"=>"$id$group",
 | 
			
		||||
                                                "rel"=>'group'),
 | 
			
		||||
                            "state"=>'closed');
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    } #If there were more groups than nodes, leave the signal to noise ratio down
 | 
			
		||||
    if ($root==0) {
 | 
			
		||||
    foreach ($rvals->xcatresponse->node as $node) {
 | 
			
		||||
        $jdata[] = array("data"=>"$node",
 | 
			
		||||
                         "attributes"=>array("id"=>",$node",
 | 
			
		||||
                                             "rel"=>'node'));
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
#    header('Content-type: text/html');
 | 
			
		||||
    echo json_encode($jdata);
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user