2009-07-29 06:07:58 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* All the <html> code related with monitor interface is put here.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#displayMonitorLists() will generate all the monitoring plug-ins,
|
|
|
|
#the user can select the plug-ins he wants to operate on,
|
|
|
|
#and press the "Next" button;
|
|
|
|
function displayMonitorLists() {
|
|
|
|
#The command "monls -a" is used to get the monitoring plug-ins list
|
|
|
|
$xml = docmd("monls"," ", array('-a'));
|
|
|
|
if(getXmlErrors($xml,$errors)) {
|
|
|
|
echo "<p class=Error>",implode(' ', $errors), "</p>";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
#then, parse the xml data
|
|
|
|
$ooe = 0;
|
|
|
|
$line = 0;
|
|
|
|
foreach($xml->children() as $response) foreach($response->children() as $data) {
|
|
|
|
list($name, $stat, $nodemonstatus) = preg_split("/\s+/", $data);
|
|
|
|
$ooe = $ooe%2;
|
|
|
|
echo "<tr class='ListLine$ooe' id='row$line'>";
|
|
|
|
echo "<td><input type='radio' name='plugins' value='$name' /></td>";
|
2009-07-29 11:30:44 +00:00
|
|
|
echo "<td ><a class='description' href='#'>$name</a></td>";
|
|
|
|
echo "<td >$stat</td>";
|
|
|
|
if(isset($nodemonstatus)) { echo "<td >Enabled</td>";}else {echo "<td >Disabled</td>";}
|
2009-08-13 06:45:39 +00:00
|
|
|
echo "<td>";
|
|
|
|
$name_str = "\"$name\"";
|
|
|
|
if($stat == "monitored") {
|
|
|
|
$act_str = "\"stop\"";
|
|
|
|
insertButtons(array('label'=>'Stop', 'id'=>'stop', 'onclick'=>"monsetupAction($name_str, $act_str)"));
|
|
|
|
$act_str = "\"restart\"";
|
|
|
|
insertButtons(array('label'=>'Restart', 'id'=>'restart', 'onclick'=>"monsetupAction($name_str, $act_str)"));
|
|
|
|
}else {
|
|
|
|
$act_str = "\"start\"";
|
|
|
|
insertButtons(array('label' => 'Start', 'id'=>'start', 'onclick' => "monsetupAction($name_str, $act_str)"));
|
|
|
|
}
|
|
|
|
echo "</td>";
|
2009-07-29 06:07:58 +00:00
|
|
|
echo " </tr>";
|
|
|
|
$ooe++;
|
|
|
|
$line++;
|
|
|
|
//echo "<tr><td><input type='checkbox' />$name</td><td>$stat</td><td><a onclick='LoadMainPage("main.php")'>$name</a></td></tr>";
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
function displayTips($tips)
|
|
|
|
{
|
|
|
|
//to tell the user how to operate on the current web page
|
|
|
|
//the argument $tips is an array like this:
|
|
|
|
//{
|
|
|
|
// "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.",
|
|
|
|
//}
|
2009-09-03 07:23:32 +00:00
|
|
|
echo '<div class="tips">';
|
|
|
|
echo '<p class="tips_head"><b>Tips:</b>(Click me to display tips)</p>';
|
|
|
|
echo '<div class="tips_content">';
|
2009-07-29 06:07:58 +00:00
|
|
|
foreach ($tips as $tip) {
|
2009-08-13 06:45:39 +00:00
|
|
|
echo "<p>$tip</p>";
|
2009-07-29 06:07:58 +00:00
|
|
|
echo "\n";
|
|
|
|
}
|
2009-09-03 07:23:32 +00:00
|
|
|
echo "</div>";
|
|
|
|
|
|
|
|
echo '<script type="text/javascript">';
|
|
|
|
echo '$(handle_tips());';
|
|
|
|
echo '</script>';
|
2009-08-05 16:23:52 +00:00
|
|
|
echo '</div>';
|
2009-07-29 06:07:58 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-18 03:11:36 +00:00
|
|
|
function insertDiv($id)
|
2009-07-29 06:07:58 +00:00
|
|
|
{
|
2009-08-18 03:11:36 +00:00
|
|
|
echo "<div id=$id></div>";
|
2009-07-29 06:07:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function displayMonTable()
|
|
|
|
{
|
|
|
|
//create one table to display the monitoring plugins' list
|
2009-08-05 16:23:52 +00:00
|
|
|
echo '<div id="monlist_table">';
|
2009-07-29 06:07:58 +00:00
|
|
|
echo <<<TOS1
|
|
|
|
<table id="tabTable" class="tabTable" cellspacing="1">
|
|
|
|
<thead>
|
|
|
|
<tr class="colHeaders">
|
|
|
|
<td></td>
|
|
|
|
<td>Plug-in Name</td>
|
|
|
|
<td>Status</td>
|
|
|
|
<td>Node Status Monitoring</td>
|
2009-08-13 06:45:39 +00:00
|
|
|
<td>Action</td>
|
2009-07-29 06:07:58 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
TOS1;
|
2009-08-19 09:12:58 +00:00
|
|
|
echo <<<TOS9
|
|
|
|
<script type="text/javascript">
|
|
|
|
showPluginOptions();
|
|
|
|
showPluginDescription();
|
|
|
|
</script>
|
|
|
|
TOS9;
|
2009-07-29 06:07:58 +00:00
|
|
|
echo '<tbody id="monlist">';
|
|
|
|
displayMonitorLists();
|
|
|
|
echo "</tbody></table></div>";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-07-29 11:30:44 +00:00
|
|
|
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 '<div style="margin-right: 50px; width:auto; margin-left: 50px">';
|
|
|
|
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 "<h3>Node/Application Status Monitoring for $name</h3>";
|
|
|
|
echo <<<TOS2
|
|
|
|
<table cellspacing="1" class="tabTable" id="tabTable"><tbody>
|
|
|
|
<tr class="ListLine0">
|
2009-08-05 16:23:52 +00:00
|
|
|
<td>Node Status Monitoring</td>
|
2009-07-29 11:30:44 +00:00
|
|
|
<td>
|
|
|
|
TOS2;
|
|
|
|
insertButtons(array('label'=>$ns_tobe, 'id'=>'node_stat', 'onclick'=>"node_stat_control(\"$name\")"));
|
2009-09-10 06:57:06 +00:00
|
|
|
//TODO: change the function name of node_stat_control
|
2009-07-29 11:30:44 +00:00
|
|
|
echo '</td>';
|
|
|
|
echo '</tr>';
|
|
|
|
echo '<tr class="ListLine1">';
|
2009-08-05 16:23:52 +00:00
|
|
|
echo '<td>Application Status Monitoring</td>';
|
2009-07-29 11:30:44 +00:00
|
|
|
echo '<td>';
|
2009-09-03 04:44:56 +00:00
|
|
|
insertButtons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>'show_monshow_data()'));
|
2009-07-29 11:30:44 +00:00
|
|
|
echo '</td>';
|
|
|
|
echo '</tr>';
|
|
|
|
echo '</tbody> </table> </div>';
|
|
|
|
}
|
|
|
|
|
2009-07-29 06:07:58 +00:00
|
|
|
function displayStatus()
|
|
|
|
{
|
|
|
|
//tell the user that the current interface is not done yet...
|
2009-08-13 06:45:39 +00:00
|
|
|
echo "<div id='devstatus'><p>This interface is still under development -use accordingly.</p></div>";
|
2009-07-29 06:07:58 +00:00
|
|
|
}
|
2009-08-05 16:23:52 +00:00
|
|
|
|
|
|
|
function displayOSITree()
|
|
|
|
{
|
|
|
|
//display the node range tree, but only with the nodes with OSI type
|
|
|
|
//this follows the function displayNrTree();
|
|
|
|
//it doesn't work on firefox!!!
|
|
|
|
echo <<<EOS3
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(init_ositree());
|
|
|
|
</script>
|
|
|
|
<div id=ositree></div>
|
|
|
|
EOS3;
|
|
|
|
}
|
|
|
|
|
|
|
|
function displayAssociation()
|
|
|
|
{
|
|
|
|
echo '<div id="association">';
|
|
|
|
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>
|
2009-08-18 03:11:36 +00:00
|
|
|
<td>Action</td>
|
2009-08-05 16:23:52 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2009-08-13 06:45:39 +00:00
|
|
|
<tbody>
|
2009-08-05 16:23:52 +00:00
|
|
|
TOS5;
|
2009-08-13 06:45:39 +00:00
|
|
|
$xml = docmd("webrun", "", array("lscondresp"));
|
|
|
|
if(getXmlErrors($xml,$errors)) {
|
|
|
|
echo "<p class=Error>",implode(' ', $errors), "</p>";
|
|
|
|
exit;
|
|
|
|
}
|
2009-08-05 16:23:52 +00:00
|
|
|
//get all the condition&response associations for RMC
|
2009-08-13 06:45:39 +00:00
|
|
|
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>";
|
2009-08-18 03:11:36 +00:00
|
|
|
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>";
|
2009-08-13 06:45:39 +00:00
|
|
|
echo "</tr>";
|
|
|
|
$ooe++;
|
|
|
|
$line++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo "</tbody></table></div>";
|
2009-08-05 16:23:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-13 06:45:39 +00:00
|
|
|
function displayCond()
|
2009-08-05 16:23:52 +00:00
|
|
|
{
|
|
|
|
//the user selects one node/noderange from the #ositree div
|
2009-08-13 06:45:39 +00:00
|
|
|
echo <<<COND
|
|
|
|
<div id="avail_cond">
|
|
|
|
<b>Available Conditions</b>
|
|
|
|
<table id="tabTable" class="tabTable" cellspacing="1">
|
|
|
|
<thead>
|
|
|
|
<tr class="colHeaders">
|
|
|
|
<td></td>
|
|
|
|
<td>Conditions</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
COND;
|
|
|
|
$xml = docmd("webrun", '', array("lscondition"));
|
|
|
|
foreach($xml->children() as $response) foreach($response->children() as $data) {
|
|
|
|
//get the data from xcatd
|
|
|
|
$conditions = explode("=", $data);
|
|
|
|
}
|
|
|
|
$ooe = 0;
|
|
|
|
$line = 0;
|
|
|
|
foreach($conditions as $elem) {
|
|
|
|
$ooe = $ooe%2;
|
|
|
|
echo "<tr class='ListLine$ooe' id='row$line'>";
|
|
|
|
echo "<td><input type=\"radio\" name=\"conditions\" value=\"$elem\" /></td>";
|
|
|
|
echo "<td>$elem</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
$ooe++;
|
|
|
|
$line++;
|
|
|
|
}
|
|
|
|
echo "</tbody></table></div>";
|
2009-08-05 16:23:52 +00:00
|
|
|
return 0;
|
2009-08-13 06:45:39 +00:00
|
|
|
|
2009-08-05 16:23:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function displayResp()
|
|
|
|
{
|
2009-08-13 06:45:39 +00:00
|
|
|
echo <<<RESP
|
|
|
|
<div id="avail_resp">
|
|
|
|
<b>Available Response</b>
|
|
|
|
<table id="tabTable" class="tabTable" cellspacing="1">
|
|
|
|
<thead>
|
|
|
|
<tr class="colHeaders">
|
|
|
|
<td></td>
|
|
|
|
<td>Response</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
RESP;
|
|
|
|
$xml=docmd("webrun", '', array("lsresponse"));
|
|
|
|
$ooe=0;
|
|
|
|
$line=0;
|
|
|
|
foreach($xml->children() as $response) foreach($response->children() as $data) {
|
|
|
|
$responses = explode("=", $data);
|
|
|
|
}
|
|
|
|
foreach($responses as $elem) {
|
|
|
|
$ooe = $ooe%2;
|
|
|
|
echo "<tr class='ListLine$ooe' id='row$line'>";
|
|
|
|
echo "<td><input type='checkbox' name='responses' value='$elem' /></td>";
|
|
|
|
echo "<td>$elem</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
$ooe++;
|
|
|
|
$line++;
|
|
|
|
}
|
|
|
|
echo '</tbody></table></div>';
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
function displayCondResp()
|
|
|
|
{
|
|
|
|
echo '<div id="condresp">';
|
|
|
|
displayAssociation();
|
|
|
|
displayCond();
|
|
|
|
displayResp();
|
|
|
|
insertButtons(array('label'=>'Add', id=>'addAssociation', 'onclick'=>'mkCondResp()'));
|
2009-08-18 03:11:36 +00:00
|
|
|
insertButtons(array('label'=>'Cancel', id=>'cancel_op', 'onclick'=>'clearEventDisplay()'));
|
2009-08-05 16:23:52 +00:00
|
|
|
echo '</div>';
|
2009-08-13 06:45:39 +00:00
|
|
|
displayStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
function displayRMCRsrc()
|
|
|
|
{
|
|
|
|
echo <<<TOS0
|
|
|
|
<b>Available RMC Resources</b>
|
|
|
|
<table id="tabTable" class="tabTable" cellspacing="1">
|
|
|
|
<thead>
|
|
|
|
<tr class="colHeaders">
|
|
|
|
<td></td>
|
|
|
|
<td>Class Name</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
TOS0;
|
|
|
|
$xml = docmd("webrun", "", array("lsrsrc"));
|
|
|
|
if(getXmlErrors($xml,$errors)) {
|
|
|
|
echo "<p class=Error>",implode(' ', $errors), "</p>";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
foreach($xml->children() as $response) foreach($response->children() as $data) {
|
|
|
|
//get all the class name
|
|
|
|
$classes = explode("=", $data);
|
|
|
|
}
|
|
|
|
$ooe = 0;
|
|
|
|
$line = 0;
|
|
|
|
foreach($classes as $class) {
|
|
|
|
$ooe = $ooe%2;
|
|
|
|
echo "<tr class='ListLine$ooe' id='row$line'>";
|
|
|
|
echo "<td><input type='radio' name='classGrp' value='$class' onclick='showRMCAttrib()' /> </td>";
|
|
|
|
echo "<td>$class</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
$ooe++;
|
|
|
|
$line++;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</tbody></table>";
|
2009-08-05 16:23:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-13 06:45:39 +00:00
|
|
|
function displayRMCAttr()
|
|
|
|
{
|
|
|
|
echo "<p>Select the RMC Resource, you will see all its available attributes here.</p>";
|
|
|
|
}
|
|
|
|
|
2009-09-03 04:44:56 +00:00
|
|
|
|
|
|
|
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>";
|
|
|
|
}
|
|
|
|
|
2009-09-17 14:54:43 +00:00
|
|
|
function displayRMCMonshowAttr($attr, $nr) {
|
2009-09-03 04:44:56 +00:00
|
|
|
//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>";
|
|
|
|
|
2009-09-17 14:54:43 +00:00
|
|
|
if($nr == "cluster") {
|
|
|
|
//get all the data by the command "monshow"
|
|
|
|
$xml = docmd("monshow", "", array("rmcmon", "-t", "60", "-a", "$attr"));
|
|
|
|
//the error handling is skipped
|
|
|
|
}elseif($nr == "summary") {
|
|
|
|
$xml = docmd("monshow", "", array("rmcmon", "-s", "-t", "60", "-a", "$attr"));
|
|
|
|
}else {
|
|
|
|
$xml = docmd("monshow", "", array("rmcmon", "$nr", "-t", "60", "-a", "$attr"));
|
|
|
|
}
|
|
|
|
//the formats of the data are different based on $nr
|
|
|
|
//print_r($xml);
|
2009-09-03 04:44:56 +00:00
|
|
|
$index = 0;
|
|
|
|
foreach($xml->children() as $response) foreach($response->children() as $data) {
|
|
|
|
//handle the data here
|
2009-09-10 06:57:06 +00:00
|
|
|
//skip the first 2 lines
|
|
|
|
if($index++ < 2) {
|
2009-09-03 04:44:56 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-09-10 06:57:06 +00:00
|
|
|
//then, parse "date" & "value"
|
|
|
|
$arr = preg_split("/\s+/", $data);
|
|
|
|
array_pop($arr);
|
2009-09-17 14:54:43 +00:00
|
|
|
$tmp = array_pop($arr);
|
|
|
|
if($tmp == '-') {
|
|
|
|
$val = array_pop($arr);
|
|
|
|
$time = implode(" ", $arr);
|
|
|
|
echo "<tr>";
|
|
|
|
echo "<td>$time</td>";
|
|
|
|
echo "<td>$val</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
2009-09-10 06:57:06 +00:00
|
|
|
}
|
|
|
|
echo "</tbody>";
|
|
|
|
echo "</table>";
|
|
|
|
echo "</div>";
|
|
|
|
}
|
|
|
|
|
2009-09-17 14:54:43 +00:00
|
|
|
function displayRMCMonshowGraph($value, $nr) {
|
2009-09-10 06:57:06 +00:00
|
|
|
//display the RMC Performance Data
|
|
|
|
echo <<<TOS11
|
|
|
|
<div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
rmc_monshow_draw_by_flot("$value");
|
|
|
|
</script>
|
|
|
|
<p><b>The Graph View for RMC Resource</b></p>
|
|
|
|
<div id='placeholder' style='width:600px;height:300px'>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
TOS11;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* function displayOptionsForPlugin($plugin)
|
|
|
|
* *****************************************
|
|
|
|
* when the user selects one plugin, the avaiable configuration options will display in <div id='monconfig'>
|
|
|
|
* TODO: for the non-rmcmon plugins, only the option "node/application status monitoring setting" is shown;
|
|
|
|
*
|
|
|
|
* the avaiable view options will also display in <div id='monview'>,
|
|
|
|
* TODO: right now, it's only implemented for rmcmon plugin.
|
|
|
|
*/
|
|
|
|
function displayOptionsForPlugin($name)
|
|
|
|
{
|
|
|
|
echo "<div id='monconfig'>";
|
|
|
|
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>";
|
2009-09-03 04:44:56 +00:00
|
|
|
echo "<td>";
|
2009-09-10 06:57:06 +00:00
|
|
|
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")'));
|
2009-09-03 04:44:56 +00:00
|
|
|
echo "</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
|
2009-09-10 06:57:06 +00:00
|
|
|
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>";
|
2009-09-03 04:44:56 +00:00
|
|
|
}
|
|
|
|
|
2009-09-10 06:57:06 +00:00
|
|
|
echo "</tbody></table>";
|
|
|
|
|
2009-09-03 04:44:56 +00:00
|
|
|
echo "</div>";
|
2009-09-10 06:57:06 +00:00
|
|
|
|
|
|
|
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">
|
|
|
|
<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>";
|
2009-09-17 14:54:43 +00:00
|
|
|
insertButtons(array('label'=>'View By text/graphics', 'id'=>'rmc_resrc_text', 'onclick'=>'loadMainPage("monitor/rmc_monshow.php")'));
|
2009-09-10 06:57:06 +00:00
|
|
|
echo "</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo "<p>There's no view functions for $name.</p>";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</tbody></table></div>";
|
2009-09-03 04:44:56 +00:00
|
|
|
}
|
|
|
|
|
2009-09-10 06:57:06 +00:00
|
|
|
/*
|
|
|
|
* function displayNodeAppStatus($name)
|
|
|
|
* ************************************
|
|
|
|
* to display the web page "Node/Application Status Monitoring"
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function displayNodeAppStatus($name)
|
|
|
|
{
|
|
|
|
displayMapper(array('home'=>'main.php', 'monitor'=>''));
|
|
|
|
displayTips(array(
|
|
|
|
"Enable/disable Node/App Status Monitoring by clicking the button",
|
|
|
|
"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));
|
|
|
|
if(getXmlErrors($xml,$errors)) {
|
|
|
|
echo "<p class=Error>",implode(' ',$errors), "</p>";
|
|
|
|
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.
|
|
|
|
)));
|
|
|
|
}
|
2009-09-03 04:44:56 +00:00
|
|
|
|
2009-07-29 06:07:58 +00:00
|
|
|
?>
|