diff --git a/xCAT-UI/lib/monitor_display.php b/xCAT-UI/lib/monitor_display.php
index 1863890c9..f094a3339 100644
--- a/xCAT-UI/lib/monitor_display.php
+++ b/xCAT-UI/lib/monitor_display.php
@@ -37,9 +37,9 @@ function displayMapper_mon($mapper)
$ooe = $ooe%2;
echo "
";
echo " | ";
- echo "$name | ";
- echo "$stat | ";
- if(isset($nodemonstatus)) { echo "Yes | ";}else {echo "No | ";}
+ echo "$name | ";
+ echo "$stat | ";
+ if(isset($nodemonstatus)) { echo "Enabled | ";}else {echo "Disabled | ";}
echo "
";
$ooe++;
$line++;
@@ -93,6 +93,52 @@ TOS1;
return 0;
}
+function display_stat_mon_table($args)
+{
+ //create one table to disable or enable node/application monitoring
+ //the argument $args are one array like this:
+ //{ 'xcatmon' => {
+ // 'nodestat' => 'Enabled',
+ // 'appstat' => 'Disabled',
+ // },
+ //};
+ //
+
+ echo '';
+ foreach($args as $key => $value) {
+ $name = $key;
+
+ if($value{'nodestat'} == 'Enabled') {
+ $ns_tobe = 'Disable';
+ } else {
+ $ns_tobe = 'Enable';
+ }
+ if($value{'appstat'} == 'Enabled') {
+ $as_tobe = 'Disable';
+ } else {
+ $as_tobe = 'Enable';
+ }
+
+ }
+ echo "
Node/Application Status Monitoring for $name
";
+echo <<
+
+Node Status Application Monitoring |
+
+TOS2;
+ insertButtons(array('label'=>$ns_tobe, 'id'=>'node_stat', 'onclick'=>"node_stat_control(\"$name\")"));
+ echo ' | ';
+ echo '
';
+ echo '';
+ echo 'Application Status Application Monitoring | ';
+ echo '';
+ insertbuttons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>''));
+ echo ' | ';
+ echo '
';
+ echo ' ';
+}
+
function displayStatus()
{
//tell the user that the current interface is not done yet...
diff --git a/xCAT-UI/monitor/control_node_stat.php b/xCAT-UI/monitor/control_node_stat.php
new file mode 100644
index 000000000..721711e87
--- /dev/null
+++ b/xCAT-UI/monitor/control_node_stat.php
@@ -0,0 +1,36 @@
+",implode(' ', $errors), "";
+// exit;
+// }
+//
+//}else if($action == 'disable') {
+// //chtab name=$name monitoring.nodestatmon=''
+// $xml=docmd("chtab",' ', array("name=$name","monitoring.nodestatmon=\'\'"));
+// if(getXmlErrors($xml,$errors)) {
+// echo "",implode(' ', $errors), "
";
+// exit;
+// }
+//}
+
+echo "successful";
+?>
diff --git a/xCAT-UI/monitor/stat_mon.php b/xCAT-UI/monitor/stat_mon.php
index 734e7f777..80d3313b9 100644
--- a/xCAT-UI/monitor/stat_mon.php
+++ b/xCAT-UI/monitor/stat_mon.php
@@ -10,7 +10,65 @@ require_once "$TOPDIR/lib/functions.php";
require_once "$TOPDIR/lib/display.php";
require_once "$TOPDIR/lib/monitor_display.php";
+//get the name of the selected plug-in
+$name = $_REQUEST['name'];
+
+?>
+
+
+'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"));
+
+//get the current status for "node-status-monitor"
+$xml = docmd("monls", ' ', array($name));
+if(getXmlErrors($xml,$errors)) {
+ echo "",implode(' ',$errors), "
";
+ exit;
+}
+#then, parse the xml data
+foreach($xml->children() as $response) foreach($response->children() as $data) {
+ list($n, $stat, $nodemonstatus) = preg_split("/\s+/",$data);
+ if(isset($nodemonstatus)) {
+ $ns = "Enabled";
+ }else {
+ $ns = "Disabled";
+ }
+}
+
+display_stat_mon_table(array("$name"=>
+ array(
+ 'nodestat'=>$ns,
+ 'appstat'=>'Disabled', //currently application status monitoring is not supported by xCAT monitor Arch.
+ )));
displayStatus();
+insertButtons(array('label'=>'Next', id=>'next', 'onclick'=>''));
?>