diff --git a/xCAT-UI/css/main.css b/xCAT-UI/css/main.css
index 4d1d0f054..d2bbfd28c 100644
--- a/xCAT-UI/css/main.css
+++ b/xCAT-UI/css/main.css
@@ -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;
diff --git a/xCAT-UI/js/xcat.js b/xCAT-UI/js/xcat.js
index 772d436ba..11a62fcc1 100644
--- a/xCAT-UI/js/xcat.js
+++ b/xCAT-UI/js/xcat.js
@@ -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
+ //and, display
+ $("#monshow_data").empty();
+ $("#monshow_opt").show("slow");
+}
// load progress bar
myBar.loaded('xcat.js');
diff --git a/xCAT-UI/lib/monitor_display.php b/xCAT-UI/lib/monitor_display.php
index aedd55cb2..e30937d2f 100644
--- a/xCAT-UI/lib/monitor_display.php
+++ b/xCAT-UI/lib/monitor_display.php
@@ -134,7 +134,7 @@ TOS2;
echo '
';
echo 'Application Status Monitoring | ';
echo '';
- insertbuttons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>''));
+ insertButtons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>'show_monshow_data()'));
echo ' | ';
echo '
';
echo ' ';
@@ -393,4 +393,89 @@ function displayRMCAttr()
echo "
Select the RMC Resource, you will see all its available attributes here.
";
}
+
+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 "
";
+ foreach($records->children() as $data) {
+ echo "$data | ";
+ }
+ echo "
";
+ }
+}
+//displayRMCEventLog() to display the RMC event logs in one table with "tablesorter" class
+function displayRMCEvnetLog()
+{
+echo <<
+
+
+ Time |
+ Category |
+ Message |
+
+
+TOS9;
+ RMCEventLogToTable();
+ echo "";
+ //TODO: the following javascript doesn't work well.
+echo <<
+ $("table").tablesorter({ sortList: [[0,1],[1,1]] });
+
+TOS8;
+ echo " ";
+}
+
+function displayRMCMonshowAttr($attr) {
+ //TODO: should add one argument to support the noderange argument
+ echo "";
+ echo "
";
+ echo "";
+ echo "";
+ echo "Time | ";
+ echo "$attr | ";
+ echo "
";
+ echo "";
+ echo "";
+
+ //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 "";
+ $elements = explode(" ", $data);
+ echo "";
+ $i = 0;
+ while($i < 7) {
+ echo $elements[$i],"\t";
+ $i++;
+ }
+ echo " | ";
+ echo "$elements[7] | ";
+ //var_dump($elements);
+ echo "
";
+
+
+ }
+
+ echo "";
+ echo "
";
+ echo "
";
+}
+
+
?>
diff --git a/xCAT-UI/monitor/monlist.php b/xCAT-UI/monitor/monlist.php
index 229e2cd68..265b5fd30 100644
--- a/xCAT-UI/monitor/monlist.php
+++ b/xCAT-UI/monitor/monlist.php
@@ -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";
-
?>
\ No newline at end of file
diff --git a/xCAT-UI/monitor/options.php b/xCAT-UI/monitor/options.php
index 91b197710..981d47ff9 100644
--- a/xCAT-UI/monitor/options.php
+++ b/xCAT-UI/monitor/options.php
@@ -9,6 +9,7 @@ require_once "$TOPDIR/lib/monitor_display.php";
$name = $_REQUEST['name'];
+echo "";
echo "
Available Configurations for $name
";
echo '
';
@@ -49,4 +50,41 @@ if($name == "rmcmon") {
}
echo "
";
+
+echo "
";
+
+echo "";
+echo "
View Options for $name
";
+//there should be many choices for the user to view the clusters' status
+echo <<
+
+
+
+
+TOS1;
+if($name == "rmcmon") {
+ #display two rows, one for RMC event, another for RMC Resource Performance monitoring.
+ echo "";
+ echo "RMC Event Logs | ";
+ echo "";
+ insertButtons(array('label'=>'View in Text', 'id'=>'rmc_event_text', 'onclick'=>'loadMainPage("monitor/rmc_lsevent.php")'));
+ echo " | ";
+ echo "
";
+ echo "";
+ echo "RMC Resource Logs | ";
+ echo "";
+ 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 " | ";
+ echo "
";
+}
+else {
+ echo "There's no view functions for $name.
";
+}
+
+echo " ";
?>
diff --git a/xCAT-UI/monitor/rmc_lsevent.php b/xCAT-UI/monitor/rmc_lsevent.php
index 0e4d8187e..dd04669e6 100644
--- a/xCAT-UI/monitor/rmc_lsevent.php
+++ b/xCAT-UI/monitor/rmc_lsevent.php
@@ -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 '';
+displayRMCEvnetLog();
+
+echo '
';
displayStatus();
insertButtons(array('label' => 'Next', 'id'=> 'next', 'onclick'=>''));
diff --git a/xCAT-UI/monitor/rmc_monshow.php b/xCAT-UI/monitor/rmc_monshow.php
new file mode 100644
index 000000000..1637c7ef4
--- /dev/null
+++ b/xCAT-UI/monitor/rmc_monshow.php
@@ -0,0 +1,31 @@
+'main.php', 'monitor' =>''));
+
+displayTips(array("Select the domain: the whole cluser or the compute nodes under \"lpar\",","then select the desired attributes. click the \"OK\" button"));
+
+insertDiv("rmc_tree");
+
+?>
+
+
+
+";
+echo "";
+echo "";
+echo "";
+
+?>
\ No newline at end of file
diff --git a/xCAT-UI/monitor/rmc_monshow_attr_source.php b/xCAT-UI/monitor/rmc_monshow_attr_source.php
new file mode 100644
index 000000000..5d929862a
--- /dev/null
+++ b/xCAT-UI/monitor/rmc_monshow_attr_source.php
@@ -0,0 +1,136 @@
+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 <<Choose the attributes to display
+TOS0;
+show_rmc_monsetting();
+echo "";
+//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 "
";
+echo "";
+}
+
+function show_rmc_monsetting()
+{
+ echo "";
+ echo "
";
+ echo <<
+
+
+
+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 "";
+ echo "rmcmon | ";
+ echo "",substr($key, 9)," | ";
+ #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 "$arr[0] | ";
+ echo " | ";
+ echo "$comments | ";
+ echo "
";
+
+ $line++;
+ $ooe ++;
+ }
+ }
+ echo "
";
+}
+
+?>
diff --git a/xCAT-UI/monitor/rmc_monshow_data_source.php b/xCAT-UI/monitor/rmc_monshow_data_source.php
new file mode 100644
index 000000000..eb426e2ba
--- /dev/null
+++ b/xCAT-UI/monitor/rmc_monshow_data_source.php
@@ -0,0 +1,19 @@
+";
+insertButtons(array('label'=>'Back', 'id'=>'back_btn', 'onclick'=>'rmc_monshow_back_to_opts()'));
+echo "
";
+displayRMCMonshowAttr($value);
+
+
+
+?>
diff --git a/xCAT-UI/monitor/rmc_source.php b/xCAT-UI/monitor/rmc_source.php
new file mode 100644
index 000000000..b9ea7fff5
--- /dev/null
+++ b/xCAT-UI/monitor/rmc_source.php
@@ -0,0 +1,53 @@
+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);
+?>