mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	following comments, some updates are checked in for these files.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4007 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -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; | ||||
| } | ||||
| @@ -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 <div> 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'); | ||||
|   | ||||
| @@ -77,11 +77,9 @@ function displayTips($tips) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| function displayDialog($id, $title) | ||||
| function insertDiv($id) | ||||
| { | ||||
|     //add one new <div> to display jQuery dialog; | ||||
|     echo "<div id=$id title=\"$title\"></div>"; | ||||
|     return 0; | ||||
|     echo "<div id=$id></div>"; | ||||
| } | ||||
|  | ||||
| function displayMonTable() | ||||
| @@ -183,6 +181,7 @@ echo <<<TOS5 | ||||
|             <td>Response</td> | ||||
|             <td>Node</td> | ||||
|             <td>State</td> | ||||
|             <td>Action</td> | ||||
|         </tr> | ||||
|     </thead> | ||||
|     <tbody> | ||||
| @@ -213,6 +212,13 @@ TOS5; | ||||
|             echo "<td>$resp</td>"; | ||||
|             echo "<td>$node</td>"; | ||||
|             echo "<td>$state</td>"; | ||||
|             echo "<td>"; | ||||
|             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 "</td>";  | ||||
|             echo "</tr>"; | ||||
|             $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 '</div>'; | ||||
|     displayStatus(); | ||||
| } | ||||
|   | ||||
| @@ -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)) { | ||||
|   | ||||
| @@ -7,34 +7,19 @@ if(!isset($TOPDIR)) { $TOPDIR="/opt/xcat/ui";} | ||||
|  | ||||
| ?> | ||||
| <script type="text/javascript"> | ||||
| $(function(){ | ||||
|     //the code can't run in firefox; that's strange | ||||
|     $("#dialog").dialog({buttons: {"OK": function() {$(this).dialog("close");}}, autoOpen: false}); | ||||
|     $(".description").click(function(){ | ||||
|         $.get("monitor/plugin_desc.php", {name: $(this).text()}, function(data){ | ||||
|             $("#dialog").html(data); | ||||
|             $("#dialog").dialog('open'); | ||||
|             return false; | ||||
|         }) | ||||
|     }); | ||||
| }); | ||||
| function clickNext() | ||||
| { | ||||
|     //get the user's selection, and load the web page named "stat_mon.php"; | ||||
|     var item = $('input[@name=plugins][@checked]').val(); | ||||
|     if(item){ | ||||
|         loadMainPage('monitor/stat_mon.php?name='+item); | ||||
|     } | ||||
| } | ||||
|     showPluginOptions(); | ||||
|     showPluginDescription(); | ||||
| </script> | ||||
| <?php | ||||
| displayMapper_mon(array('home'=>'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 <b>\"Start\", \"Stop\" or \"Restart\"</b> to setup monitoring plugin")); | ||||
|  | ||||
| displayMonTable(); | ||||
|  | ||||
| displayDialog("dialog", "Plug-in Description"); | ||||
| insertButtons(array('label' => 'Next', 'id'=> 'next', 'onclick'=>'clickNext()')); | ||||
| ?> | ||||
| insertDiv("plugin_desc"); | ||||
|  | ||||
| insertDiv("options"); | ||||
| ?> | ||||
							
								
								
									
										52
									
								
								xCAT-UI/monitor/options.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								xCAT-UI/monitor/options.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| <?php | ||||
|  | ||||
| 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"; | ||||
|  | ||||
| $name = $_REQUEST['name']; | ||||
|  | ||||
| echo "<p>Available Configurations for  <b>$name</b></p>"; | ||||
|  | ||||
| echo '<table id="tabTable" class="tabTable" cellspacing="1">'; | ||||
| echo "<tbody>"; | ||||
|  | ||||
| //set up the options for the plugin with the name "$name" | ||||
| if($name == "rmcmon") { | ||||
|     //node status monitor, RMC events, RMC resources | ||||
|     echo "<tr class='ListLine0' id='row0'>"; | ||||
|     echo "<td>Node/Application Status Monitoring Setting</td>"; | ||||
|     echo "<td>"; | ||||
|     insertButtons(array('label'=>'Configure', 'id'=>'rmc_nodestatmon', 'onclick'=>'loadMainPage("monitor/stat_mon.php?name=rmcmon")')); | ||||
|     echo "</td>"; | ||||
|     echo "</tr>"; | ||||
|  | ||||
|     echo "<tr class='ListLine1' id='row1'>"; | ||||
|     echo "<td>RMC Events Monitoring Setting</td>"; | ||||
|     echo "<td>"; | ||||
|     insertButtons(array('label'=>'Configure', 'id'=>'rmc_event', 'onclick'=>'loadMainPage("monitor/rmc_event_define.php")')); | ||||
|     echo "</td>"; | ||||
|     echo "</tr>"; | ||||
|  | ||||
|     echo "<tr class='ListLine0' id='row2'>"; | ||||
|     echo "<td>RMC Resource Monitoring Setting</td>"; | ||||
|     echo "<td>"; | ||||
|     insertButtons(array('label'=>'Configure', 'id'=>'rmc_resource', 'onclick'=>'loadMainPage("monitor/rmc_resource_define.php")')); | ||||
|     echo "</td>"; | ||||
|     echo "</tr>"; | ||||
|  | ||||
| } else { | ||||
|     //there's only "node status monitoring" is enabled | ||||
|     echo "<tr class='ListLine0' id='row0'>"; | ||||
|     echo "<td>Node/Application Status Monitoring Setting</td>"; | ||||
|     echo "<td>"; | ||||
|     insertButtons(array('label'=>'Configure', 'id'=>$name."_nodestatmon", 'onclick'=>"loadMainPage(\"monitor/stat_mon.php?name=$name\")")); | ||||
|     echo "</td>"; | ||||
|     echo "</tr>"; | ||||
| } | ||||
|  | ||||
| echo "</tbody></table>"; | ||||
| ?> | ||||
| @@ -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"; | ||||
| ?> | ||||
| <?php | ||||
|  | ||||
| /* | ||||
|  * Run the command "monls $name -d", | ||||
|  * return the information | ||||
| @@ -25,6 +24,8 @@ foreach ($xml->children() as $response) foreach ($response->children() as $data) | ||||
|     $information .= "\n<br/>"; | ||||
|     //print_r($data); | ||||
| } | ||||
| echo "<p>"; | ||||
| echo $information; | ||||
| echo "</p>"; | ||||
| ?> | ||||
|  | ||||
|   | ||||
| @@ -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")')); | ||||
|  | ||||
| ?> | ||||
|   | ||||
| @@ -18,15 +18,17 @@ displayTips(array("All the available RMC resources are listed here;", | ||||
|  | ||||
| displayMonsetting(); | ||||
|  | ||||
| ?> | ||||
|  | ||||
| <div id="monsetting_tips"> | ||||
|     <div id="rmcSrcList"><?php displayRMCRsrc(); ?></div> | ||||
|     <div id="rmcScrAttr"><?php displayRMCAttr(); ?></div> | ||||
| </div> | ||||
| echo '<div id="monsetting_tips">'; | ||||
| echo '<div id="rmcSrcList">'; | ||||
| displayRMCRsrc(); | ||||
| echo '</div>'; | ||||
| echo '<div id="rmcScrAttr">'; | ||||
| displayRMCAttr(); | ||||
| echo '</div>'; | ||||
| echo '</div>'; | ||||
|  | ||||
|  | ||||
| <div><?php displayStatus(); ?></div> | ||||
| <?php | ||||
| insertButtons(array('label'=>'Next', 'id'=>'next', 'onclick'=>'loadMainPage("monitor/monlist.php");')); | ||||
| ?> | ||||
| displayStatus(); | ||||
|  | ||||
| ?> | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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")')); | ||||
| ?> | ||||
|   | ||||
							
								
								
									
										83
									
								
								xCAT-UI/monitor/updateCondResp.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								xCAT-UI/monitor/updateCondResp.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | ||||
| <?php | ||||
|  | ||||
| //activate/deactivate the specified condition&response association; | ||||
| //then, update the content of the table in <div id="association">; | ||||
| 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 "<p class=Error>",implode(' ', $errors), "</p>"; | ||||
|     exit; | ||||
| } | ||||
|  | ||||
| //the following code is copied from displayAssociation() in the file: monitor_display.php | ||||
| echo <<<TOS5 | ||||
| <b>Available Condition/Response Associations</b> | ||||
| <table id="tabTable" class="tabTable" cellspacing="1"> | ||||
|     <thead> | ||||
|         <tr class="colHeaders"> | ||||
|             <td>Condition</td> | ||||
|             <td>Response</td> | ||||
|             <td>Node</td> | ||||
|             <td>State</td> | ||||
|             <td>Action</td> | ||||
|         </tr> | ||||
|     </thead> | ||||
|     <tbody> | ||||
| TOS5; | ||||
| $xml = docmd("webrun", "", array("lscondresp")); | ||||
| if(getXmlErrors($xml,$errors)) { | ||||
|     echo "<p class=Error>",implode(' ', $errors), "</p>"; | ||||
|     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 "<tr class='ListLine$ooe' id='row$line'>"; | ||||
|         echo "<td>$cond</td>"; | ||||
|         echo "<td>$resp</td>"; | ||||
|         echo "<td>$node</td>"; | ||||
|         echo "<td>$state</td>"; | ||||
|         echo "<td>"; | ||||
|         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 "</td>"; | ||||
|         echo "</tr>"; | ||||
|         $ooe++; | ||||
|         $line++; | ||||
|     } | ||||
| } | ||||
| echo "</tbody></table>"; | ||||
|  | ||||
| ?> | ||||
		Reference in New Issue
	
	Block a user