diff --git a/xCAT-UI/css/main.css b/xCAT-UI/css/main.css
index 3dd224374..4d1d0f054 100644
--- a/xCAT-UI/css/main.css
+++ b/xCAT-UI/css/main.css
@@ -363,6 +363,7 @@ padding:10px 2px;
float:left;
display: block;
width: 720px;
+ border-bottom: 1px dotted #555;
}
#avail_cond {
width: 275px;
@@ -418,3 +419,19 @@ padding:10px 2px;
float: left;
background-color:silver;
}
+
+#options {
+ width: 880px;
+ margin: 5px;
+ padding: 5px;
+ float: left;
+}
+
+#plugin_desc {
+ width: 880px;
+ margin: 5px;
+ padding: 5px;
+ float: left;
+ background-color:#FAF8CC;
+ text-align: left;
+}
\ No newline at end of file
diff --git a/xCAT-UI/js/xcat.js b/xCAT-UI/js/xcat.js
index 6ef7891b4..a935e2fee 100644
--- a/xCAT-UI/js/xcat.js
+++ b/xCAT-UI/js/xcat.js
@@ -406,6 +406,25 @@ function mkCondResp()
}
}
+function control_RMCAssoc(cond, node, resp, action)
+{
+ //TODO:for define_rmc_event
+ //control the RMC Association: startcondresp & stopcondresp;
+ $.get("monitor/updateCondResp.php",
+ {c: cond, n: node, r: resp, a: action},
+ function(data) {
+ $("#association").html(data);
+ }
+ );
+}
+
+function clearEventDisplay()
+{
+ $('input[@name=conditions][@checked]').attr('checked', false);
+ $('input[@name=responses][@checked]').attr('checked', false);
+}
+
+
function showRMCAttrib()
{
var class_val = $('input[@name=classGrp][@checked]').val();
@@ -430,5 +449,26 @@ function monsetupAction(plugin, action_val)
});
}
+function showPluginOptions()
+{
+ //for monlist.php, when the user clicks the radiobox, the available options for the plugin will display
+ $("input[@name=plugins]").click(function() {
+ //when one radiobox is selected, the #options
is show available options to the user
+ var plugin = $(this).attr('value');
+ $.get("monitor/options.php", {name:plugin},function(data) {
+ $("#options").html(data);
+ });
+ });
+}
+
+function showPluginDescription()
+{
+ $(".description").click(function(){
+ $.get("monitor/plugin_desc.php", {name: $(this).text()}, function(data){
+ $("#plugin_desc").html(data);
+ })
+ });
+}
+
// load progress bar
myBar.loaded('xcat.js');
diff --git a/xCAT-UI/lib/monitor_display.php b/xCAT-UI/lib/monitor_display.php
index 182bf148e..a228edfb2 100644
--- a/xCAT-UI/lib/monitor_display.php
+++ b/xCAT-UI/lib/monitor_display.php
@@ -77,11 +77,9 @@ function displayTips($tips)
return 0;
}
-function displayDialog($id, $title)
+function insertDiv($id)
{
- //add one new
to display jQuery dialog;
- echo "
";
- return 0;
+ echo "
";
}
function displayMonTable()
@@ -183,6 +181,7 @@ echo <<
Response
Node |
State |
+ Action |
@@ -213,6 +212,13 @@ TOS5;
echo "$resp | ";
echo "$node | ";
echo "$state | ";
+ echo "";
+ if($state == "Active") {
+ insertButtons(array('label'=>'DeActivate', 'id'=>'deactivate', 'onclick'=>"control_RMCAssoc(\"$cond\", \"$node\", \"$resp\", \"stop\")"));
+ }else if($state == "Not active"){
+ insertButtons(array('label'=>'Activate', 'id'=>'activate', 'onclick'=>"control_RMCAssoc(\"$cond\", \"$node\", \"$resp\", \"start\")"));
+ }
+ echo " | ";
echo "";
$ooe++;
$line++;
@@ -298,7 +304,7 @@ function displayCondResp()
displayCond();
displayResp();
insertButtons(array('label'=>'Add', id=>'addAssociation', 'onclick'=>'mkCondResp()'));
- insertButtons(array('label'=>'Cancel', id=>'cancel_op', 'onclick'=>''));
+ insertButtons(array('label'=>'Cancel', id=>'cancel_op', 'onclick'=>'clearEventDisplay()'));
echo '';
displayStatus();
}
diff --git a/xCAT-UI/monitor/makecondresp.php b/xCAT-UI/monitor/makecondresp.php
index a9d3f20b5..015987304 100644
--- a/xCAT-UI/monitor/makecondresp.php
+++ b/xCAT-UI/monitor/makecondresp.php
@@ -10,8 +10,8 @@ require_once "$TOPDIR/lib/functions.php";
require_once "$TOPDIR/lib/display.php";
require_once "$TOPDIR/lib/monitor_display.php";
-$cond = $_REQUEST["cond"];
-$resp = $_REQUEST["resp"];
+$cond = '"' . $_REQUEST["cond"] . '"';
+$resp = '"' . $_REQUEST["resp"] . '"';
$xml=docmd("webrun", '', array("mkcondresp $cond $resp"));
if(getXmlErrors($xml, $errors)) {
diff --git a/xCAT-UI/monitor/monlist.php b/xCAT-UI/monitor/monlist.php
index 82e003df8..9881db183 100644
--- a/xCAT-UI/monitor/monlist.php
+++ b/xCAT-UI/monitor/monlist.php
@@ -7,34 +7,19 @@ if(!isset($TOPDIR)) { $TOPDIR="/opt/xcat/ui";}
?>
'main.php', 'monitor'=>'monitor/monlist.php'));
displayTips(array("Click the name of each plugin, you can get the plugin's description.",
- "You can also select one plugin, then you can set node/application status monitoring for the selected plugin"));
+ "Select one plugin, choose the options for set up monitoring ",
+ "Click the button \"Start\", \"Stop\" or \"Restart\" to setup monitoring plugin"));
displayMonTable();
-displayDialog("dialog", "Plug-in Description");
-insertButtons(array('label' => 'Next', 'id'=> 'next', 'onclick'=>'clickNext()'));
-?>
+insertDiv("plugin_desc");
+
+insertDiv("options");
+?>
\ No newline at end of file
diff --git a/xCAT-UI/monitor/options.php b/xCAT-UI/monitor/options.php
new file mode 100644
index 000000000..d319cdff0
--- /dev/null
+++ b/xCAT-UI/monitor/options.php
@@ -0,0 +1,52 @@
+Available Configurations for $name";
+
+echo '';
+echo "";
+
+//set up the options for the plugin with the name "$name"
+if($name == "rmcmon") {
+ //node status monitor, RMC events, RMC resources
+ echo "";
+ echo "Node/Application Status Monitoring Setting | ";
+ echo "";
+ insertButtons(array('label'=>'Configure', 'id'=>'rmc_nodestatmon', 'onclick'=>'loadMainPage("monitor/stat_mon.php?name=rmcmon")'));
+ echo " | ";
+ echo "
";
+
+ echo "";
+ echo "RMC Events Monitoring Setting | ";
+ echo "";
+ insertButtons(array('label'=>'Configure', 'id'=>'rmc_event', 'onclick'=>'loadMainPage("monitor/rmc_event_define.php")'));
+ echo " | ";
+ echo "
";
+
+ echo "";
+ echo "RMC Resource Monitoring Setting | ";
+ echo "";
+ insertButtons(array('label'=>'Configure', 'id'=>'rmc_resource', 'onclick'=>'loadMainPage("monitor/rmc_resource_define.php")'));
+ echo " | ";
+ echo "
";
+
+} else {
+ //there's only "node status monitoring" is enabled
+ echo "";
+ echo "Node/Application Status Monitoring Setting | ";
+ echo "";
+ insertButtons(array('label'=>'Configure', 'id'=>$name."_nodestatmon", 'onclick'=>"loadMainPage(\"monitor/stat_mon.php?name=$name\")"));
+ echo " | ";
+ echo "
";
+}
+
+echo "
";
+?>
diff --git a/xCAT-UI/monitor/plugin_desc.php b/xCAT-UI/monitor/plugin_desc.php
index 5bcbd360f..e961b42b4 100644
--- a/xCAT-UI/monitor/plugin_desc.php
+++ b/xCAT-UI/monitor/plugin_desc.php
@@ -3,8 +3,7 @@ if(!isset($TOPDIR)) { $TOPDIR="/opt/xcat/ui";}
require_once "$TOPDIR/lib/security.php";
require_once "$TOPDIR/lib/functions.php";
require_once "$TOPDIR/lib/display.php";
-?>
-children() as $response) foreach ($response->children() as $data)
$information .= "\n
";
//print_r($data);
}
+echo "";
echo $information;
+echo "
";
?>
diff --git a/xCAT-UI/monitor/rmc_event_define.php b/xCAT-UI/monitor/rmc_event_define.php
index 841be8c18..0efbdc96d 100644
--- a/xCAT-UI/monitor/rmc_event_define.php
+++ b/xCAT-UI/monitor/rmc_event_define.php
@@ -2,7 +2,7 @@
/*
* rmc_event_define.php
* to define the events for RMC
- * the url is: monitor/rmc_event_define.php?
+ * the url is: monitor/rmc_event_define.php
*/
if(!isset($TOPDIR)) { $TOPDIR="/opt/xcat/ui";}
@@ -17,13 +17,10 @@ displayMapper_mon(array('home'=>'main.php', 'monitor'=>'monitor/monlist.php'));
displayTips(array(
"All the conditions and the responses are here;",
"Use \"mkcondition\" and \"mkresponse\" to create new conditions and new responses",
- "Select the noderange, select the condition, and the response,",
- "then, click \"Save\" to create condition/response associations."
- ));
+ "Select the condition, and response to create condition/response association"
+ ));
displayOSITree();
displayCondResp();
-insertButtons(array('label'=>'Next', id=>'next', 'onclick'=>'loadMainPage("monitor/rmc_resource_define.php")'));
-
?>
diff --git a/xCAT-UI/monitor/rmc_resource_define.php b/xCAT-UI/monitor/rmc_resource_define.php
index f3d813302..db67f4c65 100644
--- a/xCAT-UI/monitor/rmc_resource_define.php
+++ b/xCAT-UI/monitor/rmc_resource_define.php
@@ -18,15 +18,17 @@ displayTips(array("All the available RMC resources are listed here;",
displayMonsetting();
-?>
-
+echo '';
+echo '
';
+displayRMCRsrc();
+echo '
';
+echo '
';
+displayRMCAttr();
+echo '
';
+echo '
';
-
-'Next', 'id'=>'next', 'onclick'=>'loadMainPage("monitor/monlist.php");'));
-?>
+displayStatus();
+
+?>
\ No newline at end of file
diff --git a/xCAT-UI/monitor/setup.php b/xCAT-UI/monitor/setup.php
index c51985877..14777caf7 100644
--- a/xCAT-UI/monitor/setup.php
+++ b/xCAT-UI/monitor/setup.php
@@ -64,7 +64,7 @@ function monrestart($plugin, $nmstat)
function monstart($plugin, $nmstat)
{
- //before starting the $plugin,
+ //TODO:before starting the $plugin,
//we have to make sure that the plugin is added in the "monitoring" table
$xml = docmd("monstart", "", array("$plugin", "-r"));
return 0;
diff --git a/xCAT-UI/monitor/stat_mon.php b/xCAT-UI/monitor/stat_mon.php
index d3ac95d75..2bdd450d5 100644
--- a/xCAT-UI/monitor/stat_mon.php
+++ b/xCAT-UI/monitor/stat_mon.php
@@ -16,7 +16,7 @@ $name = $_REQUEST['name'];
displayMapper_mon(array('home'=>'main.php', 'monitor'=>'monitor/monlist.php'));
displayTips(array(
"Enable/disable Node/App Status Monitoring by clicking the button",
- "Click the \"Next\" button to define Events for the desired plug-in"));
+ "In order to take affect, you have to START/RESTART the desired plugin"));
//get the current status for "node-status-monitor"
$xml = docmd("monls", ' ', array($name));
@@ -42,5 +42,5 @@ display_stat_mon_table(array("$name"=>
displayStatus();
-insertButtons(array('label'=>'Next', id=>'next', 'onclick'=>'loadMainPage("monitor/monlist.php")'));
+//insertButtons(array('label'=>'Next', id=>'next', 'onclick'=>'loadMainPage("monitor/monlist.php")'));
?>
diff --git a/xCAT-UI/monitor/updateCondResp.php b/xCAT-UI/monitor/updateCondResp.php
new file mode 100644
index 000000000..c347d5db5
--- /dev/null
+++ b/xCAT-UI/monitor/updateCondResp.php
@@ -0,0 +1,83 @@
+;
+if(!isset($TOPDIR)) { $TOPDIR="/opt/xcat/ui";}
+
+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";
+
+$cond = '"' . $_REQUEST['c'] . '"';
+$node = '"' . $_REQUEST['n'] . '"';
+$resp = '"' . $_REQUEST['r'] . '"';
+$action = $_REQUEST['a'];
+
+if($action == "start") {
+ $xml = docmd("webrun", "", array("startcondresp $cond $resp"));
+}else if($action == "stop") {
+ $xml = docmd("webrun", "", array("stopcondresp $cond $resp"));
+}
+
+if(getXmlErrors($xml,$errors)) {
+ echo "",implode(' ', $errors), "
";
+ exit;
+}
+
+//the following code is copied from displayAssociation() in the file: monitor_display.php
+echo <<Available Condition/Response Associations
+
+
+
+
+
+TOS5;
+$xml = docmd("webrun", "", array("lscondresp"));
+if(getXmlErrors($xml,$errors)) {
+ echo "",implode(' ', $errors), "
";
+ exit;
+}
+//get all the condition&response associations for RMC
+foreach ($xml->children() as $response) foreach($response->children() as $data) {
+ //get the data from xcatd
+ $association = explode("=", $data);
+
+ $ooe = 0;
+ $line = 0;
+ foreach($association as $elem) {
+ $ooe = $ooe%2;
+ //the format should be
+ //"NodeReachability"\t"EmailRootOffShift"\t"hv8plus01.ppd.pok.ibm.com"\t"Active"
+ $record = explode("\"", $elem);
+ $cond = $record[1];
+ $resp = $record[3];
+ $node = $record[5];
+ $state = $record[7];
+ echo "";
+ echo "$cond | ";
+ echo "$resp | ";
+ echo "$node | ";
+ echo "$state | ";
+ echo "";
+ if($state == "Active") {
+ insertButtons(array('label'=>'DeActivate', 'id'=>'deactivate', 'onclick'=>"control_RMCAssoc(\"$cond\", \"$node\", \"$resp\", \"stop\")"));
+ }else if($state == "Not active"){
+ insertButtons(array('label'=>'Activate', 'id'=>'activate', 'onclick'=>"control_RMCAssoc(\"$cond\", \"$node\", \"$resp\", \"start\")"));
+ }
+ echo " | ";
+ echo "
";
+ $ooe++;
+ $line++;
+ }
+}
+echo "
";
+
+?>