now, the graph view for RMC monitoring interface can be dynamic updated.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4225 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
mxi1 2009-09-25 08:50:49 +00:00
parent dcf192a350
commit b845dde698
6 changed files with 30 additions and 54 deletions

View File

@ -536,37 +536,6 @@ function show_monshow_data(type,range)
}
}
function show_monshow_graph() {
//used for the "view by graph" button in the web page "rmc_monshow.php"
if($(":input[@checked]").size() != 0) {
$("#monshow_data").empty();
$("#monshow_opt").hide("slow");
$("#back_btn").show("slow");
$(":input[@checked]").each(function(i) {
//generate graphics for all the attributes in "checked" status
$.get("monitor/rmc_monshow_data_source.php", {mode: "graph", value: $(this).attr("value")}, function(data) {
$("#monshow_data").append(data);
});
});
} else {
}
}
function show_monshow_text() {
//used for the "view by text" button in the web page "rmc_monshow.php";
if($(":input[@checked]").size() != 0) {
$("#monshow_data").empty();
$("#monshow_opt").hide("slow");
$("#back_btn").show("slow");
$(":input[@checked]").each(function(i) {
$.get("monitor/rmc_monshow_data_source.php", {mode: "text", value: $(this).attr("value")}, function(data) {
$("#monshow_data").append(data);
});
});
} else {
$("#monshow_data").html("<p><b>Please select one or more attributes from the table</b></p>");
}
}
function init_rmc_monshow_back_btn() {
$("#back_btn").hide();
}
@ -593,20 +562,30 @@ function handle_tips() {
});
}
function rmc_monshow_draw_by_flot(value)
function rmc_monshow_draw_by_flot(div, value)
{
//collecting data from "monshow" command,
//then, draw by the jQuery-plugin: flot
//http://groups.google.com/group/flot-graphs/browse_thread/thread/93358c68d44412a4?pli=1
//update the graph by every minutes
var division = document.getElementById(div);
window.setInterval(function() {
if($("#monshow_data") && $("#monshow_data").html() != "") {
$.getJSON("monitor/flot_get_data.php", {attr: value}, function(data) {
$.plot($(division),data, options);
});
}
}
, 60*1000);
var options = {
xaxis: {
mode: 'time'
},
lines: {show: true, fill: true}
};
$.getJSON("monitor/flot_get_data.php", {attr: value}, function(data) {
$.plot($("#placeholder"),data, options);
$.plot($(division),data, options);
});
}

View File

@ -539,13 +539,16 @@ echo <<<EOS
<ul>
<li><a href='#' onclick='loadMainPage("monitor.php")'>Show syslog Entries</a></li>
<li><a href='#' onclick='loadMainPage("monitor/monlist.php")'>Monitor Setup</a></li>
<li><a href='#' onclick=''>View Events Log</a></li>
<li><a href='#' onclick='loadMainPage("monitor/rmc_lsevent.php")'>View RMC Events Log</a></li>
<li>There's only text format for events' log</li>
<li><a href='#' onclick=''>View Performance</a></li>
<li><a href='#' onclick='loadMainPage("monitor/rmc_monshow.php")'>View RMC Performance</a></li>
<li>There're text/graphics formats for performance view</li>
<li>Monitoring Events/Performances by Monitoring Plugins, such as RMC...</li>
<li>This is still <b>UNDER DEVELOPMENT</b>.</li>
</ul>
<ul>
<h1><a href='#' onclick='loadMainPage("monitor/newmonlist.php")'>New Style for Monitor</a></h1>
</ul>
</div>
EOS;
}

View File

@ -370,8 +370,9 @@ function RMCEventLogToTable()
//displayRMCEventLog() to display the RMC event logs in one table with "tablesorter" class
function displayRMCEvnetLog()
{
echo '<div class="mContent">';
echo <<<TOS9
<table class="tablesorter" cellspacing="1">
<table id="lsevent_tab" class="tablesorter" cellspacing="1">
<thead>
<tr>
<th>Time</th>
@ -385,10 +386,11 @@ TOS9;
//TODO: the following javascript doesn't work well.
echo <<<TOS8
<script type="text/javascript" type"utf-8">
$("table").tablesorter({ sortList: [[0,1],[1,1]] });
$("#lsevent_tab").tablesorter({ sortList: [[0,1],[1,1]] });
</script>
TOS8;
echo "</div>";
}
function displayRMCMonshowAttr($attr, $nr) {
@ -441,15 +443,12 @@ function displayRMCMonshowAttr($attr, $nr) {
function displayRMCMonshowGraph($value, $nr) {
//display the RMC Performance Data
$place = $nr.$value;
echo <<<TOS11
<div>
<script type="text/javascript">
rmc_monshow_draw_by_flot("$value");
rmc_monshow_draw_by_flot("$place","$value");
</script>
<p><b>The Graph View for RMC Resource</b></p>
<div id='placeholder' style='width:600px;height:300px'>
</div>
</div>
<div id="$place" style="width:100%;height:240px"></div>
TOS11;
}

View File

@ -4,15 +4,17 @@ if(!isset($TOPDIR)) { $TOPDIR="..";}
require_once "$TOPDIR/lib/functions.php";
require_once "$TOPDIR/lib/display.php";
require_once "$TOPDIR/lib/monitor_display.php";
?>
<?php
displayMapper(array('home'=>'main.php', 'monitor' =>''));
displayTips(array("Click the name of each plugin, you can get the plugin's description.",
"Select one plugin, choose the options for set up monitoring ",
"Click the button <b>\"Start\", \"Stop\" or \"Restart\"</b> to setup monitoring plugin"));
//TODO: change the view style;
//Change all the "Actions/Description/Configurations/Views" to Tabs
//And, list all the monitoring plugins under the tree? Not sure now.
displayMonTable();
insertDiv("plugin_desc");

View File

@ -17,15 +17,9 @@ $name = $_REQUEST['name'];
displayMapper(array('home'=>'main.php', 'monitor' =>''));
displayTips(array("View all RMC events here","TODO"));
displayTips(array("You can view the latest 60 RMC events here"));
//Following the "Syslog Entries" web page
echo '<div class="mContent">';
displayRMCEvnetLog();
echo '</div>';
displayStatus();
insertButtons(array('label' => 'Next', 'id'=> 'next', 'onclick'=>''));
?>

View File

@ -30,7 +30,6 @@ if($id == "cluster") {
}
if(false !== strpos($data, "lpar")) {
//display the options for the "monshow" command
show_monshow_options($id);
} else {
echo "<b>Currently, it only supports one single node. Please select one single node under the LPAR tree.</b>";